-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add service annotations support (Enhancement proposal) #1547
Comments
The reason this is not used here is because the Prometheus upstream team (which we are all part of) advises against it, as it is very limited in what it can do. In fact it's the very reason the A few examples of things that are impossible with this approach:
If you want to mimic a behavior close to this (although with labels rather than annotations, labels are better because they are actually indexed in Kubernetes), then you can create a Alternatively you can use the |
@brancz thanks for the reasoning, it makes sense and is a fair point. As an addition I still think a basic predefined SM for this task can be useful in the case of simplest metrics (the ones that doesn't require multiple ports or any kind of customization). |
Yeah I think it's reasonable to document a |
It will be great if someone can document an example ServiceMonitor for this use case. |
Certainly going forward ServiceMonitor is the preferred approach, but if I install a new service from say a helm chart that uses the old prometheus.io/scrape true it would be great if it just worked instead of the user having to do extra work on their end. I was hoping going from the Prometheus helm chart to the Prometheus operator helm chart would require less work. |
I tossed this into the helm values for the prometheus-operator helm chart. Please notice the
|
The main point for me is that the whole add |
100% agreed. From the perspective of someone who recently ran into this. Where do you think we should put this? |
The README here points to the Helm Chart README, so there maybe? https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator |
@vsliouniaev do you think you could add a note there? :) |
Sure, thing. Will do that |
This issue has been automatically marked as stale because it has not had any activity in last 60d. Thank you for your contributions. |
Just a comment from somebody who just stumbled upon this. As I understand it, the developers removed the discovery via annotations approach and replaced it with Now, I'm new to Prometheus and (so far) have not figured out exactly how to use |
@mtiller Frederic already explained the reasoning at #1547 (comment) Here are a few Prometheus issues describing some limitations with the annotation approach (and there are probably other if you search): That being said, if you want to do annotation-based discovery, you're free to do it with |
@simonpasquier Just to be clear, I'm not saying annotations are sufficient for all cases (which seems to be the argument made in all the cases you cite). So I'm willing to stipulate that up front. I'm simply saying that requiring people to define If that isn't important to the developers, so be it. I'm not complaining. I'm just trying to provide constructive feedback. You are absolutely correct, it can be done with |
Just came across this issue. Was something like |
I also just ran into this and while i see the utility of the servicemonitor i constantly run into 'chicken and egg' problems. The servicemonitor is a crd, if that crd is not installed in the cluster then whatever you use to deploy manifests may just fail. (i have had this problem with people working on an application with metrics and a service monitor but are trying to deploy on a local or temp cluster without a monitoring stack). The workaround for now is to include the crd for those installs, but this is a hack. |
In non-operator helm prometheus there is a interesting defautl configuration that allows to scrape any service or endpoints with specific annotations:
I think a default 'ServiceMonitor' with similar configuration can be very useful (in particular for migrations)
The text was updated successfully, but these errors were encountered: