Skip to content

Add Claude Enterprise Analytics integration (unofficial)#3015

Open
matiasozdy wants to merge 4 commits into
DataDog:masterfrom
matiasozdy:feat/add-claude-enterprise-analytics
Open

Add Claude Enterprise Analytics integration (unofficial)#3015
matiasozdy wants to merge 4 commits into
DataDog:masterfrom
matiasozdy:feat/add-claude-enterprise-analytics

Conversation

@matiasozdy
Copy link
Copy Markdown

What does this PR do?

Adds a new Agent check claude_enterprise_analytics to integrations-extras.

Unofficial integration. This is a community-maintained check by the Typeform Platform team. Not affiliated with, endorsed by, or supported by Anthropic, PBC. "Anthropic" and "Claude" are trademarks of Anthropic, PBC. Happy to revise the tile name or any branding language if reviewers prefer.

The check polls the Anthropic Claude Enterprise Analytics API across six endpoints (/summaries, /users, /usage_report, /cost_report, /user_usage_report, /user_cost_report) and submits 45 gauges under the claude_enterprise_analytics. namespace, covering:

  • Org-wide DAU/WAU/MAU, assigned seats, adoption rates
  • Per-user activity (chat, Claude Code sessions/commits/PRs/lines, web search)
  • Token volumes broken down by model + product + context_window (uncached input, output, cache read, cache write 1h/5m)
  • Per-model and per-user USD cost (list price; see Additional Notes)
  • Claude Code tool acceptance rate (Edit / MultiEdit / Write / NotebookEdit, accepted vs rejected)

Also includes a 51-widget overview dashboard (Cost Overview, Token Usage, Cache Performance, Model Performance, User Analytics, Web Usage) and a can_connect service check.

Motivation

Anthropic launched the Enterprise Analytics API in mid-2025, but there is no first-party Datadog integration. Enterprise customers running Claude (especially Claude Code) want this data inside their existing observability stack for cost attribution, seat utilization, and adoption signals. We built this internally at Typeform and figured it'd be useful enough to others on the same tier to be worth contributing.

Review checklist

  • PR has a meaningful title
  • Feature has tests (5 unit tests; HTTP layer mocked at the client class)
  • Git history is clean (single squash-friendly commit)
  • ddev validate all claude_enterprise_analytics passes for all integration-specific checks
  • README has the unofficial disclaimer prominently at top
  • CODEOWNERS entry added (@matiasozdy @DataDog/ecosystems-review)

Additional Notes

Three architectural choices worth flagging for reviewers:

  1. Cost values are returned in USD cents. The API's amount and list_amount fields are strings in the smallest currency subunit (verified empirically by cross-checking the Anthropic web spend dashboard). The mapper divides by 100 before submission. README and metadata.csv reflect dollars.

  2. All metrics submit at agent wall-clock time, tagged with report_date:YYYY-MM-DD. Anthropic's analytics have a ~3-day aggregation lag and Datadog rejects backdated points >1h old, so timestamping at the activity date isn't an option. Dashboards group/filter by the report_date tag rather than relying on Datadog's wall-clock x-axis. The bundled dashboard demonstrates the pattern (query_table widgets with report_date as primary row dimension; .fill(last, 1200) on timeseries to handle sparse polls).

  3. amount and list_amount are equal in every API response we've seen. Enterprise discounts aren't surfaced through this API, so cost figures reflect list-priced compute consumption, not actual invoices. README is explicit about this; treating the cost data as a relative attribution signal rather than a billing source.

Happy to address any concerns about naming, scope, or the disclaimer placement.

Unofficial community check that polls the Anthropic Claude Enterprise
Analytics API (https://support.claude.com/en/articles/13703965) for daily
usage, cost, and seat-utilization data and submits 45 gauges under the
`claude_enterprise_analytics.` namespace.

Highlights:
- Six endpoints polled per collection interval: /summaries, /users,
  /usage_report, /cost_report, /user_usage_report, /user_cost_report
- Per-user cost attribution, model/product breakdowns, Claude Code activity
  (sessions, commits, PRs, lines, tool acceptance), token mix and cache hit
  rate, web search usage
- Includes a 51-widget overview dashboard (Cost Overview, Token Usage,
  Cache Performance, Model Performance, User Analytics, Web Usage)
- `can_connect` service check

Architectural notes documented in the README:
- Anthropic data has a ~3-day aggregation lag; every metric carries a
  `report_date:YYYY-MM-DD` tag and is submitted at agent wall-clock time.
- Cost amounts are returned by the API in USD cents and divided by 100
  before submission.
- The API exposes only list-priced compute consumption (amount == list_amount
  in every response); actual enterprise invoices will differ.

Disclaimer: unofficial integration; not affiliated with Anthropic, PBC.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@datadog-prod-us1-6

This comment has been minimized.

@matiasozdy matiasozdy marked this pull request as ready for review May 22, 2026 10:37
@matiasozdy matiasozdy requested review from a team as code owners May 22, 2026 10:37
matiasozdy and others added 3 commits May 22, 2026 12:39
CI flagged `Linting failed... Run 'ddev test --fmt'`. Locally that:
- reformatted 4 files via `ruff format --config ../pyproject.toml`
- removed the unused `date` import from `_anthropic_client.py`

5/5 unit tests still pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov 75% gate was failing at 60%. Added:
- Mapper unit tests for from_users, from_usage_report,
  from_user_usage_report, from_user_cost_report and the _num/_g/_tag helpers
- AnthropicAnalyticsClient tests covering: URL/header construction,
  empty-summary handling, cursor pagination via `?page=`, group_by[] params
  for /usage_report+/cost_report, 429-retry path with mocked time.sleep
- check.py tests for the CRITICAL service-check path (when client raises)
  and instance-tag propagation onto every emitted gauge

Per-module coverage after:
- _mappers.py:           100%
- check.py:              100%
- _anthropic_client.py:   87%
- TOTAL:                  94%

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Three errors from the @datadog-assets CI pipeline:

1. tile.description was 162 chars; max is 120. Trimmed to 107.
2. classifier_tags included `Category::SaaS` which isn't in Datadog's
   approved category list. Removed.
3. Top-level `owner` field is required (the `ddev create` template omits
   it, but every extras manifest has it). Added the canonical
   `integrations-developer-platform` value used by anecdote/dagster/akamas
   and the other recent third-party submissions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@janine-c janine-c added the editorial review Waiting on a more in-depth review from a docs team editor label May 25, 2026
@janine-c
Copy link
Copy Markdown
Contributor

Thanks for this, Matias! I've created DOCS-14500 for the Documentation team to take a look 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editorial review Waiting on a more in-depth review from a docs team editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants