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

Metrics-generator: add option to inject the tenant ID as metrics label #3630

Open
kvrhdn opened this issue Apr 30, 2024 · 0 comments · May be fixed by #3638
Open

Metrics-generator: add option to inject the tenant ID as metrics label #3630

kvrhdn opened this issue Apr 30, 2024 · 0 comments · May be fixed by #3638

Comments

@kvrhdn
Copy link
Member

kvrhdn commented Apr 30, 2024

Is your feature request related to a problem? Please describe.

Scenario:

  • you are running Tempo in multitenant mode
  • metrics-generator is enabled but all tenants write to the same Prometheus tenant
  • you wish to query metrics for tenants independently

Describe the solution you'd like

Tempo gets a configuration option to add the tenant ID as metric label to all generated metrics.

It would have to be a setting on the registry, something like:

metrics_generator:
  # ...
  registry:
    collection_interval: 15s
    inject_tenant_id: true

Or maybe:

    inject_tenant_id: "tempo_tenant_id"

Describe alternatives you've considered

Workaround: inject an attribute on every span and configure these as dimensions in the service-graph and span-metrics processor. This could be done in the application or by the tracing pipeline.

Downside: doing this in the instrumentation risks missing some spans --> these won't have a tenant ID and won't be counted.

Additional context

Implementation notes: we already inject a label in the registry

hostname, _ := os.Hostname()
externalLabels["__metrics_gen_instance"] = hostname

I think we just add some extra code here: if the config setting is active add another externalLabel which contains the value of tenant.
This will automatically add it to all metrics generated for that tenant.

@kvrhdn kvrhdn linked a pull request May 1, 2024 that will close this issue
3 tasks
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 a pull request may close this issue.

1 participant