Tag OpenTelemetry data with repository info
CHANGELOG · original
Added OTEL_METRICS_INCLUDE_REPOSITORY to tag OpenTelemetry metrics and events with vcs.* repository attributes; commit events get vcs.ref.head.* with OTEL_LOG_TOOL_DETAILS Open official changelog ↗ Documentation
Documentation excerpt
Repository attributes
Set OTEL_METRICS_INCLUDE_REPOSITORY=true to tag metrics and events with the identity of the session's repository, so a shared collector can attribute usage per repository. Requires Claude Code v2.1.269 or later.
Claude Code derives these attributes once per session from the repository's origin remote. When the HTTPS and SSH remotes of a repository name the same host and the same path, as they do on GitHub, GitLab, and Bitbucket Cloud, both produce identical values:
| Attribute | Value |
|---|---|
vcs.repository.url.full |
The repository's browser URL without .git, such as https://github.com/example-org/example-repo |
vcs.owner.name |
The owner or group path, such as example-org; omitted when the remote path has a single segment |
vcs.repository.name |
The bare repository name, such as example-repo |
vcs.provider.name |
github, gitlab, bitbucket, or gitea when Claude Code recognizes the remote's host or URL shape as one of those providers; omitted otherwise |
Values are lowercased, and credentials, query strings, and fragments from the remote URL never appear in them. The attributes are omitted when the session has no origin remote, when the remote isn't URL-shaped, or when the only enclosing repository is your home directory.
To get these attributes from a cloud session, set the telemetry variables, including OTEL_METRICS_INCLUDE_REPOSITORY, on its cloud environment. Also allow your collector's domain in the environment's network access.
A vcs.* key you declare in OTEL_RESOURCE_ATTRIBUTES replaces the derived value for that key. If you declare vcs.repository.url.full, Claude Code never reads the remote and reports only the keys you declare.
If HTTPS and SSH clones of one repository report different values, such as on a self-hosted install whose HTTPS clone URL carries a path prefix the SSH URL lacks, declare vcs.repository.url.full in OTEL_RESOURCE_ATTRIBUTES along with every other vcs.* key you want reported. Every clone then reports the identity you declare.
The attributes flow only to your own exporters; Anthropic's telemetry drops every vcs.* key.
Documentation snapshot · 2026-11-20