open-telemetry / open-telemetry/opentelemetry-python
Use customized aggregation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
Describe the solution you'd like
To easily use customised aggregation for Histogram data points like:
provider = MeterProvider(
resource=resource,
metric_readers=metric_reader_list,
views=[
View(
instrument_type=Histogram,
instrument_name="*",
aggregation=(CustomizedHistogramAggregation()),
)
],
)
Now, to be able to get my customized aggregated metrics, I have to edit the file: opentelemetry/sdk/metrics/_internal/metric_reader_storage.py
added the following after line 205 in the collect():
elif isinstance(
view_instrument_match._aggregation,
_CustomizedHistogramAggregation, # here is the customized class I added
):
data = Histogram(
data_points=data_points,
aggregation_temporality=aggregation_temporality,
)
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 in opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py, especially collect() around line 205, and trace how View aggregation types are handled. The work is done when a custom Histogram aggregation can be selected through View without editing SDK internals; the issue does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100