OpenMetrics
StackState Self-hosted v5.1.x
Overview
StackState can be configured to retrieve metrics from an OpenMetrics endpoint and push these to StackState.
OpenMetrics is a StackState curated integration.
Setup
Installation
The OpenMetrics check is included in the Agent V2 StackPack.
Configuration
To enable the OpenMetrics integration and begin collecting metrics data from an OpenMetrics endpoint, the OpenMetrics check must be configured on StackState . The check configuration provides all details required for the Agent to connect to your OpenMetrics endpoint and retrieve the available metrics.
Deploy the Agent on your Kubernetes or OpenShift cluster.
Add the annotations below when launching a pod that exposes metrics via an OpenMetrics endpoint. Add the following:
<CONTAINER_NAME> - the name of the container that exposes the OpenMetrics. It's possible to process multiple endpoints in a single pod (that's why there is a list in the JSON).
prometheus_url - the path (often just
metrics
) and port at which the OpenMetrics endpoint is exposed.namespace - all metrics collected here will get this as a dot-separated prefix.
metrics - use
["*"]
to collect all available metrics. It's also possible to specify a list of metrics to be fetched. This should either be a string representing the metric name or a mapping to rename the metric<EXPOSED_METRIC>:<SENT_METRIC>
You can also add optional configuration and filters:
prometheus_metrics_prefix - prefix to add to exposed OpenMetrics metrics.
health_service_check - send a service check
<NAMESPACE>.prometheus.health
reporting the health of the OpenMetrics endpoint. Defaulttrue
.label_to_hostname - override the hostname with the value of one label.
label_joins - target a metric and retrieve it's label via a 1:1 mapping
labels_mapper - rename labels. Format is
<LABEL_TO_RENAME>: <NEW_LABEL_NAME>
.type_overrides - override a type in the OpenMetrics the payload or type an untyped metric (these would be ignored by default). Supported
<METRIC_TYPE>
aregauge
,count
andrate
. Format is<METRIC_NAME>: <METRIC_TYPE>
.tags - list of tags to attach to every metric, event and service check emitted by this integration.
send_histograms_buckets - send the histograms bucket. Default
true
.send_monotonic_counter - set to
true
to convert counters to a rate (note that two runs are required to produce the first result). Set tofalse
to send counters as a monotonic counter. Defaulttrue
.exclude_labels - list of labels to be excluded.
prometheus_timeout - set a timeout for the OpenMetrics query.
ssl_cert - If your OpenMetrics endpoint is secured, enter the path to the certificate and specify the private key in the
ssl_private_key
parameter, or give the path to a file containing both the certificate and the private key.ssl_private_key - required if the certificate linked in
ssl_cert
doesn't include the private key. Note that the private key to your local certificate must be unencrypted.ssl_ca_cert - the path to the trusted CA used for generating custom certificates.
extra_headers - a list of additional HTTP headers to send in queries to the OpenMetrics endpoint. Can be combined with autodiscovery template variables. For example,
"Authorization: Bearer %%env_TOKEN%%"
.
Wait for the Agent to collect data from the OpenMetrics endpoint and send it to StackState.
Validation
Follow the instructions on the Kubernetes Agent page to track the status of the OpenMetrics check
Data collected
Metrics
By default, all metrics are retrieved from the specified OpenMetrics endpoint and available in the StackState multi metrics data source. To optimize performance, a maximum of 2000 metrics will be retrieved. If the check is attempting to retrieve more than 2000 metrics, add a metrics
filter to the configuration to ensure that all important metrics can be retrieved within the limit.
Retrieved metrics won't automatically be mapped to topology elements. They can be browsed using the telemetry inspector or added to a component as a telemetry stream. Select the data source StackState Multi Metrics and type the configured namespace
in the Select box to get a full list of all available metrics.
![](https://docs.stackstate.com/~gitbook/image?url=https%3A%2F%2F2702698828-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ft9xRpVRApnyVQrX3f8HH%252Fuploads%252Fgit-blob-6acd6a86bd533d9a3b7c54dfb755fbd22192e510%252Fv51_openmetrics_stream.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ed4a2d4c&sv=1)
Events
The OpenMetrics integration doesn't retrieve any events data.
Traces
The OpenMetrics integration doesn't retrieve trace data.
See also
Last updated