Krasi Georgiev Senior Software EngineerMonitoring Team |
--You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAMrVKsyx9fXZsLLBD8jX%2B02MOL_J%2BLkWr0t3BQY4U4Qn%3DJLUgw%40mail.gmail.com.
On 18 Dec 10:40, Krasimir Georgiev wrote:
> > Implement environment variable expansion in configuration files as an
> opt-in feature, to be activated via a command-line flag (so that it
> doesn’t become a breaking change for existing config files).
>
> I don't understand how is this a breaking change without an explicit flag?
> Krasi Georgiev Senior Software Engineer
> Monitoring Team
Because you could have e.g. an external label called $MYSYTE for
example. Or, target with labels "$me"..
Krasi Georgiev Senior Software EngineerMonitoring Team |
On 18 Dec 01:54, Björn Rabenstein wrote:
Should we add another alternative which would be usable only in relabeling?
relabel_configs:
- source_env: [HOSTNAME]
target_label: hostname
replacement: $1
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/388e1c13-2b1f-4575-8ec4-487bc6e9e952%40googlegroups.com.
My original mail was carefully markdown-formatted, but I messed up sending it out as HTML mail after rendering it as such. I only noticed that now. In case it helps, see the properly formatted text below, with handy links and such…
Prometheus issue #2357 might very well be the one with the most emoji reactions throughout the whole Prometheus GitHub org. Even if we take into account that a considerate amount of trolling might be happening there, it’s quite obvious that a lot of users would like to see environment variable expansion in configuration files.
However, popular demand alone is not sufficient to introduce a feature. If the main developers of the codebase think it’s a bad idea, it ain’t gonna happen. The understanding so far has been that the topic was discussed in the past, resulting in the members of the Prometheus team reaching consensus to not introduce environment variable expansion in configuration files. With no team member raising an explicit objection, the consensus holds, as defined in the governance document. However, objections are still being raised by members of the wider user community, including implications that the rejection is imposed by selected few rather than the whole team. Therefore, the recent Prometheus dev summit decided to revisit the discussion and then make the decision explicit by a majority vote as described in the governance document.
The best place to read up on the discussion so far is the GH issue mentioned above.
My attempt at a summary (not only from the issue, but also from other sources):
The main arguments against environment variable expansion in configuration files:
$FOO, ${FOO}, like the popular envsubst tool), others use a different syntax (e.g. $(FOO) like prominently Kubernetes). Any syntax might collide with syntactic constructs that are not meant as variables (happens easily in regular expressions), and there is again no consensus about escaping options, if they exist at all. Yet another point of divergence is the handling of undefined variables: Error out, expand to the empty string, or leave it unexpanded?The main arguments for environment variable expansion in configuration files (in corresponding order):
I hereby call a vote on the following three alternatives:
To give enough time for any necessary discussion and to not collide with the holiday season, the vote will close on 2020-01-06, end of day UTC.
Note that everybody may participate in the discussion but only Prometheus team members can vote. According to our governance, the vote has to be yes or no on each of the three alternatives.
Finally note that this proposal intentionally leaves out implementation details (which syntax to use, how escaping should work, which parts of the config files variable expansion should apply to, how to display the config on the status page, …). We don’t need to work these out if the vote confirms the rejection of variable expansion in configuration files. If, however, the vote triggers an implementation of the feature, and then the devil turns out to be in the details, we can still rollback by another vote.
On 18.12.19 08:56, Brian Brazil wrote:
>
> This goes to the argument that templating systems (in the broadest meaning of
> the term) don't nest well. Even when escaping is properly defined, it's tricky
> for a user to get things right.
Which could be used as an argument _for_ the expansion of env
variables as that at least leaves everything to one templating system
(the one included in Prometheus) rather than forcing the user to nest
two templating systmes (e.g. `envsubst` and Prometheus).
- Keep the status quo, no environment variable expansion in configuration files.
2. Implement environment variable expansion in configuration files as an opt-in feature, to be activated via a command-line flag (so that it doesn’t become a breaking change for existing config files).
3. Like 2. but environment variable expansion will not happen for fields that are marked as secrets.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/20191219184547.GV3356%40jahnn.
On 19.12.19 18:31, Brian Brazil wrote:
> On Thu, 19 Dec 2019 at 18:14, Bjoern Rabenstein <bjo...@rabenste.in> wrote:
>
> On 18.12.19 08:56, Brian Brazil wrote:
> >
> > This goes to the argument that templating systems (in the broadest
> meaning of
> > the term) don't nest well. Even when escaping is properly defined, it's
> tricky
> > for a user to get things right.
>
> Which could be used as an argument _for_ the expansion of env
> variables as that at least leaves everything to one templating system
> (the one included in Prometheus) rather than forcing the user to nest
> two templating systmes (e.g. `envsubst` and Prometheus).
>
>
> It'd still be layering two templating/interpolation systems: one for regex
> replacement and the other for env vars.
That's splitting hairs. With that view, every templating system that
expands more than one class of things is multiple templating systems
nested into each other.
> I don't believe anyone is suggesting adding something
> sophisticated enough to Prometheus so as to have the escaping and
> other text manipulation functions required for that to begin to be
> sane.
Should the feature request get accepted, I would suggest exactly
that. Conveniently, the Go `regexp` package already has escaping for
`$`, and the syntax follows that of shell variables. We only need to
define a preference for name collisions.
Implement environment variable expansion in configuration files as an
opt-in feature, to be activated via a command-line flag (so that it
doesn’t become a breaking change for existing config files).
Like 2. but environment variable expansion will not happen for fields
that are marked as secrets.
The use case is really expanding $HOSTNAME and other small vars. Not
passing entire config from the env.
On Friday, 20 December 2019 09:52:57 UTC, Julien Pivotto wrote:The use case is really expanding $HOSTNAME and other small vars. Not
passing entire config from the env.I *think* env variables are most commonly related to containers and container ecosystem does have a way of dealing with such problems.
Are there use cases where someone runs Prometheus without a container, yet feeds _some_ config options by setting env variables rather then editing configuration?
Maybe this problem (if it's really only related to docker) could be solved by providing an official image that includes some tool like https://github.com/docker-infra/reefer, so users who want to have such simplified env variable expansion can pull that one?
I've just gone through the entire Github issue and noted the usecases that were reported were environment variables will help: external_labels, http_proxy, remote_write_urls, and secrets (mainly secrets?).What irks me is that $SOMETHING is a legit thing to use in the config. Like one can have an external label whose value is "$APP_01". But I am also super sympathetic to those who want to sent an external label via environment variables. Infact we have 2 different statefulsets with two different configmaps so that we have different labels in the HA pairs. We have a templating system that makes this trivial, but I don't think it is the case with others.Having said that, I think the Prometheus operator should be enough for most usecases on k8s and it handles everything mentioned above easily. For those who are looking to do things directly, they could always have a init container / sidecar from operator to achieve the same. It is additional complexity, but the alternative is the operator which just works.I am not super sure about the non-container usecases. But from my very cursory look adding a envsubst preprocessing step looks like just a few lines of code in ansible/chef/puppet. I don't think the overhead for the operators is too high.
Finally, regarding secrets, given how we already have the basic auth secrets pointing to a file, can we have the other secrets in files too?
Would that be sufficient to handle the secrets usecase?
Given how I cannot see a sane way to do the substitution, specially in the external labels usecase, I am drifting towards a no for supporting it. I will cast my vote after a few days, once I have done more research. But in the meantime, could folks help me see a sane way to satisfy the external labels usecase?
Thanks,Goutham.On Saturday, December 21, 2019 at 1:05:03 PM UTC, Brian Brazil wrote:On Sat, 21 Dec 2019 at 10:32, Łukasz Mierzwa <l.mi...@gmail.com> wrote:On Friday, 20 December 2019 09:52:57 UTC, Julien Pivotto wrote:The use case is really expanding $HOSTNAME and other small vars. Not
passing entire config from the env.I *think* env variables are most commonly related to containers and container ecosystem does have a way of dealing with such problems.
Are there use cases where someone runs Prometheus without a container, yet feeds _some_ config options by setting env variables rather then editing configuration?Offhand the only one mentioned in the various threads was HTTP_PROXY.Maybe this problem (if it's really only related to docker) could be solved by providing an official image that includes some tool like https://github.com/docker-infra/reefer, so users who want to have such simplified env variable expansion can pull that one?I'm not sure we should provide something like that officially (it being on the Prometheus project to provide every potential combination of Prometheus+Tool as a docker image isn't scalable), but given the interest in this feature it shouldn't be hard to find someone in the community to provide such a thing as part of the broader ecosystem.--Brian Brazil
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/98e8037e-2ea7-4354-8b18-527a481de411%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAHJKeLqYXJk3MkTRZ63srdEj%3DmBF4mJwZE6Gh79z%2BcmqPicRSw%40mail.gmail.com.
I think envsubst may not be a particularly good solution. In my mental model of the problem, the base solution that always works is a POSIX shell script with a heredoc. The escaping on that is not particularly pretty but it is well defined.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAFU3N5VBBBSfs5TW4OgEmExhdtRc-BT3BPWwGXLBAan7fYkB8A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAMrVKsyx9fXZsLLBD8jX%2B02MOL_J%2BLkWr0t3BQY4U4Qn%3DJLUgw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAHJKeLqcSVJtW0Z4FROErbN2hwyHSxGaqWV326hOzDz69kNsXw%40mail.gmail.com.
Thanks for bringing this up. My vote, (along the lines what Chris mentioned):
4. Implement environment variable expansion ONLY for the external labels section (and potentially only for label values) as it is a very common use case like replica label when running Prometheus in HA when running on K8s. There is so collision issue there as label value has a strict format.
On Mon, 6 Jan 2020 at 10:32, Bartłomiej Płotka <bwpl...@gmail.com> wrote:
Thanks for bringing this up. My vote, (along the lines what Chris mentioned):It's not clear how you're voting on the 3 options, so this is not a valid vote. Can you clarify?4. Implement environment variable expansion ONLY for the external labels section (and potentially only for label values) as it is a very common use case like replica label when running Prometheus in HA when running on K8s. There is so collision issue there as label value has a strict format.Label values are full UTF-8, so there can be collisions with any potential syntax. The string "$HOSTNAME" is a perfectly valid label value for example.I think it's also a bit weird to single out one particular field for one particular deployment model, why this one and not all the others?Brian
Kind Regards,Bartek
On Mon, 6 Jan 2020 at 10:26, Brian Brazil <brian...@robustperception.io> wrote:
--On Mon, 6 Jan 2020 at 10:15, Julien Pivotto <roidel...@inuits.eu> wrote:On 18 Dec 08:56, Brian Brazil wrote:
> On Wed, 18 Dec 2019 at 08:44, Julien Pivotto <roidel...@inuits.eu> wrote:
>
> > On 18 Dec 10:40, Krasimir Georgiev wrote:
> > > > Implement environment variable expansion in configuration files as an
> > > opt-in feature, to be activated via a command-line flag (so that it
> > > doesn’t become a breaking change for existing config files).
> > >
> > > I don't understand how is this a breaking change without an explicit
> > flag?
> > > Krasi Georgiev Senior Software Engineer
> > > Monitoring Team
> >
> > Because you could have e.g. an external label called $MYSYTE for
> > example. Or, target with labels "$me"..
>
>
> Or a bit more plausibly, a relabelling replacement of "$1:9100" or
> "${1}:9100".
Possibly using ${env.HOSTNAME} would be a harmless way to introduce this
without adding an extra flag.That's still a valid string though currently, so there could be a collision (maybe you're using that as label value to signal out to an AM webhook?)--Brian Brazil
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAHJKeLqcSVJtW0Z4FROErbN2hwyHSxGaqWV326hOzDz69kNsXw%40mail.gmail.com.
Kind Regards,Bartek
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAHJKeLqcSVJtW0Z4FROErbN2hwyHSxGaqWV326hOzDz69kNsXw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/618207e7-2035-4972-b308-4a2f0b89780f%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAMssQwaxjDAyNjNcyN-UQq1jEqhbHjVPc3MsFGKzdPZLT6t76A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAK6hLk1PvRsFUt1vDDhqzx9%3D7U-q%2B4bdP8VDRnGPCqT5aT9_Og%40mail.gmail.com.
On 03.01.20 09:18, Chris Marchbanks wrote:
>
> That said, I understand the frustration around not being able to configure
> certain fields via environment variables, especially external labels. I don't
> think allowing env var expansion is the correct way forward, but I could be
> open to allowing env vars to configure very specific fields such as external
> labels separately from expansion. Something like how Grafana has very
> specific syntax for using env vars, but do not expand them in their config.
That works nicely in Grafana because the whole ini-style config file
has only entries that can be addressed with
`<SectionName>_<KeyName>`. That enables the environment variables with
tha naming pattern `GF_<SectionName>_<KeyName>`, see
https://grafana.com/docs/grafana/latest/installation/configuration/#using-environment-variables
It would be more complicated with the Prometheus YAML config file, as
they allow repetition and deeper nesting.
Having said that, I think it makes sense to "whitelist" env var
expansion for very specific fields only. As I said before, this is
superior to external preprocessing of config files because those tools
either don't understand the structure of the Prometheus config files
(acting just on the plain text) or have to know about which fields
they should touch (assuming they understand YAML). Also, we have exact
knowledge then where env var expansion applies and can come up with
preference and escaping that makes sense in that context rather than
letting the user solve that problem in a makeshift way.
Prometheus issue #2357 might very well be the one with the most emoji
reactions throughout the whole Prometheus GitHub org. Even if we take
into account that a considerate amount of trolling might be happening
there, it’s quite obvious that a lot of users would like to see
environment variable expansion in configuration files.
Keep the status quo, no environment variable expansion in configuration files.
Implement environment variable expansion in configuration files as an
opt-in feature, to be activated via a command-line flag (so that it
doesn’t become a breaking change for existing config files).
Like 2. but environment variable expansion will not happen for fields
that are marked as secrets.
To give enough time for any necessary discussion and to not collide
with the holiday season, the vote will close on 2020-01-06, end of day
UTC.
Note that everybody may participate in the discussion but only
Prometheus team members can vote. According to our governance, the
vote has to be yes or no on each of the three alternatives.
Finally note that this proposal intentionally leaves out
implementation details (which syntax to use, how escaping should work,
which parts of the config files variable expansion should apply to,
how to display the config on the status page, …). We don’t need to
work these out if the vote confirms the rejection of variable
expansion in configuration files. If, however, the vote triggers an
implementation of the feature, and then the devil turns out to be in
the details, we can still rollback by another vote.
--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAMrVKsyx9fXZsLLBD8jX%2B02MOL_J%2BLkWr0t3BQY4U4Qn%3DJLUgw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAHJKeLoLsctJXx3z-3MBE8pvrx-CcpjO16JF8r-G-8RQX-GGgg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/20200107004052.GB5133%40jahnn.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAFU3N5WYS5YqiU7Zjkv153qSm3pfZ4CwJXqSUP1nV3N%3D0BFY6Q%40mail.gmail.com.