Coder Social home page Coder Social logo

etishor / metrics.net Goto Github PK

View Code? Open in Web Editor NEW
647.0 66.0 150.0 5.54 MB

The Metrics.NET library provides a way of instrumenting applications with custom metrics (timers, histograms, counters etc) that can be reported in various ways and can provide insights on what is happening inside a running application.

License: Apache License 2.0

Shell 0.06% C# 99.63% Batchfile 0.31%

metrics.net's Introduction

#Metrics.NET

Branch Appveyor Travis
master Master Build status Mono Build Status
dev Dev Build status Mono Build Status

NuGet Status Issue Stats Issue Stats

Metrics.NET - a .NET Port, with lots of additional functionality, of the awesome Java metrics library by Coda Hale.

A lot more information and documentation are available in the wiki.

Note: this repo is no longer being actively maintained. See Recognos/Metrics.NET for a continuation of the project.

License

This library will always keep the same license as the original Java Metrics library (as long as its an open source, permisive license). This port is also inspired and contains some code from Daniel Crenna's port.

The original metrics project is released under this therms (https://github.com/dropwizard/metrics): Copyright (c) 2010-2013 Coda Hale, Yammer.com Published under Apache Software License 2.0, see LICENSE

This library ( Metrics.NET ) is release under Apache 2.0 License ( see LICENSE ) Copyright (c) 2014 Iulian Margarintescu

metrics.net's People

Contributors

alhardy avatar etishor avatar kucheruk avatar nkot avatar paulparau avatar robertaves avatar solmetricchris avatar tedoc2000 avatar vchekan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metrics.net's Issues

MetricsContext does not return metric reference for Gauges or PerfCounters

The methods to create a gauge or performance counter metric don't return a reference to the metric that was just created, unlike all the other methods to create a metric. Is this a bug, or is this intentional?

Also, it doesn't look like there's any way to dispose the performance counter instance that's created by the PerformanceCounterGauge, which doesn't implement IDisposable. Would it make sense to expose the perf counter reference as a property on the gauge? I could then dispose it manually when I'm done using it. This would additionally be useful to me because I want to access some of the performance counter's properties, specifically, its name, category, instance name, help text, and counter type. Also, shouldn't PerformanceCounterGauge derive from GaugeImplementation?

Another unrelated thing I noticed, it seems like DerivedGauge is essentially identical to ScaledValueProvider with T : double. Is that the only difference, or am I misunderstanding something?

Thanks!

InfluxDB

I've been playing with the latest InfluxDB, the api has change significantly breaking the current metrics.net influxdb reporter. I'm going to start updating this but before I do how do you foresee managing multiple versions? Do we just have a MetricsReport extensions for each version or maybe separate reporters out to their own assembly?

RatioGauge and HitRatio "Gauge" ?

As we are moving from Windows Performance Counters to using Metrics.Net the first thing I noticed was that there is currently no "first class" support for a ratio gauge. I noticed in the java project there is an abstract RatioGauge but I don't see any implementations of it.

I took a shot in our fork and ported the abstract RatioGauge pretty easily. However I'd still like to provide better support for easily tracking Hit Ratio (or other type of success vs. total ratio). We are already using a Timer for most of these scenarios, and my prototype implementation used a FunctionGauge to divide the OneMinuteRate values between a "Hit" Meter and the Timer's OneMinuteRate. I don't know if maybe there is a cleaner way to do this?

I also started encapsulating this into a "HitRatioGauge" but then realized it kinda goes beyond what the understood meaning of "Gauge" is, as it had methods to mark a hit and a miss. I also considered forcing the HitRatioGauge to have only external MeterValueSources passed in for the Hits and Misses. But there is also no uniform way to use either a Meter or a Timer for the MeterValue of the "totals". It also does not encapsulate things well because the user still has to mark the hit externally from the HitRatioGauge.

I find it hard to believe someone else hasn't already thought about this or had to deal with it. Any suggestions or ideas? I'd be glad to help contribute this back if we can come up with a desired approach.

FYI my first fully external "prototype" looks like this:

private readonly Timer _fetchTimer = Metric.Timer("Fetches", Unit.Calls);
private readonly Meter _hits = Metric.Meter("Hits", Unit.Calls);
...
var hitData = Metric.DataProvider.CurrentMetricsData.Meters.Single(g => g.Name == "Hits");
var fetchesData = Metric.DataProvider.CurrentMetricsData.Timers.Single(g => g.Name == "Fetches");
Metric.Advanced.Gauge("HitRatio", () => new FunctionGauge(() =>
{
    var hits = hitData.Value.OneMinuteRate;
    var total = fetchesData.Value.Rate.OneMinuteRate;
    if (Double.IsNaN(total) || Double.IsInfinity(total) || total == 0)
        return Double.NaN;
    return hits/total;
}), Unit.Percent);

Thoughts ? Comments?

MetricsContext changes caused metrics to be group under one label

After merging latest changes with fork, I noticed in the owin sample that request metrics are now not calculated per endpoint but they are grouped in under the one label.

This appears to have happened after the changes made around swapping out MetricsRegistry with MetricsContext. Could you direct me how to resolve this? Also how can MetricsContext be used to group metrics, do we have any documentation/tests on this?

Thanks.

Support VS 2010 / .NET 4.0

I'd like to use Metrics.NET in a large C# application server which hosts a suite of applications, the first problem I face is that this is all in VS 2010 / .NET 4.0. In a local checkout I was easily able to build a 4.0-compatible version with VS 2010 (there are only a few, if any, code changes necessary), would it be possible to include this as part of the builds? I can help maintaining the 2010 version.

Json Serialization

@etishor, How do you feel about taking a dependency on Json.NET or having an abstraction on json serialization internally?

I'm currently working on updating elasticsearch reporting, starting with counter metrics. Serializing dynamic objects is going to be much easier to work with than the custom serialization in the framework.

On the topic of elasticsearch, would you be happy to have an embedded resource for document mapping and creating the index upfront on creating a new es report? For example alhardy@5161ea7.

If you've already thought about the metrics document structure please share your thoughts, otherwise I'll continue and get you to review.

ability to reset metric data manually

The java metrics library lets you reset metrics manually (clearing all data collected). This is good for when we want to just have percentiles, averages, etc. be representative of a fix time interval (rather than a complete history since the start of the app or a weighted history for fuzzy amount of time).

Currently the ClearAllMetrics() call in base registry just removes all the registered metrics. It'd be good to have one that just clears out the collected data rather than the metrics themselves.

Invalid JSON if user has insufficient permissions for windows performance counters

Hi,
I'm using Metrics.NET in an environment where the user our services runs as has insufficient permission to access to all the performance counters that Metrics.NET exposes. The effect this has is that the JSON serializer serializes these values as NaN - which is invalid JSON and actually causes the built-in dashboard to complain with Error reading metric data from /json. Update stopped.

Example json output that is returned looks something like the following:

{
  "Timestamp": "2222-11-11T10:10:10.0000",
  "Gauges":{
    "[Machine] .NET Mb in all Heaps":NaN,
    "[Machine] .NET Time in GC":NaN,
    ...
    "[Application] Blah.Blah Uptime":123456.11,
    ...
  }
  ...
}

The exception thrown by metrics is UnauthorizedAccessException: Access to the registry key 'Global' is denied.

Thanks,

Pat

how to use requires authentication

any enables how to use requires authentication?

.WithMetricsModule(m => m.RequiresAuthentication(), "/admin/metrics")

nancy throws this error for me;

23:18:02 [Error] [HttpServer] [global] Web-server: "System.Collections.Generic.K
eyNotFoundException: The given key was not present in the dictionary.
   at Nancy.NancyEngineExtensions.HandleRequest(INancyEngine nancyEngine, Reques
t request, Func`2 preRequest)
   at Nancy.NancyEngineExtensions.HandleRequest(INancyEngine nancyEngine, Reques
t request)
   at Nancy.Hosting.Self.NancyHost.Process(HttpListenerContext ctx)"

Cannot find UseMetrics()

Referring to your documentation at https://github.com/etishor/Metrics.NET/wiki/OWIN-Metrics-Adapter - I cannot find the UseMetrics function that documentation is suggesting we use.

app.UseMetrics(metrics => metrics.WithReporting(r => r.WithConsoleReport(TimeSpan.FromSeconds(30))),
owinMetrics => owinMetrics.RegisterAllMetrics());

Can you please provide the namespace for this extension function? Also, the nuget command to install this package is missing a "-Pre" at the end.

Thanks.

OWIN Nuget package

The assembly in the latest OWIN package doesn't seem to match the code. There was a fix for the ping endpoint which hasn't been applied. Could you please increment the nuspec version and re-push?
Cheers.

Health check data in JSON feed

I just noticed that the health checks are not available in the JSON feed. Is there another feed for these that I don't know about? If not, would it be possible to add them to the JSON feed or expose them under a separate feed (e.g. http://localhost:1234/healthchecks/)?

We would like to set up Splunk to poll the JSON endpoint and it would be nice if we could pull the heath check data at the same time.

Thanks,

Evan

Move performance counters to the separate library

I try to use Metrics.Net in the Mono runtime under linux. It's worked, but almost all performance counters are seemed to be broken (Mono has implementation only for limited subset of them). Now I'm working on Metric-dependent library which contains set of extension methods to register mono-specific performance counters.

I think, it would be better to move existing registration of windows-specific performance counters to the separate assembly and Nuget package

How to monitor Process CPU usage

I am trying to figure out how to get performance a counter for CPU usage of my application. I noticed this line in PerformanceCounter.cs

context.Register("CPU Usage", Unit.Custom("%"), "Processor", 
 "% Processor Time", TotalInstance, tags: "cpu");

But it is for the whole OS. How can I get similar counter for my process? Thanks.

Filters for Reporters

I think it would be useful to be able to support filters on reporters so only certain metrics are sent specific reporters. I am thinking of the case where I may want to only a subset of metrics to be sent to a metered service like Application Insights. Application Insights or New Relic provide instrumentation agents that already collect performance counter data, request time etc. The filter should be specific to specific a reporter.

I am not sure the best approach for this feature, however, the filter should apply before formatting the name for the specific reporter. One approach could be (I do not like this suggestion):

        Metric.Config.WithReporting(r => r
            .WithApplicationInsights(TimeSpan.FromSeconds(30))
            .WithFilter(new MetricsReportFilter(/*args*/)));

It could be something passed to the constructor of the filter and passed as an optional parameter in the extension method,

        Metric.Config.WithReporting(r => r
            .WithApplicationInsights(TimeSpan.FromSeconds(30), new MetricsReportFilter(/*args*/)));

The only issue is there is a bit of mismatch from the perspective of the developer. When writing to metrics, they are dealing with Timer, Meter, etc and then in the reporter, it deals with the raw values and formatted metric name. Could also use Tags filter.

Edit: 2015-05-02 14:50 PST

Another use case I came up with is that I may want to register the same reporter, ie Application Insights or Graphite, and report different metrics at different intervals. I may want to report CPU and RAM Performance counters every 60 seconds, but record number of messages processed every 10 seconds. I would add multiple reporters, each with different filter criteria.

multiple registries possible?

can we use multiple registries and have metrics-nancy module to render them based on params?

A registry => /metrics/a
B registry => /metrics/b
global (default) registry = > /metrics

How to include metrics from other projects

I am investigating using metrics.net for an API project, and any metrics I add into the API show on the dashboard as expected. However if I add metrics to any associated projects (e.g. a database call made in another project that is referenced and used by the API project), then the metrics are not displayed on the API dashboard. Is this by design, or am I missing any setup that would allow the API dashboard to show all metrics that are configured?

/health not working

Okay i think i've found a strange problem;

So if register my health-check like this and rely on string status /metrics/health seems to work fine

            HealthChecks.RegisterHealthCheck(string.Format("{0}-redis", _poolConfig.Coin.Name.ToLower()),
                () =>
                {
                    return "OK";
                });

this is okay too;

            HealthChecks.RegisterHealthCheck(string.Format("{0}-redis", _poolConfig.Coin.Name.ToLower()),
                () =>
                {
                     return HealthCheckResult.Healthy("healthy");
                });

but /metrics/health stops working if I return an unhealthy response

            HealthChecks.RegisterHealthCheck(string.Format("{0}-redis", _poolConfig.Coin.Name.ToLower()),
                () =>
                {
                     return IsConnected ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy("connection problem")
                });

error i get;

00:14:45 [Error] [HttpServer] [global] Web-server: "System.NullReferenceExceptio
n: Object reference not set to an instance of an object.
   at Nancy.NancyEngineExtensions.HandleRequest(INancyEngine nancyEngine, Reques
t request, Func`2 preRequest)
   at Nancy.NancyEngineExtensions.HandleRequest(INancyEngine nancyEngine, Reques
t request)
   at Nancy.Hosting.Self.NancyHost.Process(HttpListenerContext ctx)"

Yet again the strange thing is that /metrics frontend just works okay shows the unhealty status.

RequiresAuthentication in OWIN

I see that there is a method to require authentication if you are using Nancy. Is there similar functionality in OWIN?

Reading metrics data using pure c#

  1. How to get access to metrics data directly - using c# (to read and process data) instead reading it by human via web page ?
  2. How to get statistics (in c# mostly):
    a) how many counts per hour/ minute/ second (in various version of calculating - average, EWMA)
    b) how to get those statistics (counts is per hour/ minute/ second and total counts) for different contexts (users?)?

