Add Claude Enterprise Analytics integration (unofficial)#3015
Open
matiasozdy wants to merge 4 commits into
Open
Add Claude Enterprise Analytics integration (unofficial)#3015matiasozdy wants to merge 4 commits into
matiasozdy wants to merge 4 commits into
Conversation
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>
This comment has been minimized.
This comment has been minimized.
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>
Contributor
|
Thanks for this, Matias! I've created DOCS-14500 for the Documentation team to take a look 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a new Agent check
claude_enterprise_analyticsto integrations-extras.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 theclaude_enterprise_analytics.namespace, covering:Also includes a 51-widget overview dashboard (Cost Overview, Token Usage, Cache Performance, Model Performance, User Analytics, Web Usage) and a
can_connectservice 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
ddev validate all claude_enterprise_analyticspasses for all integration-specific checks@matiasozdy @DataDog/ecosystems-review)Additional Notes
Three architectural choices worth flagging for reviewers:
Cost values are returned in USD cents. The API's
amountandlist_amountfields 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.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 thereport_datetag rather than relying on Datadog's wall-clock x-axis. The bundled dashboard demonstrates the pattern (query_table widgets withreport_dateas primary row dimension;.fill(last, 1200)on timeseries to handle sparse polls).amountandlist_amountare 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.