Skip to content

Commit ead59ac

Browse files
authored
Expose BPLOG_PREFIX to sub-shells again (#1099)
In #1011 the number of buildpack variables that are exported (and so exposed to subprocesses) was reduced, since in general we don't want to leak buildpack internals into end-user steps such as the pre/post compile hooks. However since this change, any buildpack metric emitted from within a `sub_env` wrapper (which is a buildpack-stdlib utility function) is missing its `buildpack.python` prefix. This is because buildpack-stdlib: * lazy-loads `BPLOG_PREFIX` (rather than doing so when initially sourced, which is the approach used for `BUILDPACK_LOG_FILE`) * doesn't check whether `BPLOG_PREFIX` is set before emitting metrics See: https://github.com/heroku/buildpack-stdlib/blob/v8/stdlib.sh As a stop-gap until we either fix this in buildpack-stdlib (W-8095466), or remove usages of the `sub_env` wrapper (since I think they are counter-productive in this buildpack), I've added back the export for `BPLOG_PREFIX`. Fixes @W-8095436@.
1 parent ac8fd55 commit ead59ac

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
## v183 (2020-10-12)
77

88
- Add support for Heroku-20 (#968).
9+
- Fix metric names for metrics emitted within `sub_env` (#1099).
910

1011
## v182 (2020-10-06)
1112

bin/compile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -eo pipefail
1818
# Boostrap the Buildpack Standard Library.
1919
# Disable unused env var warning since shellcheck doesn't know about the stdlib.
2020
# shellcheck disable=2034
21-
BPLOG_PREFIX="buildpack.python"
21+
export BPLOG_PREFIX="buildpack.python"
2222
export BUILDPACK_LOG_FILE=${BUILDPACK_LOG_FILE:-/dev/null}
2323

2424
[ "$BUILDPACK_XTRACE" ] && set -o xtrace

test/run-features

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ testHooks() {
116116
local expected_env_vars=(
117117
_
118118
BIN_DIR
119+
BPLOG_PREFIX
119120
BUILD_DIR
120121
BUILDPACK_LOG_FILE
121122
CACHE_DIR

0 commit comments

Comments
 (0)