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

Add option to VMAgent to disable external label "vmagent" #1253

Open
xiaozongyang opened this issue Feb 27, 2025 · 2 comments
Open

Add option to VMAgent to disable external label "vmagent" #1253

xiaozongyang opened this issue Feb 27, 2025 · 2 comments
Labels
question Further information is requested

Comments

@xiaozongyang
Copy link

xiaozongyang commented Feb 27, 2025

Background

We deployed two groups of VMAgent which scrape completely same targets and send samples to two different vmstorage clusters for HA purpose. And there is a vmselect cluster querying these two vmstorage clusters simultaneously.

Suppose the two VMAgents are named vmagent-0 and vmagent-1 in same namespace vm. The raw sample from original target foo will be foo{vmagent="vm/vmagent-0"} in vmstorage cluster 0 and foo{vmagent="vm/vmagent-1"} in vmstorage cluster 1. When I search vmselect with query foo I got those two timeseries which caused duplicate data.

The motivation of this issue is to make the VMagent operator don't add external label vmagent so that I can make the samples in two vmstorage clusters are completely same. These two vmstorage clusters are completely equivalent.

Changes

  1. Add new field enableVmagentExternalLabel to VMAgentSpec, its default values is true
    2 when the field is set to false the opeator don't add the external label vmagent
@xiaozongyang
Copy link
Author

ping @f41gh7

Could you please help evaluate this requirement? I would be very happy to participate in the development of this feature.

@Haleygo
Copy link
Contributor

Haleygo commented Feb 27, 2025

As I know, we don't add external label vmagent: xx by default, but prometheus: ns/vmagentName.

// Use "prometheus" external label name by default if field is missing.
// in case of migration from prometheus to vmagent, it helps to have same labels
// Do not add external label if field is set to empty string.
prometheusExternalLabelName := "prometheus"
if p.Spec.VMAgentExternalLabelName != nil {
if *p.Spec.VMAgentExternalLabelName != "" {
prometheusExternalLabelName = *p.Spec.VMAgentExternalLabelName
} else {
prometheusExternalLabelName = ""
}
}

Have you specified vmAgentExternalLabelName: vmagent?

It can be disable by:

spec:
  vmAgentExternalLabelName: ""

@Haleygo Haleygo added the question Further information is requested label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants