All Projects → djluck → Prometheus Net.dotnetruntime

djluck / Prometheus Net.dotnetruntime

Licence: mit
Exposes .NET core runtime metrics (GC, JIT, lock contention, thread pool) using the prometheus-net package

Projects that are alternatives of or similar to Prometheus Net.dotnetruntime

Javamelody
JavaMelody : monitoring of JavaEE applications
Stars: ✭ 2,486 (+1061.68%)
Mutual labels:  monitoring, metrics
Collector
pganalyze statistics collector for gathering PostgreSQL metrics and log data
Stars: ✭ 181 (-15.42%)
Mutual labels:  monitoring, metrics
Hastic Grafana App
Hastic data management server for labeling patterns and anomalies in Grafana
Stars: ✭ 166 (-22.43%)
Mutual labels:  monitoring, metrics
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+828.04%)
Mutual labels:  monitoring, metrics
Icingaweb2 Module Grafana
Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
Stars: ✭ 190 (-11.21%)
Mutual labels:  monitoring, metrics
Skydive
An open source real-time network topology and protocols analyzer
Stars: ✭ 2,086 (+874.77%)
Mutual labels:  monitoring, metrics
Ostent
Ostent is a server tool to collect, display and report system metrics.
Stars: ✭ 171 (-20.09%)
Mutual labels:  monitoring, metrics
Scouter
Scouter is an open source APM (Application Performance Management) tool.
Stars: ✭ 1,792 (+737.38%)
Mutual labels:  monitoring, metrics
Bigquery Grafana
Google BigQuery Datasource Plugin for Grafana.
Stars: ✭ 188 (-12.15%)
Mutual labels:  monitoring, metrics
Tobs
tobs - The Observability Stack for Kubernetes. Easy install of a full observability stack into a k8s cluster with a CLI tool or Helm charts.
Stars: ✭ 186 (-13.08%)
Mutual labels:  monitoring, metrics
Swiftmetrics
Swift Application Metrics instruments the Swift runtime for performance monitoring, providing the monitoring data programatically via an API or visually with an Eclipse Client.
Stars: ✭ 145 (-32.24%)
Mutual labels:  monitoring, metrics
Sematext Agent Docker
Sematext Docker Agent - host + container metrics, logs & event collector
Stars: ✭ 194 (-9.35%)
Mutual labels:  monitoring, metrics
Telemetry metrics
Collect and aggregate Telemetry events over time
Stars: ✭ 144 (-32.71%)
Mutual labels:  monitoring, metrics
Github Monitoring
Monitor your GitHub Repos with Docker & Prometheus
Stars: ✭ 163 (-23.83%)
Mutual labels:  monitoring, metrics
Prom Client
Prometheus client for node.js
Stars: ✭ 2,062 (+863.55%)
Mutual labels:  monitoring, metrics
Opencensus Web
A stats collection and distributed tracing framework
Stars: ✭ 168 (-21.5%)
Mutual labels:  monitoring, metrics
Stagemonitor
an open source solution to application performance monitoring for java server applications
Stars: ✭ 1,664 (+677.57%)
Mutual labels:  monitoring, metrics
Lindb
LinDB is a scalable, high performance, high availability distributed time series database.
Stars: ✭ 2,105 (+883.64%)
Mutual labels:  monitoring, metrics
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+965.89%)
Mutual labels:  monitoring, metrics
Sdk
Library for using Grafana' structures in Go programs and client for Grafana REST API.
Stars: ✭ 193 (-9.81%)
Mutual labels:  monitoring, metrics

prometheus-net.DotNetMetrics

A plugin for the prometheus-net package, exposing .NET core runtime metrics including:

  • Garbage collection collection frequencies and timings by generation/ type, pause timings and GC CPU consumption ratio
  • Heap size by generation
  • Bytes allocated by small/ large object heap
  • JIT compilations and JIT CPU consumption ratio
  • Thread pool size, scheduling delays and reasons for growing/ shrinking
  • Lock contention
  • Exceptions thrown, broken down by type

These metrics are essential for understanding the peformance of any non-trivial application. Even if your application is well instrumented, you're only getting half the story- what the runtime is doing completes the picture.

Installation

Supports .NET core v2.2+ but .NET core v3.0+ is recommended. There are a number of bugs present in the .NET core 2.2 runtime that can impact metric collection or runtime stability.

Add the packge from nuget:

# If you're using v3.* of prometheus-net
dotnet add package prometheus-net.DotNetRuntime

# If you're using v2.* of prometheus-net
dotnet add package prometheus-net.DotNetRuntime --version 2.2.0

And then start the collector:

IDisposable collector = DotNetRuntimeStatsBuilder.Default().StartCollecting()

You can customize the types of .NET metrics collected via the Customize method:

IDisposable collector = DotNetRuntimeStatsBuilder
	.Customize()
	.WithContentionStats()
	.WithJitStats()
	.WithThreadPoolSchedulingStats()
	.WithThreadPoolStats()
	.WithGcStats()
	.WithExceptionStats()
	.StartCollecting();

Once the collector is registered, you should see metrics prefixed with dotnet_ visible in your metric output (make sure you are exporting your metrics).

Sample Grafana dashboard

The metrics exposed can drive a rich dashboard, giving you a graphical insight into the performance of your application ( exported dashboard available here):

Grafana dashboard sample

Performance impact

The harder you work the .NET core runtime, the more events it generates. Event generation and processing costs can stack up, especially around these types of events:

  • JIT stats: each method compiled by the JIT compiler emits two events. Most JIT compilation is performed at startup and depending on the size of your application, this could impact your startup performance.
  • GC stats: every 100KB of allocations, an event is emitted. If you are consistently allocating memory at a rate > 1GB/sec, you might like to disable GC stats.
  • .NET thread pool scheduling stats: For every work item scheduled on the thread pool, two events are emitted. If you are scheduling thousands of items per second on the thread pool, you might like to disable scheduling events or decrease the sampling rate of these events.

Sampling

To counteract some of the performance impacts of measuring .NET core runtime events, sampling can be configured on supported collectors:

IDisposable collector = DotNetRuntimeStatsBuilder.Customize()
	// Only 1 in 10 contention events will be sampled 
	.WithContentionStats(sampleRate: SampleEvery.TenEvents)
	// Only 1 in 100 JIT events will be sampled
	.WithJitStats(sampleRate: SampleEvery.HundredEvents)
	// Every event will be sampled (disables sampling)
	.WithThreadPoolSchedulingStats(sampleRate: SampleEvery.OneEvent)
	.StartCollecting();

The default sample rates are listed below:

Event collector Default sample rate
ThreadPoolSchedulingStats SampleEvery.TenEvents
JitStats SampleEvery.TenEvents
ContentionStats SampleEvery.TwoEvents

While the default sampling rates provide a decent balance between accuracy and resource consumption if you're concerned with the accuracy of metrics at all costs, then feel free to change the sampling rate to SampleEvery.OneEvent. If minimal resource consumption (especially memory), is your goal you might like to reduce the sampling rate.

Further reading

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].