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 more labels to prometheus output #864

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Conversation

sebhoss
Copy link
Contributor

@sebhoss sebhoss commented Jan 13, 2024

Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

This adds a resource_id label to each test-specific metric if the verbose format option was enabled. This assumes that the combination of resource ID and resource type is unique.

Since we only have access to format options in the Output method, we are creating metrics during the first run of that method.

Metrics can only be registered once for any given set of labels, so we create a custom registry and use the existence of that as a check whether we need to create/register metrics. This has the added benefit of simplifying the test a tiny bit, and it exposes even less metrics on the /healthz endpoint.

fixes #862

Pinging @petemounce @aelsabbahy

This adds a 'resource_id' label to each test-specific metric if the 'verbose' format option was enabled.

Since we only have access to format options in the 'Output' method, we are creating metrics during the first run of that method.

Metrics can only be registered once for any given set of labels, so we create a custom registry and use the existence of that as a check whether we need to create/register metrics. This has the added benefit of simplifying the test a tiny bit, and it exposes even less metrics on the /health endpoint.

fixes goss-org#862

Signed-off-by: Sebastian Hoß <[email protected]>
Copy link
Collaborator

@petemounce petemounce left a comment

Choose a reason for hiding this comment

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

This LGTM; thanks. I'll await @aelsabbahy for approve.

I'll take care of adding documentation when #856 merges; I don't want to cause @noirbizarre a conflict.

Copy link
Member

@aelsabbahy aelsabbahy left a comment

Choose a reason for hiding this comment

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

Approved, merging.

@aelsabbahy aelsabbahy merged commit 4e36e8f into goss-org:master Jan 17, 2024
1 check passed
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.

Add more labels to prometheus output format
3 participants