Uh oh!
There was an error while loading. Please reload this page.
feat: add SDK telemetry into emissions tracker - #1200
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@## master #1200 +/- ##
==========================================
+ Coverage 91.43% 91.69% +0.25%
==========================================
Files 49 54 +5 Lines 5057 5452 +395 ==========================================
+ Hits 4624 4999 +375 - Misses 433 453 +20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
davidberenstein1957
commented
Jun 17, 2026
@inimaz, before merging, we should still add the hardcoded experiment and project for the codecarbon api. |
Add CLI helper and interactive-flow tests, cover coordinate rounding in ApiClient, and extend collect environment probes to satisfy Codecov patch and project thresholds on PR #1200. Co-authored-by: Cursor <cursoragent@cursor.com>
Uh oh!
There was an error while loading. Please reload this page.
| .codecarbon.config* | ||
| scripts/agent-vm.personal.config.sh | ||
| # Added by ggshield |
There was a problem hiding this comment.
Maybe this is not needed as discussed
inimaz
left a comment
There was a problem hiding this comment.
Thanks for this PR @davidberenstein1957 . I have left some comments
| raise typer.BadParameter(str(error)) from error | ||
| def resolve_config_path(config: Optional[Path], *, create: bool = False) -> Path: |
There was a problem hiding this comment.
Maybe this is not needed. get_hierarchical_config handles it?
| # logger.info("base tracker init") | ||
| self._external_conf = get_hierarchical_config() | ||
| self._config_file_conf = get_config_file_settings() |
There was a problem hiding this comment.
Not needed
| self._config_file_conf = get_config_file_settings() |
| project_token_service: ProjectTokenService = Depends( | ||
| Provide[ServerContainer.project_token_service] | ||
| ), | ||
| x_api_token: str = Header(None), |
There was a problem hiding this comment.
does this work? Should it not be x_api_token: str = Header(None, alias="x-api-token")?
| ), | ||
| x_api_token: str = Header(None), | ||
| ) -> UUID: | ||
| project_token_service.project_token_has_access( |
There was a problem hiding this comment.
you are not doing anything with the response here, it should be if allowed--> do the action n?
| return importlib.util.find_spec(name) is not None | ||
| def _round_coordinate(value: Any) -> float | None: |
There was a problem hiding this comment.
maybe reuse the same function of _round_coordinate ApiClient so that both return the same if None.
506030a to
e102d91CompareSend product telemetry at tracker stop, with the tier resolved from config, environment, or the EmissionsTracker(telemetry_level=...) kwarg. The send runs on a daemon thread so stop() never blocks on the network, and every request of one send shares a single 2s wall-clock budget, so the extensive tier cannot cost more just because it makes two calls. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
e102d91 to
fd7a63bCompare
Summary
TelemetryClient/TelemetryCreatestack from feat: first version of telemetry #1171send_telemetry(opt-out, default on) intoBaseEmissionsTrackerandOfflineEmissionsTrackerwith once-per-session deduplicationconfto the minimal API schema (timestamp,telemetry_level, hardware/geo fields,ram_total_size_gb, etc.)Builds on PR #1171 (
feat/telemetry-backend) — intended to merge into that branch beforemaster.Test plan
uv run pytest tests/test_telemetry.py tests/test_telemetry_client.pyEmissionsTracker(send_telemetry=True)and confirmPOST /telemetryreturns 201 against local APIMade with Cursor