Commit Graph

38 Commits

Author SHA1 Message Date
jack-berg bc6be63871
Update to otlp proto 0.17.0 (#4452) 2022-05-11 09:57:45 -05:00
jack-berg e067223409
Convert tests to from :sdk:metrics-testing to :sdk:testing (#4444) 2022-05-09 09:34:09 -05:00
jack-berg 89c6323fff
Move InMemoryMetricReader and InMemoryMetricExporter to :sdk:testing (#4442)
* Move InMemoryMetricReader and InMemoryMetricExporter to :sdk:testing

* Move tests
2022-05-06 20:00:11 -05:00
jack-berg 605f40b940
Rename MetricReader#flush() to forceFlush() (#4439) 2022-05-06 08:26:22 -05:00
jack-berg e479f15746
Add exponential histogram aggregation (#4406)
* Add ExponentialHistogramAggregation

* Rename DoubleHistogramAggregator to DoubleExplicitBucketHistogramAggregator

* PR feedback
2022-04-22 19:51:08 -05:00
Anuraag Agrawal 173a0c27fd
Have long aggregators export long exemplars (#4403)
* WIP exemplar

* Have long aggregators export long exemplars

* Fix
2022-04-22 11:18:47 +09:00
Anuraag Agrawal f464817013
Move gauge assertions into stable testing artifact. (#4395)
* Move gauge assertions into stable testing artifact.

* Disable publishing of old metrics-testing
2022-04-21 11:31:15 +09:00
jack-berg a895d7e33c
Add min and max to HistogramPointData (#4317)
* Add min and max to HistogramPointData

* Add hasMin, hasMax to HistogramPointData instead of @Nullable

* Add javadoc about describing behavior when hasMin / hasMax is false

* Get rid of @Nullable on HistogramAccumulation
2022-04-06 10:41:52 -05:00
jack-berg 423e1a2c54
Refactor MetricReader registration (#4320) 2022-03-31 10:13:17 -05:00
jack-berg 725ce32db3
Make setMinimumCollectionInterval package private (#4310)
* Make setMinimumCollectionInterval package private, centralize experimental utilities

* Default minimum collection interval to zero
2022-03-31 09:49:53 -05:00
jack-berg 21a61e5894
Change MetricExporter getPreferredTemporality to accept InstrumentType (#4288) 2022-03-24 11:25:50 -05:00
jack-berg 2c695a34f8
Simplify MetricReader (#4268)
* Simplify MetricReader

* Tighten up PR

* Restore some methods / classes and deprecate

* Revert "Restore some methods / classes and deprecate"

This reverts commit fee90e5da7.
2022-03-22 10:10:15 -05:00
jack-berg 59a6061dc5
Deprecate InstrumentationLibraryInfo (#4256)
* Deprecate InstrumentationLibraryInfo

* API diff
2022-03-14 14:45:10 -05:00
Anuraag Agrawal 26c04299d3
Make MetricData factories internal (#4257) 2022-03-11 16:30:13 +09:00
Anuraag Agrawal b0cdfdb78b
Migrate exemplar data to interface (#4253)
* Migrate exemplar data to interface

* internal
2022-03-10 12:08:38 +09:00
Anuraag Agrawal ef427f69ce
Convert ValueAtPercentile to ValueAtQuantile (#4254) 2022-03-10 11:30:20 +09:00
Anuraag Agrawal 048a0c8d14
Migrate PointData to interface (#4242) 2022-03-09 11:16:48 +09:00
Anuraag Agrawal cb80383df8
Extract SummaryData interface for DoubleSummaryData (#4224)
* Extract SummaryData interface for DoubleSummaryData

* ValueAtQuantile too

* javadoc
2022-03-04 17:20:21 +09:00
Anuraag Agrawal 17265d0b0d
Extract HistogramData interface for DoubleHistogramData. (#4219)
* Extract HistogramData interface for DoubleHistogramData.

* Fix

* javadoc

* Fix merge
2022-03-04 16:49:39 +09:00
Anuraag Agrawal 5cbfe9d93e
Move ExponentialHistogram data to internal package. (#4217)
* Move ExponentialHistogram data to internal package.

* scare

* drift
2022-03-04 11:57:40 +09:00
Anuraag Agrawal a6107d5590
Remove type-specific SumData (#4216)
* Remove type-specific SumData

* scare
2022-03-02 08:40:21 +09:00
Anuraag Agrawal 69b00c3f35
Remove type-specific GaugeData (#4207) 2022-02-25 14:08:34 +09:00
Anuraag Agrawal 66520d1f3e
Cleanup ExemplarData (#4205) 2022-02-25 12:01:35 +09:00
Mateusz Rzeszutek 96b7895173
Add DoubleHistogramPointData assertion: hasSumGreaterThan() (#4050) 2022-01-06 14:26:08 +09:00
jack-berg 6c7755698b
Remove metrics suffix from metrics testing assertj package (#4037) 2022-01-04 12:21:01 +09:00
jack-berg ca69bc2adc
Deprecate InMemoryMetricReader (#3989)
* Deprecate InMemoryMetricReader

* Revert "Deprecate InMemoryMetricReader"

This reverts commit bd4fb42084.

* Move InMemoryMetricReader to :sdk:metrics-testing, deprecate version in :sdk:metrics

* Fix build

* Combine test classes, expand coverage
2021-12-22 08:39:11 +09:00
jack-berg cbecf1f706
Move and deprecate InMemoryMetricExporter (#3987) 2021-12-14 11:51:56 +09:00
jack-berg 31d8840bf9
Fix typos in metrics-testing package (#3907) 2021-11-19 09:20:50 +09:00
James Moessis 82e2bc2630
Prototype for Exponential Histogram Aggregator (#3724)
* draft for exponential histogram aggregator

* autoscaling for exponential histogram

* more tests for exp histogram

* re-add nr copyright notice after spotlessapply deleted them; convert some comments to javadoc

* change to long index for bucketmapper

* add scale to hashCode for buckets

* implement jsuereth initial review for exphist

* move data and pointdata for exphist into data package

* replace windowedCounterArray with minimal map implementation

* use Arrays.asList() for exposing bucket counts

* remove WindowedCounterArray and MultiTypeCounterArray

* javadoc for ExponentialCounter

* implement and test merge() for exponential histogram aggregation; fix scale reduction bug

* appease spotless check

* optimize inital hashmap size for MapCounter

* merging exphist accumulation not alter original accumulation

* more tests, with a currently failing limit tester

* change map counter to be able to copy any of its interface type

* add dummy switch cases for exponential histogram exporter to appease build

* test fixes

* metrics-testing helpers for exponential histogram

* javadoc and linting

* multithreaded test on update/merge for exphist

* some cleanup

* resolve conflicts

* Update sdk/metrics-testing/src/main/java/io/opentelemetry/sdk/testing/assertj/metrics/ExponentialHistogramAssert.java

Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>

* address some review

* spotless

* add static factories to interface as per anuraag review

* use string concatenation in favour of String.format()

* address minor review comments

* make doIncrement() atomic

* change index from long to int

* refactor aggregator to align with recent Aggregator refactor

* implement diff() for exponential histogram aggregator

* add missing javadoc for metric assertions

* more javadoc for diff()

* remove unnecessary comment

* add another test for diff exphist

* spotless

* address comment regarding failure message

* metric assertions test for exponential histogram assertions

* replace warning log with IllegalStateException

* improve test coverage

* make record package private

* remove unnecessary double check to improve code cov

* add comments

Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>
2021-11-11 18:15:22 -08:00
Josh Suereth f6754b66cf
Allow exporters to influence Aggregation (#3762)
* Major refactoring to Aggregator

- Remove all state from Aggregator but for exemplar reservoir factory.
  - Reosurce/IL passed from MP/MeterSharedState
  - MetricDescriptor already stored on MetricStorage.
- Give Aggregators explicit "diff" and "merge" operations, split Sum aggregator
- Update Storage to use explicit diff/merge in appropriate locations.
- Aggregtors are now passed AggregationTemporality in as a parameter
- Update MetricStorage to take requested aggregation tempoarlity as parameter, always storing data for either.

Note: Things compile, aggregator + storage tests pass, but e2e is broken until aggregation temporality is appropriatley wired through to readers.

* Remove extraneous bits of information from AggregatorFactory interface

* Spotless + remove extraneous pieces of data from Aggregation interface.

* Added supported + preferred temprality to export interfaces.

- Add supported/preferred temporality to export interfaces
- Update tracking of collection information through internal packages to pass
  one data class instead of many individual components.

* Finish wiring configured temporality through Views.

- Update gauge tests to account for start time (as recommended in spec).
- Allow configured temporality to be null for views
- Propogate configured temporality from View API through to storage

* Fix remaining gauge tests

* Update exporters to specify desired temporality

* Other build fixes

* Fix javadoc

* add tests for cumulative+delta in temporal storage

- Add cumulative+delta tests
- Fix error messages from sum data assert

* Move diffInPlace and megeInPlace into utility class

* Add explicit test for delta vs. cumulative exporters.

* Spotless fixes

* Remove AggregatorFactory

This interface was fully replaced by Aggregation, and offerred little benefit post-refactor.

* Fixes from review

* Add javadoc for new parameters in temporal metric storage.

* Fixes from review.

* Add some unit tests for the aggregation config

* Add "diff" unit test for histogram + lastvalue

* Apply suggestions from code review

Co-authored-by: John Watson <jkwatson@gmail.com>

* Fixes from code review.

Co-authored-by: John Watson <jkwatson@gmail.com>
2021-10-26 09:39:31 -07:00
jason plumb 5aab26a0d1
Transition MetricData to an interface (#3783)
* Rename MetricData to MetricDataBuilder and extract MetaData interface

* rename abstract class and pull create methods up

* add package private constructor for consistency/safety

* move the defaults into their respective types

* rename default -> empty
2021-10-22 09:06:51 +09:00
Josh Suereth 50e2ac76c2
Exemplar data classes should match convention. (#3688)
* Fix #3535 - Exemplar data classes should match convention.

* Fix spotless issue.
2021-10-04 21:03:12 +09:00
Josh Suereth e6424654b2
Implementations of Exemplar Reservoirs (#3592)
* Initial implementation of simple ExemplarReservoirs

- Add an implementation of naive fixed-bucket reservoir sampling
- Add an implementation of FixedSizeHistogram reservoir sampling where latest-measurement per-histogram-bucket is kept.
- Add assertions for exemplars.

* Remove explicit locks for mild performance boost.

* Create a new random holder abstraction.

- Create new random holder abstraction that allows
  - ThreadLocalRandom when efficient
  - simple detection of Android + workaround for TLR
  - Overridable with mocked random for testing.
- Update tracing RandomIdGenerator to leverage new RnadomHolder
- Expand exemplar reservoir tests to use new random holder
- Remove android-only random id generator test

* Add api diff + fix silly naming thing.

* Move random hodler to be Supplier, other updates from code review.

* Fixes from review.

* Fix bytebuddy issue with mocking.

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/exemplar/AbstractFixedSizeExemplarReservoir.java

Co-authored-by: John Watson <jkwatson@gmail.com>

* Fix name from review.

* Update sdk/common/src/main/java/io/opentelemetry/sdk/internal/RandomSupplier.java

Co-authored-by: John Watson <jkwatson@gmail.com>
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-09-17 13:20:06 +09:00
jack-berg 58c16a9133
Add missing readmes and missing javadoc links (#3500) 2021-08-16 12:36:54 -07:00
Josh Suereth 0ef19291c2
Swap old Metrics API for currently specified Metrics API (#3423)
* Update the API to the latest SDK specification.

* API updates to other sdk areas.

* First half of SDK updates for API.

Passing off to other cmoputer.

* Get SDK compiling again.

* Get tests compiling again (and failing).

* Fix bad copy-paste error.

* Get all SDK tests passing.

* More fixes to builds across SDK impls.

* Remove unecessary publics

* more fixes for new API.

* spotless fixes.

* Make tests for metric points order independent.

* Restore readme.

* Fix readmes.

* Add noop meter provider tests for code coverage.

* Add code coverage for assertion library.

* Fix wierd test failure that gradle cache is preventing me from seeing locally.

* Fix javadoc/spelling comments from review.

* Remove marker interfaces.

* Switch from atomic ref to volatile.

* Fixes from review.

* Apply suggestions from code review

Co-authored-by: John Watson <jkwatson@gmail.com>

* Fixes from review.

* Fixes from review.

* Update OTLP HTTP exporter to use new metrics api

Co-authored-by: John Watson <jkwatson@gmail.com>
2021-08-05 13:58:49 -07:00
Trask Stalnaker 60c3c5ca0c
Format build.gradle.kts files (#3427) 2021-07-29 13:21:38 +09:00
Josh Suereth ae4bb364cd
Wire Exemplars into the metrics.data package (#3353)
* Add Exemplars into `metrics.data` pacakge

- Add Exemplars to match OTLP spec
- Add assertj helpers for exemplar extraction on points.

* Wire exemplar export to OTLP exporter

* Wire exemplar export to Prometheus exporter

* Add javadoc for AbstractSampledPointDataAssert

* Fixes from review.

* Fixes from review.

* Fixes from review.

* Fixes from spotless.

* Fixes froom review.

* Add clarification to javadoc from review.

* ONe last javadoc cleanup.

* Fixes to javadoc build.

* Update method name from review.

* Fixes from review.
2021-07-10 13:20:31 +09:00
Josh Suereth b12a57ed21
Migrate Metrics SDK "data' package to Attributes (#3352)
* Update java metrics data model and create assertion based testing library.

* Update existing SDK for Label => Attribute in data model

- Finish wiring through changes to all code/tests.
- DOES NOT touch API
- Update existing tests to use new testing library to be sensitive to attribute vs. label hashing alterations + equality of the metrics.data package types.

* Fix javadoc breakages

* Fix JMH compile

* Finish javadoc

* Fixes from review

* Remove botched file.

* Fixes from review.
2021-07-01 09:15:44 -07:00