
Thanks for deploying Grafana Pyroscope.

# Pyroscope UI & Grafana

Pyroscope database comes with a built-in UI, to access it from your localhost you can use:

```
{{ include "pyroscope.kubectl_port_forward_read" . }}
```

You can also use Grafana to explore Pyroscope data.
For that, you'll need to add the Pyroscope data source to your Grafana instance and configure the query URL accordingly.
See https://grafana.com/docs/grafana/latest/datasources/grafana-pyroscope/ for more details.

The in-cluster query URL for the data source in Grafana is:

```
{{ include "pyroscope.read_url" . }}
```

# Collecting profiles.

{{ if or .Values.agent.enabled .Values.alloy.enabled }}
The Grafana {{ if .Values.alloy.enabled }}Alloy{{ else }}Agent{{ end }} has been installed to scrape and discover pprof profiles endpoint via pod annotations.

As an example, to start collecting memory and cpu profile using the 8080 port, add the following annotations to your workload:

```
profiles.grafana.com/memory.scrape: "true"
profiles.grafana.com/memory.port: "8080"
profiles.grafana.com/cpu.scrape: "true"
profiles.grafana.com/cpu.port: "8080"
```


To learn more supported annotations, read our guide https://grafana.com/docs/pyroscope/latest/deploy-kubernetes/#optional-scrape-your-own-workloads-profiles
{{- end }}

There are various ways to collect profiles from your application depending on your needs.
Follow our guide to setup profiling data collection for your workload:

https://grafana.com/docs/pyroscope/latest/configure-client/

{{- $storage := .Values.architecture.storage }}
{{- if and $storage.v1 $storage.v2 }}

# Pyroscope v2 Migration is active

Write traffic will be written to:
- {{ mul $storage.migration.ingesterWeight 100 }}% v1: ingester
- {{ mul $storage.migration.segmentWriterWeight 100 }}% v2: segment-writer

Read traffic is served from v2 read path from {{if eq $storage.migration.queryBackendFrom "auto"}}as soon as data was first ingested to v2{{else}}{{$storage.migration.queryBackendFrom}}{{end}}.
{{- end }}

{{- if and (not $storage.v1) (not $storage.v2) }}
{{- fail "you need to set at least one of .Values.architecture.storage.v1, .Values.architecture.storage.v2 to true" }}
{{- end }}
