-
Couldn't load subscription status.
- Fork 0
feat: add anthropic receiver #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adds a new receiver component for collecting usage and cost metrics from the Anthropic Admin API. This component supports: - Usage metrics collection with configurable intervals and grouping - Cost metrics collection with separate configuration - Environment variable substitution for API key - Advanced configuration options for fine-tuning 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
Adds a new receiver component for collecting usage and cost metrics from the Anthropic Admin API. This component supports: - Usage metrics collection via the metrics channel (token counts, API calls) - Cost data collection via the logs channel (spending information) - Configurable collection intervals and grouping options - Environment variable substitution for API key - No default lookback windows to avoid historical data collection The receiver can be configured to group usage metrics by model, service tier, workspace ID, and API key ID, while cost data can be grouped by workspace ID and description. Status set to 'development' so it only appears with dev feature flag enabled. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add required test fixtures for the translator tests: - HPSF input configurations (with defaults and all properties) - Expected collector config outputs The tests verify that the component templates correctly generate OpenTelemetry collector configurations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
As a general note about the receiver, I recommend following contrib's scrape pattern wherever possible. If we can add a metadata.yaml and use it to define the metrics and then use mdatagen to generate the metricsbuilder from the metadata.yaml we'll gain a lot of confidence in the component. |
|
Do you have an example of this? Given that the API shape is a bit unique, I'm not sure how much we can re-use existing stuff. |
|
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/kubeletstatsreceiver is a good scrape example of using mdatagen to control the metric accumulation but not the api calls. |
|
ok - please take a look at the updates i've made to https://github.com/honeycombio/anthropic-usage-receiver |
- Add missing filter properties (models, service_tiers, workspace_ids, api_key_ids) - Update usage_bucket_width description to document valid values (1m, 1h, 1d) - Change cost_lookback_window default from 0s to 7d to match receiver defaults - Add template mappings for new filter properties with conditional inclusion
…om template - Update cost_lookback_window default in test expectation file to match new 7d default - Remove optional filter fields from template output (models, service_tiers, workspace_ids, api_key_ids) as they should only appear when explicitly set by the user
- Rename parameter from collection_interval to usage_collection_interval to clearly distinguish it from cost_collection_interval - Update template mapping to use the new parameter name - Update test files to use the new parameter name
- Move usage.collection_interval to be under the usage config section - Remove root-level collection_interval as it's now part of UsageConfig - Update test expectations to match new structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you manually test this config in a collector to confirm it works?
This adds a new component for the anthropic receiver.