Skip to content

feat: add external_labels config that does not overwrite metric labels#729

Open
FUSAKLA wants to merge 1 commit intojacksontj:masterfrom
FUSAKLA:fus-sound-dolphin
Open

feat: add external_labels config that does not overwrite metric labels#729
FUSAKLA wants to merge 1 commit intojacksontj:masterfrom
FUSAKLA:fus-sound-dolphin

Conversation

@FUSAKLA
Copy link
Copy Markdown

@FUSAKLA FUSAKLA commented Jul 25, 2025

Tries to address #727

the external_labels config name is probably not self-explanatory, maybe something like additional_labels ?

This is more of a POC

What it does:

  • adds the external_labels to responses ONLY if are not present already
  • It removes the selectors for these labels ONLY if it matches the value actually (cannot be left there, because most probably metrics don't have that label)
    Otherwise, it keeps the selector because it could match the label values of metrics where the value is possibly unknown by promxy

There is still at least one edge case...

Consider server group with external_labels: {"cluster": "cluster1"} and Prometheis in it, having metrics up{cluster="cluster2"} and up{cluster="cluster3"}.

Then if you run query up{cluster="cluster1"} you get a response matching both the metrics because the selector cluster="cluster1" got removed, and now it matches both the metrics :/
This is at least confusing 😖

WDYT?

Signed-off-by: Martin Chodur <martin.chodur@firma.seznam.cz>
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