You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: populate dbt_cloud_account_identifier in telemetry events (#701)
## Summary
Populate the `dbt_cloud_account_identifier` field in telemetry events,
which was previously hardcoded to an empty string.
## What Changed
- Added `account_identifier` field to `DbtMcpSettings`
- Added `get_account()` method to `DbtAdminAPIClient` (`GET
/api/v2/accounts/{account_id}/`)
- Resolve account identifier during credential setup:
- **OAuth path**: Extract from JWT claim
`https://dbt.com/account_identifier`, falling back to Admin API
- **PAT path**: Fetch from Admin API
- Both paths degrade gracefully — if resolution fails, the field remains
empty
- Use the resolved value in the `VortexTelemetryDbtCloudContext`
telemetry event
## Why
We populate the `account_id` field rather than hardcoding an empty
string to conform to telemetry collector expectations.
## Related Issues
N/A
## Checklist
- [x] I have performed a self-review of my code
- [x] I have made corresponding changes to the documentation (in
https://github.com/dbt-labs/docs.getdbt.com) if required -- No
documentation changes needed; this is an internal telemetry change
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
## Additional Notes
**Testing evidence:**
- `task test:unit`: 469 tests passed
- `ruff check`, `ruff format`, `mypy`: all clean
Tests added:
- `test_get_account` — verifies the new Admin API client method
- `test_emit_tool_called_event_account_identifier_none` — verifies empty
string fallback when identifier is unresolved
- `test_oauth_extracts_identifier_from_jwt_claims` — verifies JWT claim
extraction
- `test_oauth_falls_back_to_admin_api` — verifies API fallback when JWT
claim is absent
- `test_pat_fetches_identifier_from_admin_api` — verifies PAT path
resolution
- `test_api_failure_does_not_break_credentials` — verifies graceful
degradation
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com>
0 commit comments