Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Exemplar: Refactor to be under metrics.data. #1791

Merged
merged 4 commits into from
Mar 13, 2019

Conversation

songy23
Copy link
Contributor

@songy23 songy23 commented Mar 7, 2019

Blocked by #1779.

@codecov-io
Copy link

codecov-io commented Mar 7, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@b47f070). Click here to learn what that means.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1791   +/-   ##
=========================================
  Coverage          ?   83.81%           
  Complexity        ?     2029           
=========================================
  Files             ?      294           
  Lines             ?     9227           
  Branches          ?      891           
=========================================
  Hits              ?     7734           
  Misses            ?     1177           
  Partials          ?      316
Impacted Files Coverage Δ Complexity Δ
...ava/io/opencensus/metrics/export/Distribution.java 96.96% <ø> (ø) 7 <0> (?)
...trib/exemplar/util/AttachmentValueSpanContext.java 100% <ø> (ø) 3 <0> (?)
.../src/main/java/io/opencensus/stats/MeasureMap.java 40% <ø> (ø) 2 <0> (?)
...io/opencensus/implcore/stats/MeasureToViewMap.java 94.93% <ø> (ø) 28 <0> (?)
.../opencensus/implcore/stats/MeasureMapInternal.java 90.32% <ø> (ø) 4 <0> (?)
...java/io/opencensus/implcore/stats/MetricUtils.java 83.72% <ø> (ø) 8 <0> (?)
...ain/java/io/opencensus/common/AttachmentValue.java 100% <ø> (ø) 1 <0> (?)
...pencensus/contrib/exemplar/util/ExemplarUtils.java 100% <ø> (ø) 3 <0> (?)
...a/io/opencensus/implcore/stats/IntervalBucket.java 100% <ø> (ø) 11 <0> (?)
...main/java/io/opencensus/stats/AggregationData.java 97.43% <ø> (ø) 0 <0> (?)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b47f070...b12cc3d. Read the comment docs.

@songy23 songy23 changed the title [WIP] Exemplar: Refactor to be under common. Exemplar: Refactor to be under common. Mar 8, 2019
@songy23 songy23 requested a review from bogdandrutu March 8, 2019 17:23
@songy23
Copy link
Contributor Author

songy23 commented Mar 8, 2019

Rebased and updated. The reasons for making this change:

  1. By its nature Exemplar is a correlation between multiple signals (histogram and trace in our case). IMO it doesn't belong to an existing signal. We already made Exemplar an independent package in Go.
  2. Exemplar and its Attachments are required at both recording time and exporting time. For recording we have stats package and for exporting we have metrics. We don't want stats and metrics APIs to have dependency on each other to avoid circular dependency. Therefore previously we have two identical implementations of Exemplar: stats.AggregationData.Exemplar and metrics.export.Distribution.Exemplar. This doesn't work if we were to use one consistent Exemplar for both recording and exporting.

Thus I proposed to extract Exemplar to common package so that both stats and metrics packages can depend on it. Note this is a breaking change to those who use the current Exemplar APIs.

@bogdandrutu
Copy link
Contributor

I think we are moving to the model where stats is just for recording and not for exporting (currently all our exporters are now using Metric no more ViewData). Probably we should remove the ViewData, hence we will remove the AggregationData.

So I think we should work to remove the ViewData and AggregationData, so that will remove the duplicated code.

@songy23
Copy link
Contributor Author

songy23 commented Mar 11, 2019

So I think we should work to remove the ViewData and AggregationData, so that will remove the duplicated code.

But still we need AttachmentValue in both recording APIs and exporting APIs:

statsRecorder.newMeasureMap().put(m, v).putAttachment(key, attachmentValue).record();
...
metricProducer.getMetrics().get(0)...getDistribution().getExemplars().get(0).getAttachments();

so the only viable option I saw here is still to extract it to a common artifact.

@bogdandrutu
Copy link
Contributor

For the common types that we need during recording as well as exporting I suggest we do what Go does for metrics and add a "data" sub-package. stats, metrics and metrics.exporter can depend on metrics.data.

@songy23
Copy link
Contributor Author

songy23 commented Mar 11, 2019

I suggest we do what Go does for metrics and add a "data" sub-package. stats, metrics and metrics.exporter can depend on metrics.data.

OK that makes sense to me. I'll post a separate PR for adding that package first.

@songy23 songy23 added this to the Release 0.20.0 milestone Mar 13, 2019
@songy23 songy23 changed the title Exemplar: Refactor to be under common. Exemplar: Refactor to be under metrics.data. Mar 13, 2019
@songy23
Copy link
Contributor Author

songy23 commented Mar 13, 2019

4eea6a2 moved Exemplar and AttachmentValue to metrics.data so that both stats and metrics packages can depend on it. PTAL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants