prometheus-net

.NET library to instrument your code with Prometheus metrics

MIT License

Stars
1.9K
Committers
61

Bot releases are visible (Hide)

prometheus-net - 8.2.1 - bugfix for occasional exception on metrics scrape Latest Release

Published by sandersaares 10 months ago

Fix occasional "Collection was modified" exception when serializing metrics. #464

prometheus-net - v8.2.0 - performance improvements

Published by sandersaares 11 months ago

  • .WithLabels() & similar now accept ReadOnlyMemory as alternative to string[]. Same behavior, just easier to use if you already have a ReadOnlyMemory.
  • .WithLabels() & similar now accept ReadOnlySpan as alternative to string[]. This enables allocation-free metric instance creation if a metric instance with these labels is already known.
  • Incorporated various optimizations to reduce the required CPU time and allocated memory, including #410, #443 and other contributions.
  • Observation of large histograms is now 10-30% faster on machines that support AVX2 instructions.
  • health checks exposed via ForwardToPrometheus() no longer create a default metric if a custom metric is provided #444
prometheus-net - v8.1.1 - fix incorrect UpDownCounter handling in .NET Meters API adapter

Published by sandersaares 11 months ago

  • Fix bug in .NET Meters API adapter for UpDownCounter, which was incorrectly transformed to Prometheus metrics. #452 and #453
prometheus-net - v8.1.0 - Add support for capturing HttpClient metrics from all registered HttpClients

Published by sandersaares 12 months ago

Add support for capturing HttpClient metrics from all registered HttpClients (services.UseHttpClientMetrics()).

prometheus-net - v8.0.1 - Allow ObservableCounter<T> to be reset

Published by sandersaares over 1 year ago

Allow ObservableCounter to be reset. Previously, the MeterAdapter output got stuck on its previous maximum if the underlying Meter reset its value to a lower value. Now we transform the value 1:1.

prometheus-net - v8.0.0 - OpenMetrics, exemplars, performance optimizations and bugfixes

