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:
Label | Environment Variables | Default | Description |
---|---|---|---|
version | AUTOMETRICS_VERSION or PACKAGE_VERSION | npm_package_version (set by npm/pnpm/yarn by default) | The version of your app |
commit | AUTOMETRICS_COMMIT or COMMIT_SHA | "" | The Git SHA-1 commit hash of your app |
branch | AUTOMETRICS_BRANCH or BRANCH_NAME | "" | The Git branch of your app |
autometrics.version | None | 1.0.0 | The version of the Autometrics spec your app is targeting. You cannot modify this value, it is hardcoded. |
service.name | AUTOMETRICS_SERVICE_NAME , OTEL_SERVICE_NAME | "" | Name of the service |
repository.url | AUTOMETRICS_REPOSITORY_URL | "" | Repository url where the source code of your app is available |
repository.provider | AUTOMETRICS_REPOSITORY_PROVIDER | "" | Repository provider for `repository.url`, e.g `github` or `gitlab` |