Recognos/Metrics.NET

Change default Context name (graphite support)

Opened this issue · 0 comments

Hello,

I've tried a few things before posting this this issue but without success.

I am trying to change the default name under which metrics are published to graphite and I am using the .Net 40 branch.
Let's say I have an app MyApp, mettrics will be sent to graphite with name MyApp.Application and MyApp.System. I found how to change the MyAPP with the app.config but it replaces "." by "" (as seen in the code.." and the same for if .WithAllCounters("me.system", "me.application") is used -> "." -> "".

The problem is graphite organizes metrics in folders based on the "." so I really need that. :)
I also tried to create a new DefaultMetricsContext but wihtout luck..

static public void Configure(string prefix)
        {
            if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Metrics.GlobalContextName"]))
                ConfigurationManager.AppSettings["Metrics.GlobalContextName"] = "app";
            MyMetric = new DefaultMetricsContext("app").Context("gw").Context(Environment.MachineName).Context(Process.GetCurrentProcess().ProcessName);
            new MetricsConfig(MyMetric).WithHttpEndpoint("http://localhost:1234/")
                //.WithInternalMetrics()
                .WithAllCounters("me.system", "me.application")
                .WithReporting(config => config
                    //.WithCSVReports(@"c:\temp\reports\", TimeSpan.FromSeconds(10))
                    .WithGraphite(new Uri("net.udp://myserver:2003"), TimeSpan.FromSeconds(10))
                );      
        }

-> I still get all in MyAPP.me_application and MyApp.me_system.
Could someone point me in the right direcction to get something like that in graphite ?

app.gw.lutpc1038.Service.Application

Thanks !