Published by sandersaares over 1 year ago

  • Added OpenMetrics exposition format support (#388).
  • Added exemplar support for Counter and Histogram (#388).
  • The ':' character is no longer allowed in metric or label names. For metric names, Prometheus standard practice is to use colon only in recording rules.
  • Publish symbol packages and add Source Link support for easier debugging experience.
  • Fix defect where metrics with different labels could overwrite each other in specific circumstances with multiple metric factories in use (#389).
  • Ensure even harder that MetricPusher flushes the final state before stopping (#383 and #384)
  • Simplify DotNetStats built-in collector code for ease of readability and more best practices (#365, #364)
  • Slightly improve Counter performance under concurrent load.
  • Reduce memory allocations performed during ASP.NET Core HTTP request tracking.
  • By default, EventCounterAdapter will only listen to a small predefined set of general-purpose useful event sources, to minimize resource consumption in the default configuration. A custom event source filter must now be provided to enable listening for additional event sources.
  • EventCounterAdapter will only refresh data every 10 seconds by default, to reduce amount of garbage generated in memory (.NET event counters are very noisy and create many temporary objects).
  • Added IManagedLifetimeMetricFactory.WithLabels() to enable simpler label enrichment in scenarios where lifetime-managed metric instances are used.
  • Added back .NET Standard 2.0 support as some customers had a hard dependency on .NET Standard 2.0 (despite not being a documented feature even earlier).
  • Added (Observable)UpDownCounter support to MeterAdapter (.NET 7 specific feature).
prometheus-net - v7.0.0

Published by sandersaares almost 2 years ago

  • .NET Core specific functionality now targeting .NET 6.0 or greater (all previous versions will be end of life by December 2022).
  • Relaxed the API restriction that forbade you to create multiple metrics with the same name but different label names. While this is a Prometheus anti-pattern, it is a standard pattern in other metrics technologies and we will allow it in the name of interoperability.
  • Added IMetricFactory.WithLabels() to define static labels per-factory and reduce the effort needed by users when defining static labels in specific scopes.
  • Added automatic metric expiration feature, to remove timeseries when they are no longer used after a while. This improves interoperability with other metrics technologies such as .NET Meters.
  • (Breaking change) Rewrite of the MeterAdapter functionality to bridge .NET 6 metrics to Prometheus. API remains equivalent, though options class changed. Output format (what metrics are published) is completely different. Now it translates metric names (instead of putting them in labels) and preserves tags (labels) provided via the .NET Meters API. Added sample project to demonstrate functionality. Ref #359
  • (Breaking change) Dropped support for .NET Standard 2.0 - now will target specifically .NET 6.0 and .NET Framework 4.6.2. This was already documented before but there was "unofficial" support also for .NET Standard remaining. This is now removed.
  • (Breaking change) EventCounterAdapter output format changed to translate counters to Prometheus metrics and to improve usability by publishing both counters and gauges from ambiguous event counters.
  • EventCounterAdapter and MeterAdapter are now enabled on startup by default.
  • Added some debug metrics to indicate the number of metric families, instances and timeseries being exported by prometheus-net.
  • Added typical benchmark results to readme for easy reference, and to show relative speed of the simple versus complex instruments.
  • (Breaking change) Removed MetricConfiguration.StaticLabels because it had negative performance impact on many code paths that did not use it. The same functionality can be manually implemented in user code. Static labels remain available on registry and factory level.
  • When a before-collection metrics update callback throws an exception, it is now logged and ignored instead of breaking all metrics collection.
  • EventCounterAdapter now defaults to Informational events only, for reduced performance overhead. Can be configured via callback.
prometheus-net - v6.0.0 - additional HTTP server metric labels + Meters API + EventCounters API + more

Published by sandersaares over 2 years ago

  • Dropped library support for unsupported .NET runtime versions (.NET 2.1).
  • If Razor Pages is enabled, the "page" label is now automatically added to the default HTTP server metrics, unless there is a user-defined label already present with this name.
  • The "endpoint" label is now automatically added to the default HTTP server metrics, containing this endpoint routing route pattern of the request, unless there is a user-defined label already present with this name.
  • Added integration with .NET EventCounters, which can now be easily exposed as Promtheus metrics (see EventCounterAdapter class).
  • Added integration with .NET Meters, which can now be easily exposed as Promtheus metrics (see MeterAdapter class).
  • Added ReplaceOnPush option to MetricPusher #305 #322.
  • Minimum .NET Framework version is now 4.6.2.
prometheus-net - Fix HttpClientMetrics leading to response stream instability under load

Published by sandersaares almost 3 years ago

Bugfix: HttpClientMetrics under concurrent load with long-running requests were leading to broken response streams. #336

prometheus-net - Bugfix for PowersOfTenDividedBuckets with >= 10 divisions

Published by sandersaares about 3 years ago

Bugfix: PowersOfTenDividedBuckets did not work with >= 10 divisions due to overlap. Now skips overlapping region of generated series.

prometheus-net - HTTP client metrics improvements

Published by sandersaares about 3 years ago

  • Added HTTP client metric that measures the response duration (time until response content reading is finished).
  • Added "client" label containing the name of HTTP client to HTTP client metrics.
  • Added "code" label with HTTP response code to HTTP client metrics. #299
  • HTTP client metrics now count responses when they are completed, not when started, to match with HTTP server metrics. Also renamed metric to httpclient_requests_sent_total since it said "received" previously (due to copy-paste error from HTTP server metrics).
  • HTTP client metrics are now published via the netstandard package, without requiring ASP.NET Core. #314
  • Added Counter.IncTo[Current]TimeUtc().
prometheus-net - Easier install on .NET 5, more accurate histogram buckets, bugfixes

Published by sandersaares over 3 years ago

  • Added Histogram.PowersOfTenDividedBuckets()
  • Improved accuracy of histogram bucket calculations to reduce the likelyhood of seeing 0.00000000000000000001 offsets from expected value due to floating point math.
  • Added ConfigureAwait(false) to MetricHandler to help avoid deadlocks in some rare scenarios. #308
  • Fix defect where MetricPusher terminated when HttpClient signaled timeout. #302, #293
  • No longer need to manually reference ASP.NET Core SDK in csproj file when installing prometheus-net.AspNetCore library. It gets automatically referenced now. #267
prometheus-net - Static labels feature, minor new features, optimizations, fixes

Published by sandersaares almost 4 years ago

4.1.1:

  • Bugfix: HTTP request metrics in 4.1.0 got broken due to typo in middleware helper.

4.1.0:

  • Fixed HttpClient metrics duration that was incorrectly measured. #265
  • prometheus-net.NetFramework.AspNet is now strong named, just like all the other assemblies. #273
  • NetFx target is now conditional for Windows builds only, to allow easier development work on nonwindows platforms. #264
  • MetricPusher now supports a callback for logging push errors. #186
  • Added support for defining static labels on registry or metric level. #256
  • Added ICollectorRegistry and IMetricFactory for mocking in test code. #268
  • Ignore /metrics URL by default in HTTP request metrics.
  • Fix overflow in Summary after observing more than uint.MaxValue events. #277
  • Reduce allocations in hot paths. #276, #275
  • Added request filtering (authorization) support to standalone MetricServer. #261
prometheus-net - HttpClientFactory integration + publishing arbitrary HTTP route parameters

Published by sandersaares about 4 years ago

  • Allow arbitrary ASP.NET Core route parameters to be exposed as HTTP metric labels. #225
  • Add HttpClient metrics with IHttpClientFactory integration.
  • Breaking change: some HTTP metrics implementation classes were changed from public to internal. They were never supposed to be public and hopefully nobody ever used them directly. Public documented API did not change.
prometheus-net - gRPC integration + ASP.NET Core Health Checks integration + optimizations & fixes

Published by sandersaares over 4 years ago

  • Added ASP.NET Core health check publisher for publishing metrics on health check status. #203 #209
  • Fixed hang in ASP.NET Web API exporter. #215
  • Fixed ASP.NET Web API exporter exporting metrics from the wrong registry. #217
  • Reduced memory use in MetricPusher implementation. Inspired by #208
  • Added basic gRPC service metrics support. #212
  • Reduce pointless log spam on cancelled scrapes - will silently ignore cancelled scrapes in the ASP.NET Core exporter. #220
prometheus-net - v3.5.0 - better dispose pattern support & ASP.NET Web API legacy support

Published by sandersaares over 4 years ago

  • Exposed metric.Unpublish() method since there was already a matching Publish() there.
  • When the scrape is aborted, stop collecting/serializing metrics. #189
  • Added simple metric export handler for legacy ASP.NET Web API, to avoid having to deal with HttpListener complexity.
prometheus-net - v3.4.0 - Bag of improvements and fixes

Published by sandersaares almost 5 years ago

  • Separate packaging for ASP.NET Core 3 to reduce package reference management complexity for users. #164
  • Lazy-initialize the default sample metrics to reduce initialization cost for those who do not need them. #170
  • ASP.NET Core middlware no longer disposes of output stream. #171
  • Fix DotNetStats occasional data tearing under parallel collections. #173
  • Improved wording of some error messages. #169
  • Added Counter.IncTo(), Gauge.IncTo(), Gauge.DecTo(). #181
  • Added Gauge.Set(DateTimeOffset) and Gauge.IncTo(DateTimeOffset). #181
  • Improve .NET Framework 4.6.1 packaging to include the ValueTuple reference automatically. #179
  • ASP.NET Core HTTP metrics now capture route data before it is overwritten by an exception handler. #177
  • ASP.NET Core HTTP "in progress" metrics now include controller/action labels (ASP.NET Core 3 only).
  • Fixed concurrently defect in HTTP metrics that may have caused label values from wrong request to apply. #182
  • The HttpListener based MetricServer can now handle more than one concurrent request.
  • Added asynchronous "before collect" callbacks, giving user code more flexibility in metric updates.
  • Added .Remove() to labeled metric instances for more convenient removal API (previously had to call method on parent instance).
  • Added .Unpublish() to labeled metric instances to support temporary unpublishing of a metric, without discarding collected data (e.g. histogram buckets), during periods of data unavailability.
prometheus-net - Add ability to filter requests by port number when exporting metrics.

Published by sandersaares about 5 years ago

#160

  • Enable custom HTTP client to be used in MetricPusher, allowing for Basic auth and more flexibility. #125
  • Add DiagnosticSourceAdapter (.NET Core only). #153
  • Improved compatibility with older .NET Framework versions. #155
prometheus-net - 3.1.4 - Fix Summary buffer flushing defect

Published by sandersaares over 5 years ago

Fix timezone mismatch in Summary that led to unintended delays in buffer flushing. #149

Package Rankings
Top 9.59% on Proxy.golang.org
Badges
Extracted from project README
Build status Nuget
Related Projects