grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.36k stars 193 forks source link

Support for receiving profiles #270

Open AndreZiviani opened 9 months ago

AndreZiviani commented 9 months ago

Request

Would be really useful to be able to receive profiles on the agent, something similar to loki.source.api

Use case

The main reasons for me are:

ptodev commented 9 months ago

Hi @AndreZiviani, thank you for raising an issue! Aer you referring to Pprof profiles? Is there a reason why pyroscope.scrape would not be sufficient for the purposes listed above?

AndreZiviani commented 9 months ago

Aer you referring to Pprof profiles?

I'm not sure, I want to be able to instrument my applications with the official Pyroscope libraries (not sure if it sends the profiles as pprof or something else) and send them to grafana agent. I forgot to mention Pyroscope on the original message :man_facepalming:

Is there a reason why pyroscope.scrape would not be sufficient for the purposes listed above?

Pyroscope libraries does not expose an endpoint for collection, it is only push-mode. I could look for other libraries but would like to stick with the official ones if possible

ptodev commented 8 months ago

I spoke with the Pyroscope team and they agree that this is a very valid request. The demand for this is likely to grow over time, so it is good to keep the issue open, but we cannot commit to when this will be implemented yet.

AndreZiviani commented 8 months ago

ok, thanks for the followup @ptodev

I guess its worth mentioning the future profiling support on opentelemetry, could be a long time before that's approved/implemented but I think its important to consider when implementing either/both options on the agent

github-actions[bot] commented 7 months ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

fede843 commented 7 months ago

I am looking forward this feature too! We are deploying an instance of Grafana Agent per server to gather, process/filter (as much as possible at that instance) and proxy all observability signals so far, and profiling is not fitting there yet. It is true that already existing scrape config might be enough for many cases, but not all. We are trying to link traces to profiles, using Java, and we need the jar agent, at least for now. It would be interesting to see how this develops in the future, along the adoption profiling into OTEL. That is the key I think.

craigbehnke commented 1 month ago

I was trying to deploy Pyroscope on my dotnet services in a k8s cluster, but had to abandon the idea because of this issue. For context, I use a service mesh where the only service authorized to communicate with *.grafana.net is the alloy deployment and not any first-party service.

It also looks like this capability (or similar) has been requested multiple times: Pyroscope forwarding through Alloy https://github.com/grafana/alloy/issues/984 Add push endpoint for jfr/pprof pyroscope/phlare protocol https://github.com/grafana/alloy/issues/395

Is there any roadmap or update on when this feature could be introduced?

ptodev commented 1 month ago

Hello! Both the Alloy and the Pyroscope teams would welcome the addition of such a receiver component. However, it is not on our roadmap and I can't guarantee if (and when) it would be prioritised. If anyone is interested in submitting a PR for it, please feel free to do so! We would be happy to review it.

I don't think OTel would impact the addition of this component. It'd be good to have a Pyroscope receiver component in Alloy even if there is a native OTel receiver for profiling. It could be useful for Pyroscope-instrumented applications. Not everyone may want to (or be able to) move to the OTel profiling instrumentation.

The future receiver component will most likely forward the profiles to pyroscope.write. It'll have to accept them as if it were Pyroscope's "ingest" HTTP endpoint.

It would be interesting look into scalability issues:

marcsanmi commented 2 weeks ago

Hi everyone,

From the Pyroscope team, I wanted to provide a status update on this (thanks to the Alloy team for your help). Work has already begun, and we're aiming to have this completed by mid-November.

Here's a brief overview of what we're planning:

This approach essentially acts as a proxy, maintaining simplicity in the user experience by using the same Alloy capsule as the current one exported by pyroscope.write.

We believe this solution will address the needs expressed in this issue, allowing for more flexible profile ingestion while maintaining compatibility with existing Pyroscope-instrumented applications.