Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply externalLabels after reserved labels in prometheus #5888

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

slashpai
Copy link
Contributor

@slashpai slashpai commented Sep 5, 2023

Description

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

API document says following about externalLabels field:

// The labels to add to any time series or alerts when communicating with
// external systems (federation, remote storage, Alertmanager).
// Labels defined by `spec.replicaExternalLabelName` and
// `spec.prometheusExternalLabelName` take precedence over this list.

But in code externalLabels were applied after reserved labels.
This commit is to fix that.

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

fix:  apply externalLabels after reserved labels in prometheus

@slashpai slashpai requested a review from a team as a code owner September 5, 2023 06:42
Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to have unit tests (or even e2e test maybe).

API document says following about externalLabels field:
// The labels to add to any time series or alerts when communicating with
// external systems (federation, remote storage, Alertmanager).
// Labels defined by `spec.replicaExternalLabelName` and
// `spec.prometheusExternalLabelName` take precedence over this list.

But in code externalLabels were applied after reserved labels.
This commit is to fix that.

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
@slashpai
Copy link
Contributor Author

slashpai commented Sep 6, 2023

@simonpasquier updated with changes and unit test

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@simonpasquier simonpasquier merged commit 959f829 into prometheus-operator:main Sep 6, 2023
17 checks passed
@slashpai slashpai deleted the externalLabelfix branch September 9, 2023 04:58
@sherifkayad
Copy link

sherifkayad commented Sep 12, 2023

@simonpasquier @slashpai I have currently the following error in the latest version of the Operator and I believe it's related to this MR:
level=warn ts=2023-09-12T12:30:13.674112327Z caller=promcfg.go:418 component=prometheusoperator msg=\"ignoring external label because it is a reserved key\" key=cluster version=v2.45.0.

I created the issue #5908

@slashpai
Copy link
Contributor Author

@simonpasquier @slashpai I have currently the following error in the latest version of the Operator and I believe it's related to this MR: level=warn ts=2023-09-12T12:30:13.674112327Z caller=promcfg.go:418 component=prometheusoperator msg=\"ignoring external label because it is a reserved key\" key=cluster version=v2.45.0.

I created the issue #5908

commented on issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants