Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jetelain
Copy link

Adds Info Metric:
https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md#info

Info metrics are used to expose textual information which SHOULD NOT change during process lifetime. Common examples are an application's version, revision control commit, and the version of a compiler.
A MetricPoint of an Info Metric contains a LabelSet. An Info MetricPoint's LabelSet MUST NOT have a label name which is the same as the name of a label of the LabelSet of its Metric.
Info MAY be used to encode ENUMs whose values do not change over time, such as the type of a network interface.
MetricFamilies of type Info MUST have an empty Unit string.

According to Java library:

Info metrics are used to expose textual information which should not change during process lifetime. The value of an Info metric is always 1.

Usage:

Metrics
  .CreateInfo("application_info", "Application Version", new[] { "version", "commit" })
  .WithLabels("1.2.3", "60e9106a83ff1274fec0022c37366f04822b1d1b");

Also adds a default Info Metric for dotnet runtime informations:

# HELP dotnet_info .NET runtime
# TYPE dotnet_info info
dotnet_info{version="6.0.36",framework=".NET 6.0.36",runtime="win10-x64"} 1

Can be disabled with Metrics.SuppressDefaultMetrics(new SuppressDefaultMetricOptions() { SuppressRuntimeInfoMetrics = true } );.

@jetelain jetelain changed the title feat:Info metric feat: Info metric Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant