Skip to content
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

Exporting of docker runtime variables as tags #2532

Closed
wants to merge 4 commits into from
Closed

Exporting of docker runtime variables as tags #2532

wants to merge 4 commits into from

Conversation

asinitsa
Copy link

@asinitsa asinitsa commented Mar 14, 2017

Required for all PRs:

  • CHANGELOG.md updated (we recommend not updating this until the PR has been approved by a maintainer)
  • Sign CLA (if not already signed)
  • README.md updated (if adding a new plugin)

@danielnelson
Copy link
Contributor

What about using labels? These are exported as tags by default.

@schneidexe
Copy link

schneidexe commented Mar 14, 2017

The problem with labels is, they are not easily accessible from within containers, that's why it's convenient to use ENV variables. This way if those are used as metadata by the application inside the container they are consistent with the container's metadata.

@asinitsa
Copy link
Author

@danielnelson labels are part of docker image and can not be changed on run time, but ENV variables are independent of image. Real world example: running official docker images (like nginx or mongo) in test/prod environments.

@danielnelson
Copy link
Contributor

@schneidexe
Copy link

Yes, it should. So it's more about making the metadata accessible inside the container in a consistent (and convenient) way

@schneidexe
Copy link

Also to add some background: we use docker together with Mesos and Marathon/Chronos. When using Mesos' docker containerizer it injects automagically metadata to the ENV like MARATHON_APP_ID, MESOS_TASK_ID, CHRONOS_JOB_NAME, etc. which is very valuable meta information for us on metrics.

@danielnelson danielnelson added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Mar 14, 2017
@ssorathia
Copy link
Contributor

@asinitsa

@danielnelson labels are part of docker image and can not be changed on run time, but ENV variables are independent of image.

This is not accurate. You can add labels to a docker container at run time with the --label flag to docker run. For example: docker run -ti --label my_label=my_label_values ubuntu bash If you do a docker inspect you will see the label being set at runtime.

@asinitsa asinitsa closed this Mar 21, 2017
@danielnelson
Copy link
Contributor

@asinitsa Is there a reason you closed the PR? We now have this pull request that uses a similar method #2580

@schneidexe
Copy link

Closing of this PR was an accident since the fork repo got deleted (before being moved). We can also focus on the new PR or I can re-create this PR with the code changes.

We also figured out, that besides whitelisting wanted env vars and labels it would make sense to make some hard-coded fields configurable, e.g. the containerId could have quite high cardinality causing some issues inside influxdb when used as "indexed" tag.

@danielnelson
Copy link
Contributor

The new PR has tests, so maybe we should focus on it. Do you think you could review it?

The hard-coded fields sounds like a seperate issue, unless it needs to be done along with this lets open a new issue.

@schneidexe
Copy link

Yes, sounds good. I'll have a look asap and cross-check with our version.

For the hard-coded parts I'd open another issue/PR. Just wanted to mention it here since it is kind of related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants