Skip to content

Commit

Permalink
Add buildpack_version tag to logs, traces and metrics (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
NouemanKHAL authored Jun 2, 2023
1 parent b1a3f73 commit 8f49ff0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ cp -r "${ROOT_DIR}/lib/test-endpoint.sh" "${BUILD_DIR}/.profile.d/00-test-endpoi
cp "${ROOT_DIR}/lib/run-datadog.sh" "${BUILD_DIR}/.profile.d/01-run-datadog.sh"
cp "${ROOT_DIR}/lib/redirect-logs.sh" "${BUILD_DIR}/.profile.d/02-redirect-logs.sh"

cp "${ROOT_DIR}/VERSION" "${DATADOG_DIR}/VERSION"

if [ -f "${DATADOG_DIR}/agent" ]; then
chmod +x "${DATADOG_DIR}/agent"
fi
Expand Down
2 changes: 2 additions & 0 deletions bin/supply
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ cp -r "${ROOT_DIR}/lib/test-endpoint.sh" "${BUILD_DIR}/.profile.d/00-test-endpoi
cp "${ROOT_DIR}/lib/run-datadog.sh" "${BUILD_DIR}/.profile.d/01-run-datadog.sh"
cp "${ROOT_DIR}/lib/redirect-logs.sh" "${BUILD_DIR}/.profile.d/02-redirect-logs.sh"

cp "${ROOT_DIR}/VERSION" "${DATADOG_DIR}/VERSION"

if [ -f "${DATADOG_DIR}/agent" ]; then
chmod +x "${DATADOG_DIR}/agent"
fi
Expand Down
6 changes: 6 additions & 0 deletions lib/scripts/get_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ def parse_tags(tags):
except Exception as e:
print("there was an issue parsing the tags in DD_TAGS: {}".format(e))

version_file = "/home/vcap/app/.datadog/VERSION"
if os.path.exists(version_file):
with open(version_file, 'r') as file:
buildpack_version = file.read().rstrip()
tags.append("buildpack_version:{}".format(buildpack_version))

tags = [ tag.replace(" ", "_") for tag in tags ]
tags = list(dict.fromkeys(tags))

Expand Down

0 comments on commit 8f49ff0

Please sign in to comment.