You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to tag all metrics exported by Envoy with a tag unique to that instance. This tag would allow me to isolate metrics to debug an instance. The tag value would be based on a command line argument (e.g. --service-node) or environment variable so that each Envoy instance could share a config file.
I'll take this one. I'm just thinking using environment variable will be more extendable way and won't change current behavior until specified the same config as before. So how about adding new field to TagSpecifier message:
Then Envoy will getenv with the env var and add the returned value. If no tag_value is specified, find from TagNames and add default regex for backward compat (current behavior).
I feel environment_variable is a little bit log name, so want comments about it. env_var might be better?
@taiki45 this sounds reasonable to me, but if we are going to add additional tag filling options, I would also support direct string add in addition to pull from env variable. I think some (most?) people would just specify the fixed tag directly in the config.
If this uses an environment variable, I believe this would be the first case that envoy looks at the environment at all. I think it would be preferable to put it in the config or on the commandline, for consistency with how everything else in envoy is configured.
Initially I had the same reaction about env vars as @ggreenway did, but then I thought about it and I'm OK with it if people want it. I think in certain cases supporting env var interpolation might be convenient for people. This case comes to mind, as does logging/dynamic headers.
I don't really feel strongly about it though if there is strong objection. I think as long as it is clearly documented it's fine either way.
For consistency, I actually slightly felt the same thing when I thought about error handling of missing environment variables: since Envoy has put configuration in the config file or on the commandline, the missing environemnt variables error might be a little bit confusing.
Then I'm thinking about passing default tags as commandline args like --stats-tag=service_cluster:local --stats-tag=my_tag:a. With it, uses can use the same configuration for different Envoy instances (this issue requires), and it can accept arbitrary tags.
We might use env var interpolation in other cases, but in my current opinion, supporting universal tags with commandline args is better way in this case. WDYT? Please tell me if I missed the downside of this. Maybe commandline args can be long sometimes, but I don't think it can be a problem in most cases (not certainly).
Sure, CLI SGTM and per @ggreenway I think fits better with that Envoy typically does. If this works for you we can skip env var until if/when someone really needs it. If you add the CLI support, the values can just be passed to the stats store on startup.
@jmarantz the scenario that I am looking at we have envoy deployed into a set of machines and all the envoys are statically configured and they dont talk to an XDS server.
We want to tag Envoy stats with the machine name for filtering purposes. This machine name is an environment variable.
AFAICT the existing framework does not support this because the config.metrics.v3.TagSpecifier only supports a fixed value.
edit: the env variable can be easily passed to envoy as a CLI argument so I am not making a case for env variables over cli params.
FWIW, I accomplish the same thing by running the bootstrap config through envsubst before starting Envoy. The advantage of this approach is that you can change anything in the config without requiring an envoy change for each one.
I was also thinking of a similar approach as a backup but the environment I am work on does not have envsubst so I will have to write a script to do the replacement.
Thinking that this might be the case for multiple users, it makes sense to me to have envoy do this for all users.
The advantage of this approach is that you can change anything in the config without requiring an envoy change for each one.
Agree on that. For now, I only have the tagging requirement.
Activity
taiki45 commentedon Dec 20, 2017
I'll take this one. I'm just thinking using environment variable will be more extendable way and won't change current behavior until specified the same config as before. So how about adding new field to TagSpecifier message:
Then Envoy will getenv with the env var and add the returned value. If no tag_value is specified, find from TagNames and add default regex for backward compat (current behavior).
I feel
environment_variableis a little bit log name, so want comments about it.env_varmight be better?mattklein123 commentedon Dec 21, 2017
@taiki45 this sounds reasonable to me, but if we are going to add additional tag filling options, I would also support direct string add in addition to pull from env variable. I think some (most?) people would just specify the fixed tag directly in the config.
@mrice32 WDYT?
taiki45 commentedon Dec 21, 2017
@mattklein123 I'm also thinking about supporting fixed string or not. I'll do that.
mrice32 commentedon Dec 21, 2017
@mattklein123 absolutely. At Google, we will use the fixed string in the config rather than the environment variable. Thanks, @taiki45!
ggreenway commentedon Dec 21, 2017
If this uses an environment variable, I believe this would be the first case that envoy looks at the environment at all. I think it would be preferable to put it in the config or on the commandline, for consistency with how everything else in envoy is configured.
mattklein123 commentedon Dec 21, 2017
Initially I had the same reaction about env vars as @ggreenway did, but then I thought about it and I'm OK with it if people want it. I think in certain cases supporting env var interpolation might be convenient for people. This case comes to mind, as does logging/dynamic headers.
I don't really feel strongly about it though if there is strong objection. I think as long as it is clearly documented it's fine either way.
taiki45 commentedon Dec 22, 2017
For consistency, I actually slightly felt the same thing when I thought about error handling of missing environment variables: since Envoy has put configuration in the config file or on the commandline, the missing environemnt variables error might be a little bit confusing.
Then I'm thinking about passing default tags as commandline args like
--stats-tag=service_cluster:local --stats-tag=my_tag:a. With it, uses can use the same configuration for different Envoy instances (this issue requires), and it can accept arbitrary tags.We might use env var interpolation in other cases, but in my current opinion, supporting universal tags with commandline args is better way in this case. WDYT? Please tell me if I missed the downside of this. Maybe commandline args can be long sometimes, but I don't think it can be a problem in most cases (not certainly).
mattklein123 commentedon Dec 22, 2017
Sure, CLI SGTM and per @ggreenway I think fits better with that Envoy typically does. If this works for you we can skip env var until if/when someone really needs it. If you add the CLI support, the values can just be passed to the stats store on startup.
stats: docs for new --stat-tag cli arg (#361)
Update Envoy SHA. (envoyproxy#1975)
5 remaining items
davinci26 commentedon Sep 27, 2021
@jmarantz the scenario that I am looking at we have envoy deployed into a set of machines and all the envoys are statically configured and they dont talk to an XDS server.
We want to tag Envoy stats with the machine name for filtering purposes. This machine name is an environment variable.
AFAICT the existing framework does not support this because the config.metrics.v3.TagSpecifier only supports a fixed value.
edit: the env variable can be easily passed to envoy as a CLI argument so I am not making a case for env variables over cli params.
ggreenway commentedon Sep 27, 2021
FWIW, I accomplish the same thing by running the bootstrap config through
envsubstbefore starting Envoy. The advantage of this approach is that you can change anything in the config without requiring an envoy change for each one.davinci26 commentedon Sep 27, 2021
I was also thinking of a similar approach as a backup but the environment I am work on does not have
envsubstso I will have to write a script to do the replacement.Thinking that this might be the case for multiple users, it makes sense to me to have envoy do this for all users.
Agree on that. For now, I only have the tagging requirement.
davinci26 commentedon Sep 28, 2021
Is there any concern if I go ahead and implement this feature?
stats: Add universal stats tag from CLI (#18668)
stats: docs for new --stat-tag cli arg (#361)