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

pipeline support for metrics #1821

Closed
oscni opened this issue Jun 23, 2022 · 6 comments
Closed

pipeline support for metrics #1821

oscni opened this issue Jun 23, 2022 · 6 comments
Labels
enhancement New feature or request frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. stale Issue/PR mark as stale due lack of activity

Comments

@oscni
Copy link

oscni commented Jun 23, 2022

Would be very useful with pipeline support for metrics. Specifically the tenant function.
https://grafana.com/docs/loki/latest/clients/promtail/stages/tenant/

@tpaschalis
Copy link
Member

Hey there 👋 thanks for the suggestion! We're exploring adding a more pipeline-like functionality into the Agent, so stay tuned for more news in the future!

About the specific tenant functionality, we don't currently support something as fancy as Loki's solution.

What you could do (at least for now) is to use the headers field under remote_write, to configure an extra header along your metrics. The header value could also be more dynamic by using an env var and passing the -config.expand-env CLI flag.

remote_write:
- url: <remote-url>
  headers:
    X-Scope-OrgID: "my-custom-value"

@rfratto rfratto added enhancement New feature or request subsystem/metrics labels Jul 20, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had any activity in the past 30 days.
The next time this stale check runs, the stale label will be removed if there is new activity. The issue will be closed in 7 days if there is no new activity.
Thank you for your contributions!

@github-actions github-actions bot added the stale Issue/PR mark as stale due lack of activity label Aug 20, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2022
@akselleirv
Copy link
Contributor

Hello @tpaschalis, I would be interested in this feature.

Would it require a lot of effort to implement this functionality? Might be something I could help contribute.

@tpaschalis
Copy link
Member

tpaschalis commented Oct 26, 2022

Hey @akselleirv! Thanks for expressing interest in improving Grafana Agent!

The issue here is that Prometheus' remote_write protocol doesn't have the notion of multi-tenancy itself. So, different backends (Mimir, Thanos, Cortex, Timescale etc) use different methods on their own, either via HTTP headers, or 'special' labels. Furthermore, when sending to remote_write Prometheus batches metrics together using its queue manager, so you don't always have fine-grained control in how metrics will get sent to disambiguate their HTTP headers.

So many times the header might be injected by a reverse proxy, or even do the transformation from labels to X-Scope-OrgID header with a different solution like cortex-tenant.

All in all, the effort might depend on the way that we choose to implement this, so if you're still interested you might open a new issue with a proposed solution, so we can kickstart a discussion about how feasible it is. If you're interested in Flow our newest experimental system for building telemetry pipelines, such functionality might tie well into being a standalone Flow component.

@oscni
Copy link
Author

oscni commented Oct 26, 2022

Yeah it's true that it's not built in the remote_write protocol and I could create a new issue with just requesting that it would be nice to have headers of your choosing dynamically set from some label. That would be fine for us since we just want to separate kubernetes namespaces into different tenants. But the promtail pipeline is more flexible than that and it I thought it would be good to harmonize the configuration between logs and metrics.

@tpaschalis
Copy link
Member

it would be nice to have headers of your choosing dynamically set from some label.

I agree with that. That might be easier when building a pipeline with Flow, but I think that the current Prometheus remote_write code that we're reusing will opportunistically batch metrics and send the RW request as they come, and there's no way to have a more fine-grained manipulation to be able to batch and inject headers depending on a label.

I've opened issue grafana/alloy#521 for implementing a Flow component that achieves this, but we'd have to dig a little deeper to see if it's possible at all from the Agent side when using the YAML configuration, or if we must start a conversation with upstream Prometheus about it.

@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. stale Issue/PR mark as stale due lack of activity
Projects
None yet
Development

No branches or pull requests

4 participants