Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStatic labels for scape jobs #908
Comments
This comment has been minimized.
This comment has been minimized.
|
The domain expert here is @fabxc (currently on vacation). However, why do you have to do "strange" regexps? But definitely something to discuss with @fabxc and @juliusv once they are back. |
This comment has been minimized.
This comment has been minimized.
|
For example I want 2 static labels one is region: "new york", other is service: "abc service", however there is no way for me to put that in each scrape group. Either I have to do it at the global level or I have to do relabeling. Global won't work, I have many different service groups and regions. Target groups aren't useful if your using DNS or other discovery methods. Not sure what your getting at name, not sure its going to do anything in my usecase, I tried it with no effect. Let me show you the config section
What would be nice is a labels section under the -job_name section instead of relabeling |
This comment has been minimized.
This comment has been minimized.
|
@beorn7 I think this makes sense from a usage perspective. If you have an SD mechanism that can discover everything and knows what is what (e.g. location, other tags) you should be able to transport this through. The "old school" way we currently do is having long lists of jobs, but I'd consider that a workaround. |
This comment has been minimized.
This comment has been minimized.
|
@mattkanwisher Just for my understanding: Is your problem that something in your config doesn't work as expected, or are you just dissatisfied with the syntactic noise? What I meant, there is no need to extract your new label from the regexp.
|
This comment has been minimized.
This comment has been minimized.
|
Nice that cleaned up my config a whole lot. I can live with this, what you just posted. It seems strange to me that their are different options in the hierarchy but it doesn't seem worth much more investment at this point. Thanks! |
mattkanwisher
closed this
Jul 21, 2015
This comment has been minimized.
This comment has been minimized.
|
@mattkanwisher Yeah, I see your point. The problem is that there are too many levels of granularity where we already allow setting labels (global labels, per-target and per-metric relabeling labels, labels that come from the target, labels that get automatically dervived), and adding more will gradually drive us insane :) |
This comment has been minimized.
This comment has been minimized.
|
After discussion with @fabxc , reopening this. We'll rethink if static labels should be possible in SD configs. |
beorn7
reopened this
Aug 3, 2015
This comment has been minimized.
This comment has been minimized.
|
I don't think there's any need for additional syntax here, you can already do it with 3 lines of relabel config and in general we don't add configuration for something that's already possible. |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil yeah but prometheus is really unfriendly to configure, like stuffing everything into a relabeling is going to make the system very unusable long term. Things like sharding is now in relabeling also. |
This comment has been minimized.
This comment has been minimized.
Our assumption is that anyone who has a system of that scale has configuration management and will use that to manage complexity of their configuration, rather than making prometheus itself hard to configure by offering N different ways to do something that may interact in surprising ways. Sharding is an advanced use case needed by very few users (3 so far), optimising for it isn't a good investment. |
This comment has been minimized.
This comment has been minimized.
|
What gives me an itch is that we have static labels with file-based SD and with static target config, but not with the other SDs. I want it to be a feature consistently there or consistently absent. |
This comment has been minimized.
This comment has been minimized.
|
I don't think that's inconsistent, it's a feature of the SD per-target rather than the scrape config per-job. Other SDs are free to add in whatever labels they like too based on the SD (thus far the SD methods aren't use consistently enough to be able to pick out useful labels for everyone - this won't be the case with EC2 say where region and availability zone labels could be applied) |
This comment has been minimized.
This comment has been minimized.
|
But if you are fine with 3 lines of relabel config, why do we have static labels in static target config? The same method (3 lines of relabel config) could be used there to attach static labels. |
This comment has been minimized.
This comment has been minimized.
|
Ah now I see what you're saying, the |
This comment has been minimized.
This comment has been minimized.
|
Yup. We could declare it legacy (with the intention to deprecate and remove it eventually), or we could offer the same everywhere (which might be one level of labeling too many...). |
This comment has been minimized.
This comment has been minimized.
|
Then again |
This comment has been minimized.
This comment has been minimized.
|
With replacement and regex defaulted for relabelling, it's now much simpler to do static labels so I'd say this is good enough. |
brian-brazil
closed this
Dec 16, 2015
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
mattkanwisher commentedJul 20, 2015
We do discovery of our scrape jobs by using dns_sd_configs, however whats really awkward is we have some static labels that we want to apply to all the machines in the group. We end up having to do relabeling with some strange regexes when all we wanted was just labels. Would you guys be open to taking a pull request in the future that introduces labels at the job level? Or is the are reason you don't do it?