Skip to content

Expose BPLOG_PREFIX to sub-shells again#1099

Merged
edmorley merged 1 commit intomainfrom
fix-metric-prefix
Oct 15, 2020
Merged

Expose BPLOG_PREFIX to sub-shells again#1099
edmorley merged 1 commit intomainfrom
fix-metric-prefix

Conversation

@edmorley
Copy link
Copy Markdown
Member

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.

@edmorley edmorley self-assigned this Oct 15, 2020
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@.
@edmorley edmorley marked this pull request as ready for review October 15, 2020 14:22
@edmorley edmorley requested a review from a team as a code owner October 15, 2020 14:22
@edmorley edmorley merged commit ead59ac into main Oct 15, 2020
@edmorley edmorley deleted the fix-metric-prefix branch October 15, 2020 14:31
edmorley added a commit that referenced this pull request Oct 19, 2020
The changelog entries for #1099 and #1100 were added to the previous
release section (rather than the "unreleased" section) by mistake.
edmorley added a commit that referenced this pull request Oct 19, 2020
The changelog entries for #1099 and #1100 were added to the previous
release section (rather than the "unreleased" section) by mistake.
dryan pushed a commit to dryan/heroku-buildpack-python that referenced this pull request Nov 19, 2020
In heroku#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@.
dryan pushed a commit to dryan/heroku-buildpack-python that referenced this pull request Nov 19, 2020
The changelog entries for heroku#1099 and heroku#1100 were added to the previous
release section (rather than the "unreleased" section) by mistake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants