examples/README.md
Choose a language folder to select an example for your language of choice.
Pyroscope identifies performance issues in your application by continuously profiling the code.
If you've never used a profiler before, then welcome!
If you are familiar with profiling and flame graphs, then you'll be happy to know that Pyroscope:
Pyroscope is a continuous profiling database that allows you to analyze the performance of your applications. When sending profiles to Pyroscope, you can choose between two primary methods: SDK Instrumentation and auto-instrumentation using Grafana Alloy.
You can send data from your application using Grafana Alloy or Grafana Agent collectors. Both collectors support profiling with eBPF, Java, and Golang in pull mode.
For examples using auto-instrumentation with the collectors, try the grafana-alloy-auto-instrumentation example.
Grafana Alloy is a vendor-neutral distribution of the OpenTelemetry (OTel) Collector. Alloy uniquely combines the very best OSS observability signals in the community. Grafana Alloy uses configuration file written using River.
Alloy is the recommended collector instead of Grafana Agent. New installations should use Alloy.
Here's how it works:
Using a collector provides a hassle-free option, especially when dealing with multiple applications or microservices, allowing you to centralize the profiling process without changing your application's codebase.
Alternatively, Pyroscope SDKs offer you the ability to instrument your application directly for more precise profiling. Use the SDKs when you want complete control over the profiling process or when the application you are profiling is written in a language supported by the SDKs (for example, Java, Python, .NET, and others).
Here's how to use Pyroscope SDKs:
By using the Pyroscope SDKs, you have the flexibility to customize the profiling process according to your application's specific requirements. You can selectively profile specific sections of code or send profiles at different intervals, depending on your needs.
You can use Grafana Alloy (recommended) or Grafana Agent (legacy) collectors for auto-instrumentation or the Pyroscope instrumentation SDKs. The method you choose depends on your specific use case and requirements.
Here are some factors to consider when making the choice:
To get started, choose one of the integrations below:
<table> <tr> <td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/go_pull"> <b>Grafana Alloy</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/go_pull/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/grafana-alloy-auto-instrumentation" title="examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/go_push/">
<b>Golang</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/go_push/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/golang-push" title="golang-examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/java/">
<b>Java</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/java/">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/java/rideshare" title="java-examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/ebpf">
<b>eBPF</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/ebpf" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/grafana-alloy-auto-instrumentation/ebpf" title="examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/python/">
<b>Python</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/python/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/python" title="python-examples">Examples</a>
</td>
<b>.NET</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/dotnet/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/dotnet" title="examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/ruby/">
<b>Ruby</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/ruby/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/ruby" title="ruby-examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/nodejs/">
<b>Node.js</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/nodejs/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/nodejs/express" title="examples">Examples</a>
</td>
<td align="center"><a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/rust/">
<b>Rust</b></a>
<a href="https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/rust/" title="Documentation">Documentation</a>
<a href="https://github.com/grafana/pyroscope/tree/main/examples/language-sdk-instrumentation/rust/rideshare" title="examples">Examples</a>
</td>
You can add tags to your profiles to help correlate them with your other telemetry signals. Some common tags that are used are version, region, environment, request types, etc. You have the ability to add tags using both the SDK and the agent.
Valid tag formats may contain ASCII letters and digits, as well as underscores. It must match the regex [a-zA-Z_][a-zA-Z0-9_].
In Pyroscope, a period (.) is not a valid character inside of tags and labels.