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

Bug: Removed targets remain as prometheus metrics #77

Closed
1 task done
niklastreml opened this issue Jan 19, 2024 · 1 comment · Fixed by #180
Closed
1 task done

Bug: Removed targets remain as prometheus metrics #77

niklastreml opened this issue Jan 19, 2024 · 1 comment · Fixed by #180
Assignees
Labels
area/checks Issues/PRs related to Checks bug Something isn't working evaluation This issue or pull request evaluates something

Comments

@niklastreml
Copy link
Contributor

niklastreml commented Jan 19, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Sparrow starts with two targets:

https://google.com
https://example.com

this creates two prometheus for those targets:

sparrow_latency_duration_seconds{status="200",target="https://google.com"} 0.014013145
sparrow_latency_duration_seconds{status="200",target="https://example.com"} 0.003617327
...

If the config gets updated and one target gets removed, the last prometheus metric for the deleted target remains as the latest prometheus metrics.
New targets:

https://google.com

Prometheus metrics:

sparrow_latency_duration_seconds{status="200",target="https://google.com"} 0.014013145 <- This remains and is not cleaned up
sparrow_latency_duration_seconds{status="200",target="https://example.com"} 0.007915321

Expected Behavior

Lets discuss how (if) we should handle this case.

Maybe it's possible to remove metrics from the prometheus registry

Steps To Reproduce

  1. Deploy sparrow with two targets for any check using http loader
  2. Let it run for a check cycle
  3. Remove one target from the config
  4. HTTP GET /metrics

Relevant logs and/or screenshots, environment information, etc.

Screenshot shows what happened after google.com was removed from the config, compared to a target that is currently active

image

Since the sparrow metrics api still exposes the value for google.com, prometheus stores it on every scrape

Who can address the issue?

@puffitos @y-eight @lvlcn-t Let's discuss how we handle this next week

Anything else?

No response

@niklastreml niklastreml added bug Something isn't working evaluation This issue or pull request evaluates something labels Jan 19, 2024
@lvlcn-t
Copy link
Member

lvlcn-t commented Feb 16, 2024

This can be done by a simple (*MetricVec).Delete in the SetConfig method of each check.

@lvlcn-t lvlcn-t added the area/checks Issues/PRs related to Checks label Feb 16, 2024
@puffitos puffitos self-assigned this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/checks Issues/PRs related to Checks bug Something isn't working evaluation This issue or pull request evaluates something
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants