Claude Code telemetry
Count the commits Claude Code makes as AI-assisted, by sending its OpenTelemetry logs to Prodgator.
Availability
Claude Code can report each commit it makes. When you send those reports to Prodgator, a commit that Claude Code made counts as AI-assisted for the pull requests and deployments that contain it, even when the commit has no trailer. Prodgator records this as the signal , next to the other signals described in AI-assisted changes.
What is kept
For each commit Claude Code reports, Prodgator keeps:
- the commit SHA, branch and repository
- a hashed session id (the original id is not kept)
- the time of the record
- the Claude Code version
Records are deleted after 90 days.
What is never kept: prompts, responses, shell commands, tool inputs, file contents, email addresses and account ids. Prodgator drops every record that is not a Claude Code tool result for a successful commit. If you use the Collector setup below, the other attributes never leave your network at all.
Set it up
1. Create an API key
In Admin Console > API keys, create a key with the scope . A key with this scope cannot carry any other scope. Make one key for each source, for example one for each Collector, so a leaked key is easy to find and revoke. See API keys.
2a. Send through your OpenTelemetry Collector (recommended)
The Collector keeps only the records Prodgator reads and removes everything else before it leaves your network. It needs the OpenTelemetry Collector contrib distribution, which includes the and processors. Set in the Collector's environment to the key from step 1.
Collector config:
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
batch: {}
# Keep only Claude Code tool results that report a commit.
filter/prodgator:
error_mode: ignore
logs:
log_record:
- 'attributes["event.name"] != "tool_result" and attributes["event.name"] != "claude_code.tool_result"'
- 'attributes["vcs.ref.head.revision"] == nil'
- 'attributes["success"] != "true" and attributes["success"] != true'
# Drop every attribute Prodgator does not read.
transform/prodgator:
error_mode: ignore
log_statements:
- context: log
statements:
- keep_keys(attributes, ["event.name", "success", "session.id", "app.version", "vcs.ref.head.revision", "vcs.ref.head.name", "vcs.ref.head.type", "vcs.provider.name", "vcs.owner.name", "vcs.repository.name"])
- set(body, "tool_result")
- context: resource
statements:
- keep_keys(attributes, ["service.name", "vcs.provider.name", "vcs.owner.name", "vcs.repository.name"])
exporters:
otlphttp/prodgator:
logs_endpoint: https://api.prodgator.io/api/ingest/otlp/v1/logs
encoding: json
compression: gzip
headers:
Authorization: "Bearer ${env:PRODGATOR_API_KEY}"
service:
pipelines:
logs/prodgator:
receivers: [otlp]
processors: [filter/prodgator, transform/prodgator, batch]
exporters: [otlphttp/prodgator]Then set Claude Code's managed settings to send logs to your Collector. Replace the URL with your Collector's address:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "http://otel-collector.example.internal:4318/v1/logs",
"OTEL_LOG_TOOL_DETAILS": "1",
"OTEL_METRICS_INCLUDE_REPOSITORY": "true"
}
}2b. Send straight from Claude Code
Without a Collector, Claude Code sends its logs to Prodgator directly. Put this in Claude Code's managed settings, with your key in place of the placeholder:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://api.prodgator.io/api/ingest/otlp/v1/logs",
"OTEL_EXPORTER_OTLP_LOGS_HEADERS": "Authorization=Bearer <your write:ai-telemetry API key>",
"OTEL_LOG_TOOL_DETAILS": "1",
"OTEL_METRICS_INCLUDE_REPOSITORY": "true"
}
}Managed settings override a person's own settings, and only an administrator can change them (see Claude Code settings). Only logs go to Prodgator. Your metrics and traces settings stay as they are.
Requirements for both options:
- Claude Code 2.1.269 or later.
- , so commit tool results include the commit details.
- , so records name the repository.
- The protocol. Prodgator does not accept protobuf yet.
3. Check the counts, then turn it on
Commit with Claude Code on a machine that has the managed settings. In Admin Console > AI > AI-assisted changes, the Claude Code telemetry section shows the last 7 days: records received, kept, and dropped by reason. Records are counted while Use Claude Code telemetry is off, but they only count as AI-assisted once you turn it on. When the counts look right, turn it on and save.
Troubleshooting
Records that Prodgator drops are counted by reason:
| Reason | What it means | What to do |
|---|---|---|
| The record is not a Claude Code tool result for a commit. | Normal for most records on the direct path. If every record is dropped, check and the Claude Code version. | |
| Claude Code reported an abbreviated SHA, which happens when the commit is not the HEAD of the session's working directory (for example a commit in another repository). | None: these commits cannot be matched. Commit trailers still count. | |
| The commit command failed, so no commit was made. | None. | |
| The record could not be read. | Check that the Collector config is unchanged and the protocol is . | |
| One request held more than 5,000 records or more than 50 commits. | Send smaller batches, for example a lower on the Collector's processor. | |
| Your organization reached 20,000 reported commits in one UTC day. | Check that no key is sending made-up data. The count starts again at midnight UTC. |
Response codes from the endpoint:
| Code | Meaning |
|---|---|
| 200 | Received. This is also the answer when some or all records were dropped. |
| 401 | The API key is missing, wrong, revoked or expired. |
| 403 | The key does not have the scope, or the plan does not include it. |
| 413 | The request is too large: the limit is 1 MB compressed and 2 MB uncompressed. Send smaller batches. |
| 415 | The body is not JSON. Protobuf is not supported yet: use . |
| 429 | More than 1200 requests per minute for your organization. Wait for the number of seconds in the header. |
What it misses
Claude Code telemetry only sees commits that Claude Code makes. It does not see:
- commits you make by hand after Claude edited the files
- commits rewritten later by a rebase or an amend, which get new SHAs
- local squashes, which also create a new SHA
- machines that do not have the managed settings
Use commit trailers and labels to cover those cases.