Commit Graph

784 Commits

Author SHA1 Message Date
Trask Stalnaker e2564eb95e
Cache AttributeKey hashCode (#3563)
* Cache AttributeKey hashCode

* Don't call instance method from constructor
2021-08-30 16:15:15 -07:00
Anuraag Agrawal 6ef3091cfb
Copy in spotless-conventions from instrumentation repo (#3554)
* Copy in spotless-conventions from instrumentation repo.

* Reformat

* A few more dotfiles
2021-08-27 08:28:31 -07:00
John Watson 4b4f0167ed
Optimize 1 & 2 element attributes creation (#3502)
* optimize the single-attribute creation flow to avoid unneeded allocations

* Optimize the implementations of 1 and 2 element Attributes instances.

* Refactor to *actually* save allocations and fix a couple of bugs.
2021-08-18 16:14:32 -07:00
Anuraag Agrawal 87f2b5e0a8
Update error-prone (#3485) 2021-08-13 09:44:29 -07:00
Anuraag Agrawal 182455023a
Update nullaway and add a Contract for StringUtils. (#3432)
* Update nullaway and add a Contract for StringUtils.

* RUNTIME

* SOURCE

* Cleanup
2021-08-12 14:50:39 +09:00
Christian Neumüller dd7cae97d5
Fix OpenTelemetrySdk(.tracerProvider).tracerBuilder() being noop. (#3466)
* Add test for obfuscated tracerBuilder.

* Fix bug, add more tests.
2021-08-11 09:02:09 -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
Anuraag Agrawal ce9c8854c7
Extract publishing and animalsniffer plugins. (#3334) 2021-06-22 08:23:16 +09:00
Anuraag Agrawal 864508983e
Extract JMH conventions plugin. (#3324) 2021-06-17 08:37:49 -07:00
Anuraag Agrawal 7f544416e4
Define an extension for otel-specific configuration of Java. (#3317) 2021-06-17 15:54:25 +09:00
Anuraag Agrawal b9ca09b6c1
Extract java conventions plugin. (#3316) 2021-06-15 12:29:47 -07:00
John Watson ca92a9ab03
Introduce usage of the OpenTelemetry schema with a Tracer/MeterBuilder (#3309)
* Add the OpenTelemetry schema URL to the InstrumentationLibraryInfo and the corresponding API calls.

* small refactoring and doc tweaks from feedback

* make the instrumentation version nullable on the method that takes a schema

* update the apidiffs

* add since tags and a few more missing nullable annotations

* Switch to using a Builder rather than method overloads.
2021-06-11 20:50:23 -07:00
Anuraag Agrawal d6849219a7
Use constant for baggage validation bitsets (#3274)
* Use constant for baggage validation bitsets

* Spot

* Move to element

* private
2021-06-03 17:26:00 -07:00
Anuraag Agrawal d044890a7c
Don't create Supplier when decoding byte (#3273) 2021-06-04 08:31:40 +09:00
Nikita Salnikov-Tarnovski ff85102a46
Remove unnecessary string allocation on hot path (#3272) 2021-06-03 08:57:16 +09:00
Valeriy 34494e609b
javadocs: fix code examples (#3269)
Problem:
Javadocs comments at Tracer interface contains call of unexistent method OpenTelemetry.getTracer()

Solution:
Replace OpenTelemetry.getTracer() with openTelemetry.getTracer(String, String) in examples at javadocs
2021-06-01 12:58:59 -07:00
Anuraag Agrawal 1bfc7871bd
Add doc for AttributesBuider accident. (#3265) 2021-05-30 08:22:12 -07:00
Anuraag Agrawal cb77a8d364
Move TemporaryBuffers to internal and use it everywhere. (#3226)
* Move TemporaryBuffers to internal and use it everywhere.

* blurb
2021-05-13 11:18:50 +09:00
Anuraag Agrawal 672330bf51
Upgrade to Gradle 7.0 (#3228) 2021-05-13 08:21:22 +09:00
Jakub Wach ad6ceccc4c
baggage parsing improvements (#3180)
* baggage parsing improvements

* added JMH benchmark for W3C baggage propagator

* clean-up

* removed old implementation code

* post-review changes
2021-05-12 09:41:21 -07:00
Anuraag Agrawal 77f0b0adc4
Allow enabling nullaway and fix some nullness issues (#3218)
* Add support for enabling nullaway and fix a couple of projects.

* Finish

* Finish

* Cleanup
2021-05-12 08:43:32 +09:00
John Watson a8a85c6129
Add tests and update behavior to verify propagators do not alter the … (#3194)
* Add tests and update behavior to verify propagators do not alter the context when failing to parse inputs.

* Ad a couple tests around null contexts

* formatting
2021-05-07 08:58:42 +09:00
John Watson f396965196
Add @since tags for new public methods. (#3209)
* Add @since tags for new public methods.

* remove errant since tags
2021-05-07 08:26:55 +09:00
Anuraag Agrawal d4b63fbbb6
Coerce null AttributeKey to empty string (#3186) 2021-04-30 10:31:34 +09:00
HaloFour 7d31cddf19
Add Span#setAllAttributes method to add Attributes to a Span (#2799) 2021-04-27 14:41:26 -07:00
James Gan f5f0e1f63f
Improve key validity code documentation for trace state (#3142)
* Improve key validity documentation for trace state

* Address code style issues

Addressed line length, indentation

* spotlessapply to fix indent of javadoc param comment
2021-04-08 10:40:34 -07:00
Anuraag Agrawal 531abc0d24
Fix more tracestate testsuite cases. (#3120) 2021-04-06 15:54:57 -07:00
Anuraag Agrawal d110a6075c
Don't crash on empty tracestate value (#3104) 2021-04-05 08:13:39 -07:00
Jakub Wach 71ad8ff646
X-Ray traceid extraction - 64bit support (#3087)
* X-Ray traceid extraction - 64bit support

* perf improvement - separate methods depending on traceid length

* code review

* code review - scare-comment for internal util

* added new unit tests

* Update api/all/src/main/java/io/opentelemetry/api/internal/StringUtils.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-04-02 17:52:07 +09:00
John Watson 14fd81a8b9
Rename GlobalMetricsProvider to GlobalMeterProvider (#3048) 2021-03-29 08:09:24 -07:00
Anuraag Agrawal 761c8510d0
Better PropagatedSpan.toString (#3055) 2021-03-26 13:56:30 +09:00
John Watson e7cc57d911
Add a note to the TracerProvider javadoc about instrumentation name. (#3050) 2021-03-23 11:40:53 +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 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 1883b5919a
Make the ReadOnlyArrayMap extend AbstractMap for equals/hashcode implementation (#2963)
* Make the ReadOnlyArrayMap extend AbstractMap for equals/hashcode implementation

* formatting

* use guava's EqualsTester to save a few lines

* remove redundant hashcode verifications

* add an empty map to the equals test
2021-03-03 14:05:18 -08:00
Anuraag Agrawal f967b0a95b
Move api/context to context. (#2959)
* Move api/context to context.

* git commit
2021-03-02 10:44:27 -08:00
Bogdan Drutu 17fb50cd31
Remove usage of not well defined fromHex in w3c context (#2947)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-26 15:49:42 -08:00
Bogdan Drutu b29a7123ce
Small nit fix in propagation TemporaryBuffers (#2946)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-26 14:27:59 -08:00
John Watson 6dd3eac097
Remove the documentation about explicit exceptions thrown when TraceFlags are invalid. (#2945) 2021-02-26 09:58:48 -08:00
John Watson 1102efae1d
Update the docs on the TextMapPropagator to be closer to the specification. (#2931) 2021-02-24 13:06:57 -08:00
Bogdan Drutu bf5fa57df5
Move c-like comment to javadoc in TextMapPropagator (#2930)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-24 12:19:03 -08:00
Anuraag Agrawal 18df74eb19
Don't throw on null in propagator implementations. (#2904)
* Don't throw on null in propagator implementations.

* Baggage too
2021-02-24 09:28:16 -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 0b973d9a3c
Defend against null in a few more places. (#2928) 2021-02-24 08:05:24 -08:00
Bogdan Drutu becded2181
Remove throws statements from the API until we decide how to document it (#2912)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-22 18:30:09 -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
Anuraag Agrawal 77e8f71480
Reduce usage of errorprone annotations to MustBeClosed. (#2898) 2021-02-20 11:43:59 -08:00
Bogdan Drutu 55e96b3e87
Do not throw exception if byte array too short for fromBytes (#2868)
* Do not throw exception if byte array too short for fromBytes

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update api/all/src/test/java/io/opentelemetry/api/trace/TraceIdTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-02-18 11:58:31 +09:00
Bogdan Drutu 49f4bd016e
Remove package protected unused class (#2870)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-18 11:35:31 +09:00
Bogdan Drutu 617162073a
Remove Nonnull annotations, we use package default Nonnull (#2871)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-18 11:35:21 +09: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 509a2eee01
Mark GlobalMetricsProvider as final (#2852)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-17 12:43:03 -08:00
Anuraag Agrawal fa15e8b2d0
Remove BaggageBuilder.setParent / setNoParent (#2838) 2021-02-17 09:57:56 -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
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
Anuraag Agrawal 5d7f221058
Reduce some NPE in API. (#2835)
* Reduce some NPE in API.

* Drift
2021-02-17 13:55:36 +09: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 900c35ed8c
Migrate remaining gradle scripts to kotlin (#2820)
* Migrate remaining gradle scripts to kotlin

* Finish more
2021-02-16 14:11:07 -08:00
John Watson 762aca003b
Add documentation about invalid SpanContext inputs. (#2803)
Resolves #2751
2021-02-11 17:53:38 -08:00
Ken Finnigan 339bbb8282
Fix error message formatting on GlobalOpenTelemetry.set() (#2797) 2021-02-10 12:07:12 -08:00
Anuraag Agrawal 817ce5726a
Make StrictContextStorage closeable. (#2776)
* Make StrictContextStorage closeable.

* More javadoc
2021-02-10 10:42:30 -08:00
Anuraag Agrawal 41c05edc58
Don't NPE on null keys when getting from baggage, tracestate, attribu… (#2778)
* Don't NPE on null keys when getting from baggage, tracestate, attributes.

* Restore NPE for now for context
2021-02-10 10:20:32 -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
Bogdan Drutu 8e9ff790d0
Improve ImmutableKeyValuePairs dedup, do everything inplace (#2787)
This change will reduce the number of allocations by 2 for the case where all entries are valid,
and by 1 when entries are filtered in the dedup.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-09 19:39:34 -08:00
Bogdan Drutu 985eff9360
Add benchmark for attributes (#2781)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-09 13:06:19 -08:00
Bogdan Drutu 3c150cc4ad
Move sort and dedup to constructor of ImmutableKeyValuePairs (#2779)
This will allow us to store internally an array and size or other combination that makes sense for performance.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-09 11:06:49 -08:00
Bogdan Drutu 0fecfa71c4
Remove comment about internal backwards compatibility guarantees (#2757)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-09 16:16:20 +09:00
Anuraag Agrawal 0385f6d79b
Make StrictContextStorage package-private (#2772) 2021-02-08 19:03:35 -08:00
John Watson 8898e4c441
save the already known state of SpanContext validity (#2769) 2021-02-08 18:26:02 -08:00
Bogdan Drutu 0bd4ddc9a0
Remove unnecessary private class from API (#2760)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 18:06:18 -08:00
Bogdan Drutu dbc3505e42
Remove filterNullValues property from sortAndFilter (#2768)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 17:42:08 -08:00
Bogdan Drutu 28299f1d9e
Null labels means label is not present (#2766)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 16:14:22 -08:00
Bogdan Drutu 3b7080de2c
ArrayBasedTraceStateBuilder:Remove obsolete comment, remove unnecessary null check (#2763)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 15:04:59 -08:00
Bogdan Drutu 9f01d849be
Small javadoc fix for SpanId.fromLong (#2761)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 14:42:59 -08:00
Bogdan Drutu ff0c298a18
Do not throw NPE if span/trace ids are null in isValid (#2754)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 14:39:13 -08:00
Bogdan Drutu 50baa920d7
Fix comments after revert PR did actually more than just revert (#2755)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-08 12:37:17 -08:00
John Watson d34b66b5cb
Validate the span id and trace id when creating the SpanContext (#2728)
And, remove that extra validation from propagators.
2021-02-08 08:03:33 -08:00
Anuraag Agrawal 522953bd8f
Restore Trace/SpanId.fromBytes (#2750)
This reverts commit d6fea3a70a.
2021-02-08 07:42:49 -08:00
John Watson eb529cb26d
Revert the SpanContext trace/span id accessor methods. (#2749) 2021-02-08 09:51:49 +09:00
Bogdan Drutu d9c4602f8c
Remove one level of indirection, and checks for bytes ids (#2733)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-06 17:47:29 -08:00
Bogdan Drutu bef4707a9e
Remove unused code in BigendianEncoding (#2732)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-06 12:07:18 -08:00
Bogdan Drutu 531d66f943
Remove helper methods for as longs (#2725)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 21:20:58 -08:00
Bogdan Drutu e187c18112
Consistent name for Trace/Span ids getters with the specification (#2721)
See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#retrieving-the-traceid-and-spanid

Not breaking change since methods were just renamed anyway.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 20:33:32 -08:00
Bogdan Drutu 51d176ffdf
Remove helper methods asBytes from Trace/Span Id (#2726)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 20:31:10 -08:00
Bogdan Drutu d6fea3a70a
Remove helper methods fromBytes from Trace/Span Id (#2727)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 20:29:51 -08:00
Bogdan Drutu 7952823322
Mark AbstractWeakConcurrentMap as package protected, no usage (#2731)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 20:19:28 -08:00
Bogdan Drutu 2c2f0b9280
Add a benchmark that test extract, create client span, inject (#2720)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 14:43:25 -08:00
Bogdan Drutu a18376a942
Make TraceFlags interface to allow agent to re-implement it (#2716)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 10:56:47 -08:00
Bogdan Drutu 6c30f411f3
Change TraceFlags to be a class, expose all helpers of the class itself. (#2709)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-05 09:06:19 -08:00
Bogdan Drutu b42c27fe81
Better document exceptions that could happen when parsing Span/Trace ids (#2714)
* Better document exceptions that could happen

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update api/all/src/main/java/io/opentelemetry/api/trace/SpanId.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-02-05 08:26:15 -08:00
Anuraag Agrawal faa8bf867a
Replace DefaultOpenTelemetry builder / class exposure with a factory … (#2704)
* Replace DefaultOpenTelemetry builder / class exposure with a factory for configuring propagation only.

* newp

* Cleanup
2021-02-05 13:13:12 +09:00
Bogdan Drutu 9bc7a71b20
Remove Memoized for byte arrays. Byte-arrays are not immutable (#2712)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-04 14:22:06 -08:00
Bogdan Drutu 9d8af6f236
Cleanup javadoc in SpanContext (#2711)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-04 14:20:01 -08:00
Anuraag Agrawal 6e89f11041
Return Tracer from DefaultTracer.getInstance (#2705)
* Return Tracer from DefaultTracer.getInstance

* Update api/all/src/main/java/io/opentelemetry/api/trace/DefaultTracer.java

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
2021-02-04 08:07:05 -08:00
Bogdan Drutu 77d993d653
[BREAKING CHANGE] Cleanup TraceId/SpanId classes. Ensure consistency. (#2696)
Summary of changes:
* getHexLength renamed to getLength
* bytesFromHex/bytesToHex renamed to asBytes/fromBytes.
* bytesFromHex/bytesToHex renamed to asLongHigh/asLongLow
* Update javadoc.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-04 07:38:25 -08:00
Bogdan Drutu 0b250c1c91
Cleanup usages of TraceState and TraceFalgs (#2697)
* Avoid calling TraceState.builder().build() and replace it with TraceState.getDefault();
* Avoid storing TraceFalgs.getDefault() and TraceFalgs.getSampler() and use them directly;

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 18:39:52 -08:00