Skip to content

Commit

Permalink
Merge pull request #376 from DataDog/ara.pulido/improve_tagging
Browse files Browse the repository at this point in the history
[COMM-445] Only use DD_TAGS for tagging
  • Loading branch information
arapulido authored Jul 15, 2024
2 parents 5a49b88 + 87bd37d commit 0d07931
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions extra/datadog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -301,26 +301,16 @@ fi
if [ -n "$DD_TAGS" ]; then
DD_TAGS_NORMALIZED="$(sed "s/,[ ]\?/\ /g" <<< "$DD_TAGS")"
DD_TAGS="$DYNO_TAGS $DD_TAGS_NORMALIZED"
DD_TAGS_NORMALIZED_YAML="$(sed 's/\//\\\//g' <<< "$DD_TAGS_NORMALIZED")"
else
DD_TAGS="$DYNO_TAGS"
fi

export DD_VERSION="$DD_VERSION"
export DD_TAGS="$DD_TAGS"
if [ "$DD_LOG_LEVEL_LOWER" == "debug" ]; then
echo "[DEBUG] Buildpack normalized tags: $DD_TAGS_NORMALIZED"
echo "[DEBUG] Buildpack normalized tags to yaml: $DD_TAGS_NORMALIZED_YAML"
echo "[DEBUG] Buildpack normalized tags: $DD_TAGS"
fi

DD_TAGS_YAML="tags:\n - $(sed 's/\ /\\n - /g' <<< "$DD_TAGS_NORMALIZED_YAML")"

# Inject tags after example tags.
# Config files for agent versions 6.11 and earlier:
sed -i "s/^# - role:database$/# - role:database\n$DD_TAGS_YAML/" "$DATADOG_CONF"
# Agent versions 6.12 and later:
sed -i "s/^\(## @param tags\)/$DD_TAGS_YAML\n\1/" "$DATADOG_CONF"

# Export host type as dyno
export DD_HEROKU_DYNO="true"

Expand Down

0 comments on commit 0d07931

Please sign in to comment.