Skip to content

Simple wrapper around statsd-csharp-client which adds a prefix based on the hosts Fully Qualified Domain Name and a configurable application name prefix.

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE
Apache-2.0
license.txt
Notifications You must be signed in to change notification settings

plmwong/statsd-helper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

StatsDHelper

Simple wrapper around statsd-csharp-client which adds a prefix based on the hosts Fully Qualified Domain Name and a configurable application name prefix.

So for a metric named api.responses.httpstatus.500 coming from a host named servername.example.com with a configured application name of api.

The emitted metric will be:

com.example.servername.api.responses.httpstatus.500

The helper class is designed to fail silently in the event of misconfiguration (look for warnings in your build log) and to be used similarly to something like log4net.

Quick Start

Configuration

    <add key="StatsD.ApplicationName" value="foocalculator" />
    <add key="StatsD.Host" value="fooserver" />
    <add key="StatsD.Port" value="8125" />

Example Usage:

    public class FooService
    {
        private readonly IStatsDHelper _statsDHelper = StatsDHelper.StatsDHelper.Instance;

        public void CalculateFoo(int a, int b){
            _statsDHelper.LogCount("calculatefoo");
        }

        public List<FooWidget> GetFooWidgets(){
            var repository = new FooRepository();

            using(_statsDHelper.LogTiming("foorepository.getfoowidgets.latency") {
                return repository.GetFooWidgets();
            }
        }
    }

About

Simple wrapper around statsd-csharp-client which adds a prefix based on the hosts Fully Qualified Domain Name and a configurable application name prefix.

Resources

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE
Apache-2.0
license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%