Skip to content

Conversation

laulauland
Copy link
Member

@laulauland laulauland commented May 10, 2023

Resolves #45

This update adds build_info data to the metrics exported. Whenever the first
autometrics wrapper is called it will create an object that will persisting
through the runtime and report version, commit, and branch data (depending on
what is supplied). The data can be supplied through env variables:

version: picked up automatically if the package is run through npm, yarn, or
pnpm, - can be manually supplied through PACKAGE_VERSION or AUTOMETRICS_VERSION otherwise.

commit: must be supplied through COMMIT_SHA or AUTOMETRICS_COMMIT env variable

branch: must be supplied through BRANCH_NAME or AUTOMETRICS_BRANCH env variable

The update also fixes a previous functionality that would throw an error if a
function without a name was supplied. It will now just log a warning and returns the
function early without attempting to instrument.

  • replace error throw with a log
  • add a way to register build_info data to the metrics

@brettimus
Copy link
Member

btw i did this in python today if you want to compare notes

autometrics-dev/autometrics-py#35

@laulauland laulauland marked this pull request as ready for review May 11, 2023 08:07
@laulauland
Copy link
Member Author

btw i did this in python today if you want to compare notes

autometrics-dev/autometrics-py#35

ah nice thanks! I updated the env variables to the same naming scheme

@laulauland laulauland marked this pull request as draft May 11, 2023 08:34
@laulauland laulauland marked this pull request as ready for review May 11, 2023 08:39
@laulauland laulauland removed the request for review from flenter May 11, 2023 15:12
Copy link
Member

@oscarvz oscarvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from some code style nits, lgtm!

@laulauland laulauland merged commit 3dee484 into main May 12, 2023
@laulauland laulauland deleted the build-info branch May 12, 2023 09:56
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.

Produce the build_info metric and update the queries to use it

4 participants