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 possibility for setting prefix on custom metrics, solves #49 #163

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thomasbalsloev
Copy link

Hi @SamSaffron

Added possibility to set prefix on custom metrics.
Let me hear what you think of the code enclosed.

BR, Thomas.

@nevesenin
Copy link

Would also like to have this feature.

@SamSaffron
Copy link
Member

Yeah it is a nice change @thomasbalsloev sorry I left it so long, can you also add a note to README here that teaches about usage?

@thomasbalsloev
Copy link
Author

@SamSaffron

Hi Sam. I added a note to the README about the custom prefix.

BR, Thomas.

PrometheusExporter::Metric::Base.default_labels = { "hostname" => "app-server-01" }

# Counter instance with custom prefix for this metric
counter = PrometheusExporter::Metric::Counter.new("web_requests", "number of web requests", "my_custom_prefix")
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I think there is typo here?

PrometheusExporter::Metric::Counter.new("web_requests", "number of web requests",    prefix: "my_custom_prefix")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants