YAML File - Default Labels
The YAML file used by this client is divided into several sections, each serving a distinct purpose:
globalVariables | Defines global variables that can be used throughout the YAML file. |
defaultLabels | Sets default labels to be applied to all metrics. |
metricObjects | Defines the metrics to be exposed to Prometheus, including their types and specific labels. |
metricData | Specifies the data points to be collected, along with any processing functions to be applied. |
Overview
Default labels are a set of key-value pairs that are automatically attached to every metric in the Prometheus Client. They provide a convenient way to include common information across all metrics.
Configuration
- Defined under `defaultLabels` in the YAML file.
- Applied globally to all metrics for consistent tagging.
Purpose
- To ensure every metric includes essential information like environment details, version numbers, or system identifiers.
- Simplifies metric queries and aggregation in Prometheus by having common labels.
Example
In this example, every metric reported by the Prometheus Client will include `environment` and `appVersion` labels.
```
defaultLabels:
environment: "production"
appVersion: "1.0.0"
```
Note: In the Prometheus Client configuration, default labels can dynamically reflect WinCC OA's real-time state. This functionality is enabled
through YAML Commands or the `${}` notation, which allows for the integration of WinCC OA functions directly into label definitions.