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

fix(docs): Make sure helm Grafana example works as expected. #3753

Merged

Conversation

simonswine
Copy link
Contributor

@simonswine simonswine commented Dec 10, 2024

The problem with the grafana helm is that we don't have the profiling port exposed as part of the containerPorts of the container. So I had to reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com" instead of "profiles.grafana.com".

Fixes #3523

The problem with the grafana helm is that we don't have the profiling
port exposed as part of the containerPorts of the container. So I had to
reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com"
instead of "profiles.grafana.com".

Fixes grafana#3523
@simonswine simonswine added backport release/v1.9 This label will backport a merged PR to the release/v1.9 branch backport release/v1.10 This label will backport a merged PR to the release/v1.10 branch labels Dec 10, 2024
@simonswine simonswine marked this pull request as ready for review December 10, 2024 11:29
@simonswine simonswine requested review from a team as code owners December 10, 2024 11:29
Copy link
Contributor

Hello @simonswine!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

1 similar comment
Copy link
Contributor

Hello @simonswine!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

@simonswine simonswine added the type/docs Improvements for doc docs. Used by Docs team for project management label Dec 10, 2024
Copy link
Contributor

This PR must be merged before a backport PR will be created.

Copy link
Contributor

@marcsanmi marcsanmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

--set-string 'podAnnotations.profiles\.grafana\.com/memory\.scrape=true' \
--set-string 'podAnnotations.profiles\.grafana\.com/memory\.port=9094' \
--set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.scrape=true' \
--set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.port=9094'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Instead of reusing the gossip-tcp port, do you think leveraging extraExposePorts from Grafana helm chart would work to properly expose the profiling port? I didn't try, but I believe it could be added via Helm command as:

--set extraExposePorts[0].name=profiling,extraExposePorts[0].port=6060,extraExposePorts[0].targetPort=6060

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid that won't do it. extraExposePorts works on service level, we would need it on the container around here: https://github.com/grafana/helm-charts/blob/897c25093da0572716a7cd441e8d3c3dba064b98/charts/grafana/templates/_pod.tpl#L1081

I am planning of submitting something to that chart repo, but that will be a while until it comes through...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simonswine added a commit to simonswine/helm-charts that referenced this pull request Dec 10, 2024
In order to enable profiling using Grafana Alloy and Grafana Pyroscope
currently you would need to abuse another container port or insert a
dummy container to facitilitate profile collection.

This is because a containerPort is matched with the annotations to
enable profiling. As a workaround I am "abusing" the port :9094, as for
the example I am working on it is unused. This change will make it
possible to coexist with gossip-tcp and you would be able to enable
profiling like this:

```
helm upgrade -n pyroscope-test --install grafana grafana/grafana \
  --set env.GF_DIAGNOSTICS_PROFILING_ENABLED=true \
  --set env.GF_DIAGNOSTICS_PROFILING_ADDR=0.0.0.0 \
  --set env.GF_DIAGNOSTICS_PROFILING_PORT=6060 \
  --set-string 'podAnnotations.profiles\.grafana\.com/cpu\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/cpu\.port=6060' \
  --set-string 'podAnnotations.profiles\.grafana\.com/memory\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/memory\.port=6060' \
  --set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.port=6060'
```

This is realted to grafana/pyroscope#3753

Signed-off-by: Christian Simon <[email protected]>
simonswine added a commit to simonswine/helm-charts that referenced this pull request Dec 10, 2024
In order to enable profiling using Grafana Alloy and Grafana Pyroscope
currently you would need to abuse another container port or insert a
dummy container to facitilitate profile collection.

This is because a containerPort is matched with the annotations to
enable profiling. As a workaround I am "abusing" the port :9094, as for
the example I am working on it is unused. This change will make it
possible to coexist with gossip-tcp and you would be able to enable
profiling like this:

```
helm upgrade -n pyroscope-test --install grafana grafana/grafana \
  --set env.GF_DIAGNOSTICS_PROFILING_ENABLED=true \
  --set env.GF_DIAGNOSTICS_PROFILING_ADDR=0.0.0.0 \
  --set env.GF_DIAGNOSTICS_PROFILING_PORT=6060 \
  --set-string 'podAnnotations.profiles\.grafana\.com/cpu\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/cpu\.port=6060' \
  --set-string 'podAnnotations.profiles\.grafana\.com/memory\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/memory\.port=6060' \
  --set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.scrape=true' \
  --set-string 'podAnnotations.profiles\.grafana\.com/goroutine\.port=6060'
```

This is realted to grafana/pyroscope#3753

Signed-off-by: Christian Simon <[email protected]>
@simonswine simonswine merged commit 6045daa into grafana:main Dec 10, 2024
21 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 10, 2024
The problem with the grafana helm is that we don't have the profiling
port exposed as part of the containerPorts of the container. So I had to
reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com"
instead of "profiles.grafana.com".

Fixes #3523

(cherry picked from commit 6045daa)
github-actions bot pushed a commit that referenced this pull request Dec 10, 2024
The problem with the grafana helm is that we don't have the profiling
port exposed as part of the containerPorts of the container. So I had to
reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com"
instead of "profiles.grafana.com".

Fixes #3523

(cherry picked from commit 6045daa)
simonswine added a commit that referenced this pull request Dec 10, 2024
…3754)

The problem with the grafana helm is that we don't have the profiling
port exposed as part of the containerPorts of the container. So I had to
reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com"
instead of "profiles.grafana.com".

Fixes #3523

(cherry picked from commit 6045daa)

Co-authored-by: Christian Simon <[email protected]>
simonswine added a commit that referenced this pull request Dec 10, 2024
…3755)

The problem with the grafana helm is that we don't have the profiling
port exposed as part of the containerPorts of the container. So I had to
reuse/abuse the gossip-tcp port in order to get it to be scraped.

It also was using the wrong annotation of "pyroscope.grafana.com"
instead of "profiles.grafana.com".

Fixes #3523

(cherry picked from commit 6045daa)

Co-authored-by: Christian Simon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release/v1.9 This label will backport a merged PR to the release/v1.9 branch backport release/v1.10 This label will backport a merged PR to the release/v1.10 branch type/docs Improvements for doc docs. Used by Docs team for project management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit default alloy scrape configuration
2 participants