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 build_info data #52

Merged
merged 10 commits into from
May 12, 2023
Merged

Add build_info data #52

merged 10 commits into from
May 12, 2023

Conversation

keturiosakys
Copy link
Member

@keturiosakys keturiosakys 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
Collaborator

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

autometrics-dev/autometrics-py#35

@keturiosakys keturiosakys marked this pull request as ready for review May 11, 2023 08:07
@keturiosakys
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

@keturiosakys keturiosakys marked this pull request as draft May 11, 2023 08:34
@keturiosakys keturiosakys marked this pull request as ready for review May 11, 2023 08:39
@keturiosakys keturiosakys 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!

packages/autometrics-lib/src/buildInfo.ts Outdated Show resolved Hide resolved
packages/autometrics-lib/src/buildInfo.ts Outdated Show resolved Hide resolved
packages/autometrics-lib/src/wrappers.ts Show resolved Hide resolved
@keturiosakys keturiosakys merged commit 3dee484 into main May 12, 2023
@keturiosakys keturiosakys 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