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

Prevent Duplicate Metrics #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Prevent Duplicate Metrics #8

wants to merge 2 commits into from

Conversation

lmoze
Copy link

@lmoze lmoze commented Oct 29, 2021

This pull request fixes an issue where exporter-go fails to export Prometheus metrics if the cluster opa-gatekeeper has exported duplicate violations, e.g. because of open-policy-agent/gatekeeper#481

Symptom: https://opa-gatekeeper:9141/metrics returns 500 Internal Server Error with a message like collected metric <metric-details> was collected before with the same name and label values

lmoze and others added 2 commits October 29, 2021 08:48
- In some situations, Gatekeeper exports duplicate records of violations
  e.g. open-policy-agent/gatekeeper#481
- If duplicates exist, the opa-gatekeeper previously would fail to serve metrics with a message like `collected metric <metric-details> was collected before with the same name and label values`
- Patch to ensure the set of metrics exported by opa-scorecard will never contain duplicates
- Since maps are not thread-safe, introduce read/write locks when working with the new global metrics map
Prevent duplicate metrics
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.

2 participants