Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional buildpack metrics #1657

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

- Added support for Python 3.9 on Heroku-24. ([#1656](https://github.com/heroku/heroku-buildpack-python/pull/1656))
- Added buildpack metrics for use of outdated Python patch versions and occurrences of internal errors. ([#1657](https://github.com/heroku/heroku-buildpack-python/pull/1657))
- Improved the robustness of buildpack error handling by enabling `inherit_errexit`. ([#1655](https://github.com/heroku/heroku-buildpack-python/pull/1655))

## [v258] - 2024-10-01
Expand Down
12 changes: 6 additions & 6 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ else
CACHED_PYTHON_STACK=$STACK
fi

PACKAGE_MANAGER=$(package_manager::determine_package_manager "${BUILD_DIR}")
meta_set "package_manager" "${PACKAGE_MANAGER}"
package_manager="$(package_manager::determine_package_manager "${BUILD_DIR}")"
meta_set "package_manager" "${package_manager}"

# Pipenv Python version support.
# Detect the version of Python requested from a Pipfile (e.g. python_version or python_full_version).
Expand Down Expand Up @@ -189,7 +189,7 @@ meta_time "python_install_duration" "${install_python_start_time}"
# Install the package manager and related tools.
package_manager_install_start_time=$(nowms)
bundled_pip_module_path="$(utils::bundled_pip_module_path "${BUILD_DIR}")"
case "${PACKAGE_MANAGER}" in
case "${package_manager}" in
pip)
pip::install_pip_setuptools_wheel "${bundled_pip_module_path}"
;;
Expand All @@ -199,7 +199,7 @@ case "${PACKAGE_MANAGER}" in
pipenv::install_pipenv
;;
*)
utils::abort_internal_error "Unhandled package manager"
utils::abort_internal_error "Unhandled package manager: ${package_manager}"
;;
esac
meta_time "package_manager_install_duration" "${package_manager_install_start_time}"
Expand All @@ -214,15 +214,15 @@ meta_time "sqlite_install_duration" "${install_sqlite_start_time}"

# Install app dependencies.
dependencies_install_start_time=$(nowms)
case "${PACKAGE_MANAGER}" in
case "${package_manager}" in
pip)
pip::install_dependencies
;;
pipenv)
pipenv::install_dependencies
;;
*)
utils::abort_internal_error "Unhandled package manager"
utils::abort_internal_error "Unhandled package manager: ${package_manager}"
;;
esac
meta_time "dependencies_install_duration" "${dependencies_install_start_time}"
Expand Down
1 change: 1 addition & 0 deletions bin/report
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ALL_OTHER_FIELDS=(
pre_compile_hook
pre_compile_hook_duration
python_install_duration
python_version_outdated
setup_py_only
sqlite_install_duration
total_duration
Expand Down
2 changes: 1 addition & 1 deletion bin/steps/pipenv-python-version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Detect Python-version with Pipenv.

if [[ "${PACKAGE_MANAGER}" == "pipenv" ]]; then
if [[ "${package_manager}" == "pipenv" ]]; then

if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
Expand Down
3 changes: 3 additions & 0 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function warn_if_patch_update_available() {
puts-warn "A Python security update is available! Upgrade as soon as possible to: ${latest_patch_version}"
puts-warn "See: https://devcenter.heroku.com/articles/python-runtimes"
puts-warn
meta_set "python_version_outdated" "true"
else
meta_set "python_version_outdated" "false"
fi
}

Expand Down
1 change: 1 addition & 0 deletions lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ function utils::bundled_pip_module_path() {
function utils::abort_internal_error() {
local message="${1}"
display_error "Internal error: ${message} (line $(caller || true))."
meta_set "failure_reason" "internal-error"
exit 1
}