Total elapsed time in a timer

When I create a timer (Metric.Timer("Some value", Unit.Requests)), In the web GUI I get the option to see graphs for count, requests/s, last value, min/max, percentiles and active sessions. All of these are great to have, but I think it would also be very useful to have a graph for total time spent. Is that possible?

categorizing metrics in visualization frontend instead of having type menus

So we have menus there with types listed.

Is it possible to instead categorize them by assigning a metric a category when we initialize it.

I know that we can create a metric for given type T, but i have multiple instances of that type which i would like track seperately.

somewhat related to #10 as at first hand I though of handling them in different registries, but I don't know if different registries are possible.

Ability to stop a specific report

Is it possible to have a report associated with a registered remote so that on shutting down a metrics context the report is also stopped and disposed?

Graphite reporter

It would be nice to have a Graphite reporter / adapter like the Java metrics library does.
I know it's on your TODO in the home page, I'm just upgrading it to issue status.

Suggest that Clock by default use UTC times, e.g. in JSON serialized report

The JSON serialized metric registry reports a datetime Now which includes timezone offset etc. These times can be ambiguous. Suggest that the Clock class use UTC as the default. Also could add a getter to Clock that is UTCDateTime() or something like that as the counter to LocalDateTime property. BTW I do really appreciate the practice of passing in a Clock interface/abstract class everywhere when a date/time is needed. Makes testing easier.

Nancy Sample Working?

First of all this looks amazing!!!!! Nice work ๐Ÿ˜„

I tried to turn off/comment out all the test data I assume getting generated here https://github.com/etishor/Metrics.NET/blob/master/Samples/NancyFx.Sample/Program.cs

Then I manually made some requests to /test but the graphs don't seem to update, those titled SampleModule.TestRequest.Time

UPDATE : I think I see it working under the NancyFx.GET [/test] (count) graphs although not sure the Health Status timer in the top right corner of the dashboard works? I assume the graphs updates x amount of seconds based on the setting in the dropdown? I've set mine to Don't Update but the graphs still update when requests come in ๐Ÿ˜„

Support custom metrics

I'm currently evaluating means to write my own metric type. Namely I want to have a "string" histogram showing the distribution of different command types (strings) my application handles.

As far as I see the registry currently has the metric types hard-coded (counter, gauge, etc). Is it possible to extend these, probably leveraging the existing histogram infrastructure and coding a new StringHistogram?

Need a way to set root context name programmatically

It is usual practice for graphite collectors to have configurable prefix for example "staging.#{machine-name}.MyUserAuthenticationApp.Sql.RequestDurationSeconds". I have seen "Metrics.GlobalContextName" configuration parameter, and it is almost what I would like, but I do not want to set machine name in config file, because of possible chaos it can cause if config files will be copy-pasted around or machine change name, etc.

What I would like to have is to be able programmatically set the root context name where I would be able to append machine name. Or, another option is to have "magic param", where "$env.machine-name$" in config would be replaced with actual name.

If given directions, I can implement it and submit pull request.

Configure interval

I would like to configure interval through a config value, like

<appSettings>
    <add key="Metrics.CSV.Interval.Seconds" value="10"/>
</appSettings>

However, I am still required to pass the same value to the API call if I use csv

Metric.Config
 .WithErrorHandler(x => ErrorLog.Error(x))
 .WithReporting(cfg => cfg.WithCSVReports(OutDir, >>>> TimeSpan.FromSeconds(1) <<<<< ));  

No mater what I set in config, the code value will always dominate

Metrics.Nancy fails using private probing path

If I deploy the Metrics.Nancy assembly in a subfolder (eg /lib) and use a private probing path, the /Metrics/ endpoint fails to be registered.

For example, in the app.config, set the private probing path with:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="lib" />

and then deploying the Metrics.Nancy assembly into the lib folder, results in a 404 on the /Metrics/ endpoint. However, the main Metrics.Net assembly works fine when deployed into this /lib/ private probing location.

Metrics.Net failed start up caused ASP.Net application pools to turn into zombies.

Hey Iulian,

I ran into this error with one of our asp.net websites:

