TypeScript
Adding version information

Adding version information to metrics in TypeScript

Autometrics makes it easy to spot versions and commits that introduce errors or latency.

It produces a build_info metric and uses labels to expose various metadata related to your app to Prometheus.

build_info{branch="main",commit="4cfd2f3b26224fa82daf4ba68fe36e188f3153ff",version="1.0.0",service_name="api",repo_url="https://github.com/autometrics-dev/autometrics-rs",repo_provider="github",autometrics_version="1.0.0"} 1

Labels are exposed and can be set as environment variables at compile or run time:

LabelEnvironment VariablesDefaultDescription
versionAUTOMETRICS_VERSION or PACKAGE_VERSIONnpm_package_version (set by npm/pnpm/yarn by default)The version of your app
commitAUTOMETRICS_COMMIT or COMMIT_SHA""The Git SHA-1 commit hash of your app
branchAUTOMETRICS_BRANCH or BRANCH_NAME""The Git branch of your app
autometrics.versionNone1.0.0The version of the Autometrics spec your app is targeting. You cannot modify this value, it is hardcoded.
service.nameAUTOMETRICS_SERVICE_NAME, OTEL_SERVICE_NAME ""Name of the service
repository.urlAUTOMETRICS_REPOSITORY_URL ""Repository url where the source code of your app is available
repository.providerAUTOMETRICS_REPOSITORY_PROVIDER ""Repository provider for `repository.url`, e.g `github` or `gitlab`