RFE: Add support for OpenTelemetry metrics and tracing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 323
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 12
Description
Description
This RFE (Request for Enhancement) is to add the ability for codecarbon to allow collection of OpenTelemetry traces and correlation with codecarbon metrics. See
https://opentelemetry.io/docs/specs/otel/metrics/
This will allow existing codecarbon users to view codecarbon metrics alongside their regular observability tools such as Jaeger, Honeycomb etc. (thanks to the OpenTelemetry standard). This allows per-trace carbon tracking with additional context in addition to trend analysis.
Proposed Implementation
The proposed implementation is to follow a similar pattern to the Prometheus feature:
- Add
save_metrics_to_otelandsave_traces_to_otelflags to thetrack_emissionsdecorator. These flags will govern if full traces are collected along with metrics and persisted in the OpenTelemetry collector. - Allow configuration of OTel Collector
I will add a more detailed technical proposal and MR if you agree this is a feature worth implementing. I'm very open to discussion and ideas, and look forward to contributing in this space.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing Prometheus feature and the track_emissions decorator, which the issue identifies as the implementation pattern. Define the OpenTelemetry collector configuration and the required metrics and trace behavior; done means the proposed flags support collection and persistence with trace correlation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100