2015-03-04 21:10:55,969 [7] ERROR Metrics.MetricsConfig [(null)] - Metrics: error configuring HttpListener System.Net.HttpListenerException (0x80004005): Failed to listen on prefix 'http://+:1234/EmailGatewaySendGridEvents/' because it conflicts with an existing registration on the machine. at System.Net.HttpListener.AddAllPrefixes() at System.Net.HttpListener.Start() at Metrics.Visualization.MetricsHttpListener.Start() in c:\Users\eti\Work\Metrics.NET\Src\Metrics\Visualization\MetricsHttpListener.cs:line 51 at Metrics.MetricsConfig.WithHttpEndpoint(String httpUriPrefix) in c:\Users\eti\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 62 at Metrics.MetricsConfig.ConfigureHttpListener() in c:\Users\eti\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 203

It caused our application pool to go into a strange zombie state where the endpoint would throw 500 errors with this message in it, but not actually crash the application pool so that it could be restarted. Once we stopped and restarted the pool operation returned to normal and I am unable to replicate the issue.

I would appreciate if you could look into this.

Evan

owin adapter

We've been using the owin adapter in production for many of our services for some time, all looks well, do you mind us bumping the package to version 1?

Error Configuring HTTP Listener - Access is denied

I am trying to configure the metrics visualizer to use the following endpoint on one of our servers:

http://localhost:1234/

When I reached out to that server by name 'http://servernameremoved:1234' I was greeted by a 400 error.

I then added an ACL entry using:

netsh http add urlacl url=http://+:1234/ user="NETWORK SERVICE"

This resulted in me now getting error 503. The service is unavailable.

When I tried to restart my NT service it wouldn't start anymore with the following error in the log:

2014-10-07 17:22:50,674 [5] ERROR Metrics.MetricsConfig [(null)] - Metrics: error configuring HttpListener
System.Net.HttpListenerException (0x80004005): Access is denied
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at Metrics.Visualization.MetricsHttpListener.Start() in c:\Users\eti\Work\Metrics.NET\Src\Metrics\Visualization\MetricsHttpListener.cs:line 30
at Metrics.MetricsConfig.WithHttpEndpoint(String httpUriPrefix) in c:\Users\eti\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 60
at Metrics.MetricsConfig.ConfigureHttpListener() in c:\Users\eti\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 196

What am I doing wrong?

can not load counter data

Getting this error;

17:19:49 [Error] [MetricsManager] [global] Metrics error: "Cannot load Counter N
ame data because an invalid index '' was read from the registry."

usage;

            _config = configManager.WebServerConfig.Backend;

            if (!_config.MetricsEnabled)
                return;

            _logger = Log.ForContext<MetricsManager>();

            Metric.Config
                .WithReporting(c => c
                    .WithTextFileReport(string.Format("{0}/logs/metrics/report.log", FileHelpers.AssemblyRoot),TimeSpan.FromSeconds(5))
                    .WithCSVReports(string.Format(@"{0}/logs/metrics/csv", FileHelpers.AssemblyRoot),TimeSpan.FromSeconds(5)))
                .WithErrorHandler(exception => _logger.Error("Metrics error: {0}", exception.Message));

            if (PlatformManager.Framework == Frameworks.DotNet)
                Metric.Config.WithAllCounters(); // there is a still unresolved bug with mono borking with system.security.claimsidentity.

platform: windows 8 & .net 4.5

Metrics is sometimes causing exceptions during service restarts.

Dear Iulian,

I'm having an issue where Metrics.Net isn't releasing it's hold on the web listening prefix when I restart my windows service. Is there something I can do during my disposal that will prevent this from happening? This is causing problems with our automated deployments so we need to retry each deployment twice.

Here is the exception that the new instance throws during startup:

2014-11-25 14:04:02,806 [5] ERROR Metrics.MetricsConfig [(null)] - Metrics: error configuring HttpListener System.Net.HttpListenerException (0x80004005): Failed to listen on prefix 'http://+:1234/MyProjectName/' because it conflicts with an existing registration on the machine. at System.Net.HttpListener.AddAllPrefixes() at System.Net.HttpListener.Start() at Metrics.Visualization.MetricsHttpListener.Start() in c:\Work\Metrics.NET\Src\Metrics\Visualization\MetricsHttpListener.cs:line 51 at Metrics.MetricsConfig.WithHttpEndpoint(String httpUriPrefix) in c:\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 60 at Metrics.MetricsConfig.ConfigureHttpListener() in c:\Work\Metrics.NET\Src\Metrics\MetricsConfig.cs:line 202

