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 ConstLabels option #99

Merged
merged 1 commit into from
Aug 23, 2022
Merged

Add ConstLabels option #99

merged 1 commit into from
Aug 23, 2022

Conversation

nsurfer
Copy link
Contributor

@nsurfer nsurfer commented Aug 22, 2022

This adds ConstLabels, a label map, to surveyor.Options. The option is not exposed via the CLI, but can be used programatically like so:

s, err := surveyor.NewSurveyor(&Options{
	ConstLabels: prometheus.Labels{
		"foo": "bar",
		"baz": "qux",
	},
})

This adds constant labels to all exported metrics. For example:

nats_core_account_bytes_recv{account="AB7W",baz="qux",foo="bar"} 14004

If no ConstLabels are set, then the exported metrics will look exactly like before.

Fixes #95

Copy link
Contributor

@caleblloyd caleblloyd left a comment

Choose a reason for hiding this comment

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

LGTM

@caleblloyd caleblloyd merged commit 6a523da into main Aug 23, 2022
@caleblloyd caleblloyd deleted the const-label branch August 23, 2022 13:41
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.

Support Adding Arbitrary Metric Labels when imported as a Package
2 participants