-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat: Add ServiceMonitor for Prometheus operator #58
Conversation
Backstage instances with the Prometheus /metrics endpoint configured [1] can set `serviceMonitor.enabled` to allow prometheus to scrape it's metrics Disabled by default. [1] https://github.com/backstage/backstage/blob/master/contrib/docs/tutorials/prometheus-metrics.md Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no>
750afb8
to
fe1cba2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @nikolaik! 🙂 While I like your PR in general, I have conflicting feelings, namely because:
ServiceMonitor
is a CR, it's not part of vanilla kubernetes and you need to have Prometheus operator installed. This introduces undisclosed dependency.- Default, vanilla Backstage instance has no metrics endpoint. This introduces configuration requirement on the Backstage image side.
While I agree with the purpose, I'm not entirely sure this should be part of a canonical chart but rather an opinionated extension of it.
What do others think? cc @backstage/helm-charts
I'm not that against this feature if I'm being honest. Mainly because by default it won't be enabled which will allow folks to be able to turn it on if they ever want it. The second point touches on a more crucial point for me though which is that for this functionality to work, the underlying backstage image would have to have the metrics code. On the whole, I do agree that we do need to be careful on what we allow as non vanilla Kubernetes features, although if I'm being honest, we can probably make those judgements on an Issue/PR basis. This for example is something that I believe would be good to offer in the Chart because monitoring is quite a big deal in Kubernetes - the only caveat to this is that it assumes that the Prometheus operator is installed. Although by default it isn't enabled so for me its not the end of the world. Interested to hear others thoughts on this |
Looks good to me. Nice addition @nikolaik! 🙏 |
Thanks for the review @tumido <3 I'll update the PR with your feedback shortly. And thank you for bringing up the pros and cons of including ServiceMonitor in the chart. I went with disabled by default because using the option requires non default functionality in backstage. I'll point users to the metrics endpoint tutorial and some other relevant docs where it makes sense in the values.yaml file. One point that is not mentioned is that ServiceMonitor ties into the CNCF ecosystem of packages, which both backstage and prometheus is part of, although I see that the prometheus-operator is not part of the official prometheus project. |
- Move to `metrics.serviceMonitor - Document prometheus-operator and /metrics endpoint requirements - Remove namespaceSelector config option - Add commonLabels and commonAnnotations Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no>
f579f9b
to
ab5b2df
Compare
Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no>
50f485b
to
3b9614e
Compare
fc87190
to
783140f
Compare
Co-authored-by: Vincenzo Scamporlino <me@vinzscam.dev> Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no>
783140f
to
d5bc138
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing I've noticed... We should maintain consistency with all other resources in label/annotation templating and rendering.
Sorry for being unresponsive, fixing the last bits now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries at all! 🙂
/lgtm
/approve
Looks great now 👍
@nikolaik CI is complaining, can you please fix this? |
Signed-off-by: Nikolai R Kristiansen <nikolai.kristiansen@remarkable.no>
5a1b07e
to
2e31c1a
Compare
Sorry about that, fixed ✅ |
Description of the change
Backstage instances with the Prometheus /metrics endpoint configured can set
metrics.serviceMonitor.enabled
to allow prometheus to scrape it's metricsDisabled by default.
Example diff:
Checklist
Chart.yaml
according to semver.values.yaml
and added to the README.md. The helm-docs utility can be used to generate the necessary content. Usehelm-docs --dry-run
to preview the content.ct lint
command.