* 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>
* backfill test coverage for MetricStorageUtils
* rename for consistency
* code review comments
* clarity around diff/merge in results
* more private. more static.
* make public again so errorprone doesn't table flip
* fix test after rebase
* factor out duplicate code
* Drop stale streams, make metrics minimum collection interval configurable
* Limit number of accumulations in async and sync metric storage
* PR feedback
* Allow the clock to be overridden so that we aren't directly coupled to System.currentTimeMillis()
* move clock usage to dedicated test
* move clock foolery to its own dedicated test method
* address some code review comments and checkstyle violations
* cleanup: remove builder() from LogData interface and remove clock methods from LogBuilder interface.
* make inner impl static
* make method package private
* factor builder out to top-level class and remove creation work from constructor
* fix up tests for SdkLogEmitter and SdkLogBuilder
* backfill coverage for second shutdown
* remove mock
* Add mechanism to track view/instrument registration for errors.
- Create SourceInfo class to track code/config based sources of errors.
- Add SourceInfo creation to both InstrumentDescritpor and View
- Update DuplicateMetricStorageException to remember source
MetricDescriptors
- Update MetricDescriptor to include source view + instrument
descriptors.
- Add new error messages with gory detail on conflict that will be
logged.
* Move InstrumentDescriptor into internal package
We use this class to track instrument sources/debugging so we don't want it exposed publicly. This just moves it next to MetricDescriptor.
* Fix logs to include throwable.
* Fix javadoc.
* Add mechanism to enable/disable metric diagnostics.
- Create DebugConfig class that knows whether metrics are on/off
- Add testing utility to enable/disable debug configuraiton.
- Update NoSourceInfo to use real enablement message.
- Move "default on" diagnostic tests into their own group, similar to
context.
* Update to use Thread.getStackTrace
* Fixes from review.
* Add log processors to the builder so LogSinkSdkProvider is immutable
* Add api diff
* Rename to SdkLogSinkProvider
* Rework log sdk
* Refactor logging sdk to implement OTEP-0150
* Fix typo
* Add unit tests
* Reorganize to facilitate potential future API
* Rename ReadableLog* to SdkLog*, make SdkLog* package private
* Add LogEmitterProvider interface, tidy up some javadoc
* Respond to PR feedback
* Make SdkLogEmitterBuilder final
* Switch to LogEmitter.logBuilder().emit() pattern
* Add remove method to AttributesBuilder
* Improve test coverage
* Remove attributes by nulling out instead of removing from list
* feedback wip
* Add AttributesBuilder#remove(String) method
* Add removeIf() method
* AbstractFixedSizeExemplarReservoir uses more efficient removeIf() attribute filter
* 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>
* 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
* Add timeout between delta collection to avoid rapid collection cycles across multiple readers.
* Fix issue where exemplars were not sampling wall-clock time.
* Fix synchronous collection supression to track duration using Clock.nanoTime
* Fixes from review.
* Remove leftover TODO.
* Start of multi-exporter codebase.
* Restore InMemoryExporter + fix javadocs.
* Quick javadoc fix
* Fix some javadoc build failures and missing things.
* Fix bug with autoconfigure
* Modify InMemoryMetricReader + register methods to allow for immutable SdkMeterProvider
- InMemoryMetricReader is now a factory + reader
- Hide register on SdkMeterProvider
- Update all tests to make sure things pass.
* Make metric-readers 'immutable' post-construction of SdkMeterProvider. Update all code around registration of readers and autoconfigure. Create new 'sdk noop' meter provider for when we have no readers configured.
* Fix integration test.
* Fix jmh benchmarks for trace.
* Fix jmh build.
* Fix broken in-memory exporter things, and Noop API issue.
* Migrate MetricReader.Factory to MetricReaderFactory.
* Rename PeriodMetricReader.Factory to PeriodicMetricReaderFactory.
* Apply suggestions from code review
Co-authored-by: John Watson <jkwatson@gmail.com>
* Minor cleanup of ColectionHandle.
* Fixes from review.
* Extract delta accumulation and add tests.
* Fragment the abstraction in SynchronousMetricStorage for better separation of responsibilities.
* Add tests (and minor optimisation) for delta metric storage.
* Add test for temporal metric storage.
* Update temporal metric storage to fix issue w/ async instruments.
* Migrate Async storage to use temporal metric storage (with better tests).
* Another fix from review.
* Remove start epoch nano parameter from storage constructors.
* Fixes from review.
* Migrate flush -> forceFlush as per review.
* Add test coverage for flush.
* Fixes from review.
* Fix public API breakage.
* Fixes from review.
* Fix threadsafe annotations
Co-authored-by: John Watson <jkwatson@gmail.com>
Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
* 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.
* Expose aggregation configuration and wire in exemplar sampler
- Expose classes for aggregation configuration that are visible in exemplar sampler
- Create default exemplar sampler that samples w/ traces
- Expand metric benchmarks to include exemplar + no-exemplar to check overhead.
* Fix merge conflict.
* Wire exemplar filter config into autoconfigure module.
* Expose aggregation configuration and wire in exemplar sampler
- Expose classes for aggregation configuration that are visible in exemplar sampler
- Create default exemplar sampler that samples w/ traces
- Expand metric benchmarks to include exemplar + no-exemplar to check overhead.
* Fix merge conflict.
* Wire exemplar filter config into autoconfigure module.
* Migrate exemplar reservoir instantiation into aggregations. Start migrating off AggregatorFactory -> Aggregation.
* Small cleanup.
* Fixes from review (and report of clsasloader fixes from other laptop.
* Migrate to null-object pattern.
* Add internal boilerplate.
* Run spotless.
* Fix toString of aggregation values.
* Fix ==