-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[receiver/prometheusreceiver] Fix retrieval of aggregated metrics wit…
…h no job/instance label (#33565) **Description:** This PR fixes the retrieval of metrics where either the `job` or `instance` label is missing, and `honor_labels` is set to `true`. This can be the case for aggregated metrics coming from a federate endpoint. This PR introduces a fallback to using the `job`/`instance` labels from the scrape config for such metrics. **Link to tracking Issue:** Fixes #32555 **Testing:** - Added a Unit test - Verified using the following config: ``` receivers: prometheus: config: scrape_configs: - job_name: 'federate' scrape_interval: 10s honor_labels: true params: 'match[]': - '{__name__="cluster:node_cpu:sum_rate5m"}' metrics_path: '/federate' static_configs: - targets: - "localhost:9090" exporters: debug: verbosity: detailed otlphttp: endpoint: ${env:OTLP_ENDPOINT} pipelines: metrics: receivers: [otlp,prometheus] exporters: [otlphttp, debug] ``` This was tested on a `kind` K8s cluster running the prometheus operator, with a port forward for the `prometheus-k8s` service created by the prometheus operator (therefore the `localhost:9090` address in the target). --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: David Ashpole <[email protected]>
- Loading branch information
Showing
3 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: prometheusreceiver | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fall back to scrape config job/instance labels for aggregated metrics without instance/job labels | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [32555] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters