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 option to specify namespace of metrics #88

Open
Otterpohl opened this issue Feb 26, 2024 · 1 comment
Open

Add option to specify namespace of metrics #88

Otterpohl opened this issue Feb 26, 2024 · 1 comment

Comments

@Otterpohl
Copy link

If not already possible, i would like for the metrics to be namespaced if a namespace option was specified

autometrics.Init(
    autometrics.WithNamespace("imaginary_application"),
)

function_calls_duration_seconds_count would become imaginary_application_function_calls_duration_seconds_count

if this is not already possible then i would be happy to raise a PR to add this

@gagbo
Copy link
Member

gagbo commented Feb 28, 2024

Hello,

It’s not exactly possible like that, we didn’t think of this because

  • it increases the risk of having a metrics explosion leading to extra used storage, and
  • because it makes it harder to "pre-write" useful queries against arbitrary names like this, leading to harder alert/monitoring tooling

You can kind of get it when using a specific serviceName (also available with the Prometheus backend ) , because the serviceName gets exported to Prometheus as a service_name label and you can filter on this, e.g. topk(3, function_calls_count{service_name="imaginary_application"})

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

No branches or pull requests

2 participants