Skip to content

Commit

Permalink
Prefix tag labels with __meta_ecs_tag_
Browse files Browse the repository at this point in the history
This means that they're opt in in relabel configs, rather than being applied by default
  • Loading branch information
Limess committed Apr 27, 2021
1 parent b48f46e commit a9a9ba5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ then `/opt/prometheus-ecs/default-tasks.json` will be written. This can be usefu

### Tags to labels

If `--tags-to-labels` is set, the given tags will be added to the service discovery entry as `tag_<tag>` where `<tag>` is the given tag formatted to allowed label characters if the tag exists on either the task definition or task. Task tags override the task definition tags.
If `--tags-to-labels` is set, the given tags will be added to the service discovery entry as `__meta_ecs_tag_<tag>` where `<tag>` is the given tag formatted to allowed label characters if the tag exists on either the task definition or task. Task tags override the task definition tags.

If `--tags-to-labels "*"` is provided then _all_ non aws prefixed (`AWS:` or `aws:`) tags will be added.

Expand Down
2 changes: 1 addition & 1 deletion discoverecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def discover_tasks(self):
# with leading __ reserved for internal use
tag_name = re.sub(r"[^a-zA-Z0-9_]", "_", tag_name).lstrip("_")
if tag_name != "" and not re.match(r"^[0-9]", tag_name):
job["labels"]["tag_" + tag_name] = tag_value
job["labels"]["__meta_ecs_tag_" + tag_name] = tag_value
if labels:
job["labels"].update(labels)
jobs[interval or self.default_scrape_interval_prefix].append(job)
Expand Down

0 comments on commit a9a9ba5

Please sign in to comment.