opentelemetry-ruby icon indicating copy to clipboard operation
opentelemetry-ruby copied to clipboard

feat: add basic metrics view

Open xuan-cao-swi opened this issue 1 year ago • 6 comments
trafficstars

Description

I'd like to contribute on metrics view. I think view will be helpful for customized aggregation over default aggregation on instrumenting metrics.

  1. Changed the location of data_points to metric_stream, because I think aggregation should act as aggregator that provide transformative (on data_points) feature rather than storage feature.
  2. Didn't implement the logic for conflicting metric identities. For current implementation, it will export all the metrics with different aggregation if the metric_stream has multiple views applied.
  3. Need schema_url as part of instrumentation selection. https://github.com/open-telemetry/opentelemetry-ruby/pull/1237

xuan-cao-swi avatar Feb 22 '24 19:02 xuan-cao-swi

👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot

github-actions[bot] avatar Mar 24 '24 01:03 github-actions[bot]

As a continuation from our discussion during the SIG on July 9, 2024:

I was experimenting with this branch to create an explicit bucket histogram with custom buckets. It worked great! Thank you for building this!

The only error I've encountered was while exporting the metrics via OTLP. The structure of the metrics object passed as an argument to the export method has changed.

Before:

Array[MetricData, MetricData]

In this branch:

Array[[MetricData],[MetricData]]

We could handle this in the exporter, but it may be preferable to go back to the original structure. As far as I can see in the spec, it just needs to be some kind of list, so either way seems compliant.

kaylareopelle avatar Jul 10 '24 23:07 kaylareopelle

Thanks for catching it. I use flatten! to ensure it return [MetricData]. I remembered that I made this mistake while I was thinking about the case for multiple view for one metric stream.

xuan-cao-swi avatar Jul 15 '24 17:07 xuan-cao-swi

Thanks for catching it. I use flatten! to ensure it return [MetricData]. I remembered that I made this mistake while I was thinking about the case for multiple view for one metric stream.

Thanks for the fix! What else did you want to accomplish before moving the PR out of draft mode?

kaylareopelle avatar Jul 16 '24 22:07 kaylareopelle

Not in my current mind. I will open it for review

xuan-cao-swi avatar Jul 17 '24 14:07 xuan-cao-swi

Thanks @kaylareopelle, I updated the suggestions. I didn't do commit the suggestions on the github page to avoid github freeze on my browser and create commit issue (I had bad experience last time click each Commit suggestion).

xuan-cao-swi avatar Jul 22 '24 22:07 xuan-cao-swi