Commit Graph

803 Commits

Author SHA1 Message Date
Christian Neumüller 3528123c35
Fix IntervalMetricReader breaking if export() throws. (#3044) 2021-03-19 09:24:49 -07:00
sbandadd 085eb9d87c
Optimize batch span processor (#2983)
* Optimize batch span processor

Description:
Batch span processor currently is aggressive in the sense that any new spans are sent to the exporter,
this involves lots of overhead from signaling under heavy load and overhead from constant polling by exporter thread
under less load. This PR makes exporter thread wait for maxExportBatchSize to avoid busy polling of the queue.

BatchSpanProcessorMultiThreadBenchmark.java result
![image](https://user-images.githubusercontent.com/62265954/111420486-893c7300-86a8-11eb-8f87-feb2f86f00fc.png)

BatchSpanProcessorCpuBenchmark.java result
![image](https://user-images.githubusercontent.com/62265954/111420492-8e012700-86a8-11eb-800e-7de1fbe2c2b1.png)

* More predictable signaling
2021-03-19 11:47:59 +09:00
John Watson fea5ecc0be
Don't auto-start the IntervalMetricReader in the constructor. (#3026)
* Don't auto-start the IntervalMetricReader in the constructor.

* a little more protection around the possibility of double-starting the IMR

* add a test that verifies we only start once

* tweak the values to see if CI likes it better

* make the test simpler for CI

* try a little bit longer time?

* change the test to make an assertion on a passed-in scheduler.
2021-03-19 08:23:23 +09:00
John Watson aac9284f83
Add a new module for extensions to the tracing APIs. (#2962)
* Add a new module for extensions to the tracing APIs.
Includes one simple possible example.

* formatting

* rename and add javadoc

* Clean up & simplify based on feedback

* rename the module to just incubator

* Move to a package named more like the core api trace package.

* repackage to match the module
2021-03-17 18:53:38 -07:00
Shaocheng Wang 906c0e82df
Gracefully shut down exporter after it exports the remaining metrics (#2936)
* [BugFix]shut down exporter after it exports the remaining metrics

* Remove testing log

* Use CompletableResultCode to manage metrics forceflush

* fix bad format

* Adjust the logic to never return null from forceFlush()

* Add doRun() method for IntervalMetricReader.Exporter and return CompletableResultCode

* refine code to remove duplicate code
2021-03-17 15:09:11 +09:00
sbandadd 23ce8fe392
Add batch span processor benchmarks (#3017)
Description:
This PR adds two benchmarks.

1. Current benchmark executs forceFlush() on every loop and creates a bottleneck which results in not stressing batch span processor. Current benchmark only
measures throughput which is not helpful on its own since number of spans getting exported is also important. BatchSpanProcessorMultiThreadBenchmark is created to address this issue.
2. Measuring CPU usage of exporter thread is also important, but the current benchmarks consumes as much CPU as possible which makes the measurement not meaningful.
To maintain a steady state, this PR creates a benchmark that generates 10k spans per second per thread. One would need to attach a profiler such as yourkit or JProfiler
to the benchmark run to understand the processor's CPU usage. BatchSpanProcessorCpuBenchmark is created for this purpose.

This PR also fixes a bug in calculating number of dropped/export spans. Earlier dropped and exported spans were actually counting the other one.

This PR also fixes a big in calculating number of dropped/export spans. Earlier dropped and exported spans were actually counting the other ones.
2021-03-17 14:47:41 +09:00
Anuraag Agrawal f113c03483
Ignore null / invalid spancontext and handle null attributes for links. (#2985)
* Ignore null / invalid spancontext and handle null attributes for links.

* Cleanup

* Fix
2021-03-07 09:03:33 -08:00
Anuraag Agrawal edf08d7bc1
Have SimpleSpanProcessor keep track of pending exports and wait for t… (#2989)
* Have SimpleSpanProcessor keep track of pending exports and wait for them when flushed.

* Fix CompletableResultCode.ofAll(empty)

* Cleanup
2021-03-07 09:02:45 -08:00
Anton Polyakov 938dd17d50
labels processor (#2964)
* labels processor

* test and view builder defaults - code review feedback

* bogdan's comments - code review feedback
2021-03-04 19:14:53 -08:00
Anuraag Agrawal f553aa0a6b
Add an internal GuardedBy annotation to enable our own error prone ch… (#2978)
* Add an internal GuardedBy annotation to enable our own error prone checker without affecting downstream.

* Method
2021-03-05 11:37:24 +09:00
John Watson a14dfd9f46
fix the BatchSpanProcessorDroppedSpansBenchmark for metrics SDK updates (#2981)
* fix the BatchSpanProcessorDroppedSpansBenchmark for metrics SDK updates

* formatting
2021-03-04 15:43:20 -08:00
Anuraag Agrawal 64ed0415d2
Don't copy events toSpanData if ended. (#2979) 2021-03-04 08:13:39 -08:00
Anuraag Agrawal a33a4ed036
Don't fail on timeout / interrupted since the result isn't really don… (#2957)
* Don't fail on timeout / interrupted since the result isn't really done yet.

* Fix test

* warning
2021-03-03 13:48:51 -08:00
jason plumb 47c96b5dd9
Fix trace benchmark (#2974)
* fix address passed to span processor, which was causing benchmark to not run.

* started some docs on how to run jmh
2021-03-03 10:55:41 -08:00
Anton Polyakov c7861e8b29
introducing view (#2956)
* introducing view

* code review
2021-03-01 18:43:31 -08:00
beanliu 518f44159b
Histogram Aggregation - core SDK - aggregator (#2924)
* add histogram aggregator

* implement DoubleHistogramAggregator.toMetricData

* pass temporality instead of a boolean for the creation of histogram aggregator

* remove ImmutableDoubleArray

* remove ImmutableLongArray

* fixup! remove ImmutableDoubleArray

* simplify the implementation of DoubleHistogramAggregator

* accumulate value with configured boundaries

* use nanoseconds as timeunit

* update benchmark mode

* List<Double> instead of double[] for histogram factory

* update var names

* switch to using assertj

* simpler boundary check

* simplify multi-threaded test
2021-03-01 10:17:12 -08:00
Anuraag Agrawal 0d467ab670
Pass unmodifiable list to exporters (#2938) 2021-02-26 07:47:34 -08:00
beanliu f1c38ef616
Histogram Aggregation - core SDK - data (#2923)
* add histogram related metric data types

* update doc of histogram boundaries to make it compatible with latest change of ot-proto

* remove unnecessary helper

* simplify the create interface, add doc and validations
2021-02-24 16:03:04 -08:00
Anuraag Agrawal b393a587dd
Have AttributesMap extend HashMap instead of contain LinkedHashMap (#2906)
* Reduce HashMp allocations for AttributeMap.

* Finish

* Add comment on why wrapper is actually needed.
2021-02-24 09:24:25 -08:00
Anuraag Agrawal 1ec484e2d6
Add event assertion, full attributes assertion, and fuzzy attribute value assertion. (#2927) 2021-02-24 08:02:08 -08:00
Bogdan Drutu 75ea07e597
Fix more api dependencies which should be implementation (#2919)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-23 12:20:06 -08:00
Bogdan Drutu 3490002234
Move semconv dependency as implementation, not exposed in the API (#2918)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-23 08:45:21 -08:00
Bogdan Drutu 9e1c76b324
Do not allow null description in the StatusData (#2896)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-22 15:31:45 -08:00
Bogdan Drutu 013643c707
Add package-info for all packages (#2902)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-21 10:44:00 -08:00
Bogdan Drutu a1c25ec784
Move otproto to otlp:internal, so can be marked as stable (#2893)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-20 14:39:27 -08:00
Anuraag Agrawal 77e8f71480
Reduce usage of errorprone annotations to MustBeClosed. (#2898) 2021-02-20 11:43:59 -08:00
Anuraag Agrawal 6710f099e7
Delete old ResourceProvider class (#2895) 2021-02-19 14:05:20 +09:00
Bogdan Drutu 93dd38a18d
Ensure ParametersAreNonnullByDefault is present in all packages (#2879)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-18 08:58:01 -08:00
Anuraag Agrawal 8f787275fc
[Breaking Change] Make TraceId.getTraceIdRandomPart private (#2839)
* Move traceidrandom

* Make BigEndianEncoding public-internal to use for Android compatibility.

* Rename BigEndianEncoding to sound less useful if accidentally imported.
2021-02-17 16:59:54 -08:00
John Watson bd6a329211
Obfuscate the GlobalOpenTelemetry instance. (#2829)
* Obfuscate the GlobalOpenTelemetry instance.
This is to prevent people from casting to the SDK implementation.
Resolves #2788

* Add some more tests for the global obfuscation
2021-02-18 08:59:56 +09:00
Bogdan Drutu 7c038e00e9
Mark classes final, or hide ctor for testing classes (#2847)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-17 15:18:46 -08:00
Anuraag Agrawal 0730a9e79c
[Breaking Change] Move ResourceProvider SPI to autoconfigure module (#2837)
* autoconfigure

* Finish

* Refactor

* Fix OsResource to use empty

* Fix BeanstalkResource to use empty

* Fix ResourceTest to use empty

* Fix Ec2Resource to use empty

* Fix EcsResource to use empty

* Fix ProcessRuntimeResource to use empty

* Fix ProcessRuntimeResource to use empty

* Fix EksResource to use empty

* Fix LambdaResource to use empty

* Fix ProcessResource to use empty

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Bogdan Drutu <lazy@splunk.com>
2021-02-17 12:41:07 -08:00
Bogdan Drutu 94b37ebfd6
Mark public class TestClock as final (#2856)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-17 12:40:48 -08:00
Bogdan Drutu a633d1ee87
[Breaking Change] Remove metrics exporter from stable testing package (#2857)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-17 12:29:05 -08:00
Anuraag Agrawal 4623334c7c
Move Getter/Setter to top level (#2840) 2021-02-17 09:46:56 -08:00
Anuraag Agrawal fa8bb33646
[Breaking Change] Rename API getDefault to noop! (#2842)
* Noop!

* errorprone
2021-02-17 09:18:22 -08:00
Anuraag Agrawal 224845b6b1
[Breaking Change] Remove attribute value truncation. (#2841) 2021-02-17 09:08:39 -08:00
John Watson f83c21638a
[Breaking Change] Rename TraceStateBuilder.set() to put() (#2830)
Provisionally resolves #2746
2021-02-17 08:16:24 -08:00
John Watson 20a1601089
[Breaking Change] Rename getEmpty() to empty() (#2831) 2021-02-17 08:15:23 -08:00
John Watson 920f79d151
clean up the javadoc and make examples pasteable (#2824)
* clean up the javadoc and make examples pastable
resolves #2817

* formatting
2021-02-17 12:31:08 +09:00
Anuraag Agrawal ebaceb74a1
Simplify ParentBased equals/hashcode and add coverage. (#2823) 2021-02-17 08:41:21 +09:00
Anuraag Agrawal 900c35ed8c
Migrate remaining gradle scripts to kotlin (#2820)
* Migrate remaining gradle scripts to kotlin

* Finish more
2021-02-16 14:11:07 -08:00
Anuraag Agrawal 23adacaf2e
Use empty default for null attributes and discard for null unit (#2777)
* Use empty / millisecond default for null attributes / unit

* Discard
2021-02-16 09:39:02 -08:00
Anuraag Agrawal 1fc7e057ad
Target Android API 21 with animalsniffer and disable it for metrics for now since it's unstable. (#2809) 2021-02-12 11:59:43 -08:00
Anuraag Agrawal bace5dce1f
Rename disabled resources property to be consistent with agent. (#2792)
* Rename disabled resources property to be consistent with agent.

* property > env
2021-02-12 13:45:33 +09:00
John Watson cacf0f18f4
Clarify the implementation of the BatchSpanProcessor forceFlush implementation (#2807)
* Clarify the implementation of the BatchSpanProcessor forceFlush implementation

* insert missing word here
2021-02-11 16:15:05 -08:00
John Watson 74b0e9cc7e
Update the span limit defaults to be 128, per spec 1.0.0 (#2798) 2021-02-10 20:01:56 -08:00
Anuraag Agrawal 170cb4533a
Add VERSIONING document and make sure all internal packages have doc … (#2775)
* Add VERSIONING document and make sure all internal packages have doc about internalness.

* Make internal package caveat even stronger

* Users must not use internal package.
2021-02-10 09:22:44 -08:00
Anuraag Agrawal 5c0ea253a5
Add docs about recommendations regarding traceidratiobased sampler (#2791) 2021-02-09 19:47:12 -08:00
Anuraag Agrawal 0385f6d79b
Make StrictContextStorage package-private (#2772) 2021-02-08 19:03:35 -08:00