Regards,

Evan

old vs new JSON format

Would be nice to have the health and json (metrics) endpoints versioned i.e. /v1/health and /v1/json

JSON values are formatted according to user's regional settings

We encountered a problem when using Metrics.NET on a German Windows Server. The user's locale is German and thus floating-point numbers are formatted as 12,34 (German) as opposed to 12.34 (invariant). This essentially breaks the visualization app as the JSON now contains values that cannot be parsed:

".NET Mb in all Heaps":413,02,
".NET Time in GC":0,14,
etc.

Production ready

Hi,

Was wondering when you believe Metrics.NET will be production ready? We're eager to start using this on our project.

Rob

Enable/Disable Metrics from config file

Hi @etishor

Right now Metrics.Config.CompletelyDisableMetrics disables metrics and it seems that once it is disabled there is no way to enable it by the public API.

A new feature might be to watch on some configuration file setting (like "MetricsEnabled" = true/false) and if this change - disable/enable metrics accordingly. This can be useful then running Metrics.Net in production.

Perhaps Metrics can be shipped with it's own Metrics.dll.config file and monitor it by using FileSystemWatcher?

Do you have some suggestions/ideas on this?

ElasticSearch Support

This issue is for tracking status and ideas related to ElasticSearch ecosystem.

The first bits for elasticsearch integration are available on dev & master branches and are also pushed to latest nuget v0.2.13.

Most of the code is in the ElasticSearchReport.cs. Turns out reporting metrics to ES is very straight forward.

At the moment only gauges, counters and meters are reported but Histograms & Timers should be trivial to add (hopefully today).

Missing method get_Name in assembly Metrics.dll, type System.Security.Claims.ClaimsIdentity

I'm trying to use metrics.net with mono but getting;

Missing method get_Name in assembly /home/bonesoul/Desktop/CoiniumServ/bin/Debug/Metrics.dll, type System.Security.Claims.ClaimsIdentity

Unhandled Exception:
System.TypeLoadException: Could not load type 'System.Security.Claims.ClaimsIdentity' from assembly 'Metrics'.
  at Metrics.PerfCounters.PerformanceCounterGauge..ctor (System.String category, System.String counter) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.<RegisterSystemCounters>b__0 () [0x00000] in <filename unknown>:0 
  at Metrics.Core.LocalRegistry.CreateGauge[GaugeMetric] (System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+<>c__DisplayClass4`1[Metrics.Core.GaugeMetric].<Gauge>b__3 () [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+MetricMetaCatalog`3+<>c__DisplayClass17[Metrics.Gauge,Metrics.GaugeValueSource,System.Double].<GetOrAdd>b__16 (System.String n) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2+<GetOrAdd>c__AnonStorey3[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]].<>m__0 () [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) System.Func`1<System.Collections.Generic.KeyValuePair`2<string, Metrics.Core.BaseRegistry/MetricMetaCatalog`3/MetricMeta<Metrics.Gauge, Metrics.GaugeValueSource, double>>>:invoke_TResult__this__ ()
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].ListInsert (System.Collections.Concurrent.Node newNode, System.Collections.Concurrent.Node startPoint, System.Collections.Concurrent.Node& current, System.Func`1 dataCreator) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].InsertInternal (UInt32 key, System.String subKey, KeyValuePair`2 data, System.Func`1 dataCreator, System.Collections.Concurrent.Node& current) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].InsertOrGet (UInt32 key, System.String subKey, KeyValuePair`2 data, System.Func`1 dataCreator) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]].GetOrAdd (System.String key, System.Func`2 valueFactory) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+MetricMetaCatalog`3[Metrics.Gauge,Metrics.GaugeValueSource,System.Double].GetOrAdd (System.String name, System.Func`1 metricProvider) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry.Gauge[GaugeMetric] (System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.Register (MetricsRegistry registry, System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.RegisterSystemCounters (MetricsRegistry registry) [0x00000] in <filename unknown>:0 
  at Metrics.PerformanceCountersConfigExtensions.WithSystemCounters (Metrics.MetricsConfig config) [0x00000] in <filename unknown>:0 
  at Metrics.PerformanceCountersConfigExtensions.WithAllCounters (Metrics.MetricsConfig config) [0x00000] in <filename unknown>:0 
  at CoiniumServ.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Security.Claims.ClaimsIdentity' from assembly 'Metrics'.
  at Metrics.PerfCounters.PerformanceCounterGauge..ctor (System.String category, System.String counter) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.<RegisterSystemCounters>b__0 () [0x00000] in <filename unknown>:0 
  at Metrics.Core.LocalRegistry.CreateGauge[GaugeMetric] (System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+<>c__DisplayClass4`1[Metrics.Core.GaugeMetric].<Gauge>b__3 () [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+MetricMetaCatalog`3+<>c__DisplayClass17[Metrics.Gauge,Metrics.GaugeValueSource,System.Double].<GetOrAdd>b__16 (System.String n) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2+<GetOrAdd>c__AnonStorey3[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]].<>m__0 () [0x00000] in <filename unknown>:0 
  at (wrapper delegate-invoke) System.Func`1<System.Collections.Generic.KeyValuePair`2<string, Metrics.Core.BaseRegistry/MetricMetaCatalog`3/MetricMeta<Metrics.Gauge, Metrics.GaugeValueSource, double>>>:invoke_TResult__this__ ()
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].ListInsert (System.Collections.Concurrent.Node newNode, System.Collections.Concurrent.Node startPoint, System.Collections.Concurrent.Node& current, System.Func`1 dataCreator) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].InsertInternal (UInt32 key, System.String subKey, KeyValuePair`2 data, System.Func`1 dataCreator, System.Collections.Concurrent.Node& current) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.SplitOrderedList`2[System.String,System.Collections.Generic.KeyValuePair`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]]].InsertOrGet (UInt32 key, System.String subKey, KeyValuePair`2 data, System.Func`1 dataCreator) [0x00000] in <filename unknown>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[System.String,Metrics.Core.BaseRegistry+MetricMetaCatalog`3+MetricMeta[Metrics.Gauge,Metrics.GaugeValueSource,System.Double]].GetOrAdd (System.String key, System.Func`2 valueFactory) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry+MetricMetaCatalog`3[Metrics.Gauge,Metrics.GaugeValueSource,System.Double].GetOrAdd (System.String name, System.Func`1 metricProvider) [0x00000] in <filename unknown>:0 
  at Metrics.Core.BaseRegistry.Gauge[GaugeMetric] (System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.Register (MetricsRegistry registry, System.String name, System.Func`1 gauge, Metrics.Unit unit) [0x00000] in <filename unknown>:0 
  at Metrics.PerfCounters.PerformanceCounters.RegisterSystemCounters (MetricsRegistry registry) [0x00000] in <filename unknown>:0 
  at Metrics.PerformanceCountersConfigExtensions.WithSystemCounters (Metrics.MetricsConfig config) [0x00000] in <filename unknown>:0 
  at Metrics.PerformanceCountersConfigExtensions.WithAllCounters (Metrics.MetricsConfig config) [0x00000] in <filename unknown>:0 
  at CoiniumServ.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

any ideas?

CompetelyDisableMetrics is broken

I cannot disable metrics and suspect its a bug. Steps to reproduce:

  1. Set Metrics.Central as a startup project
  2. Insert <add key="Metrics.CompetelyDisableMetrics" value="true"/> into config file
  3. Run in Visual Studio

Code throws a NRE at line 251 of MetricsConfig.cs

private static bool ConfigureMetricsEnabledDisabled()
{
    try
    {
        var isDisabled = ConfigurationManager.AppSettings["Metrics.CompetelyDisableMetrics"];
        if (!string.IsNullOrEmpty(isDisabled) && isDisabled.ToUpperInvariant() == "TRUE")
        {
>>>>        Metric.Advanced.CompletelyDisableMetrics(); // <<<<< HERE Advanced is null
            log.Info(() => "Metrics: [...]");
            return true;
        }
        return false;
    }
    catch (Exception x)
    {
        log.ErrorException("Metrics: Error disabling metrics library", x);
        throw new InvalidOperationException("Invalid Metrics[...]", x);
    }
}

Disable Metrics at runtime

I realize there was an issue created concerning disabling metrics (#5) and it was closed. This is a feature I think would be very useful, as often we only want to metrics when something is amiss; so if it could be turned on and off at runtime that would be very useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.