Commit Graph

862 Commits

Author SHA1 Message Date
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
Bogdan Drutu 702e0ae409
Implement ImmutableKeyValuePairs to avoid unnecessary autovalue (#2700)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 18:39:38 -08:00
Bogdan Drutu 88e760d01c
[BREAKING CHANGE] Remove AsHexString suffix from ids getters. (#2684)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 10:40:43 -08:00
Bogdan Drutu d71db8cbea
[BREAKING CHANGE] Rename getEntryMetadata to getMetadata (#2688)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 09:23:48 -08:00
Bogdan Drutu 88bbdc86d1
Extract foreach implementation in the super class (#2690)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 09:20:48 -08:00
Bogdan Drutu 009e1c8054
Mark sortAndFilter methods as protected, reduce public API (#2689)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 09:12:50 -08:00
Bogdan Drutu 5cb09fbb73
Change Baggage.forEach to map other forEach methods, same generics asMap (#2674)
* Removes one custom interface and uses BiConsumer as all the other places.
* Builder no longer needs to create new objects from parent and can reshare them.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 08:51:52 -08:00
Bogdan Drutu fb5f9e97c9
Fix consistency between implementation/test of fromContextOrNull (#2649)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 08:32:52 -08:00
Bogdan Drutu b5f2cbd7e4
Remove unused method, cleanup comments in TraceFlags (#2680)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 08:25:42 -08:00
Bogdan Drutu c3e7f34d41
[BREAKING CHANGE] Simplify bytesFromHex by removing offset, consistent isValid (#2682)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 08:18:31 -08:00
Bogdan Drutu d83c29f871
[BREAKING CHANGE] Remove bytes size from TraceId/SpanId (#2685)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-03 07:41:55 -08:00
Anuraag Agrawal 9cec2ca237
Downcast to reduce allocations when copying Baggage (#2683) 2021-02-03 18:26:40 +09:00
Bogdan Drutu 06da79c6ee
Fix more comments in TraceId/SpanId (#2681)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 18:34:10 -08:00
Bogdan Drutu 3e6a5db360
Use consistent name for private classes in the baggage package (#2676)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 14:31:06 -08:00
Bogdan Drutu 36adb5225c
Restructure API in trace/span id classes, no changes just move code around (#2672)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 14:12:05 -08:00
Bogdan Drutu 2387287f31
Mark BaggageEntry and BaggageEntryMetadata as immutable, otherwise it is hard to make Baggage immutable (#2675)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 13:54:21 -08:00
Bogdan Drutu 19c002471e
Move Span.Kind to the upper level as SpanKind (#2646)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 12:27:54 -08:00
Bogdan Drutu 301a29d7a3
Move labels outside of the stable package (#2647)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 10:24:06 -08:00
Bogdan Drutu 3cc2110c42
Remove unused public method in TraceId (#2667)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 09:43:55 -08:00
Anuraag Agrawal bb14c9aaf4
Have w3ctracecontextpropagator actually implement textmappropagator. (#2661) 2021-02-02 09:19:52 -08:00
Bogdan Drutu 439c7c5c79
Remove metrics specific helpers from internal.StringUtils (#2663)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-02 08:21:36 -08:00
Bogdan Drutu 764d93ad11
Fix small nits in tests (#2665)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-01 20:39:16 -08:00
Bogdan Drutu f9fb393995
Remove unnecessary private method in ImmutableKeyValuePairs (#2650)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-01 12:53:29 -08:00
Bogdan Drutu 26e5df2f66
Remove unnecessary class (#2648)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-01 12:34:44 -08:00
Anuraag Agrawal 6eee5ba4ae
Update dependencies (#2618)
* Update dependencies

* Inline annotations

* Revert "Inline annotations"

This reverts commit 8facc4ddbe.

* Unmodifiable
2021-02-01 12:21:00 +09:00
Anuraag Agrawal 1a56b8b0d8
Migrate api / sdk projects to build.gradle.kts (#2609) 2021-01-29 10:10:40 -08:00
Anuraag Agrawal 32a63fb8e3
Migrate to using gradle platform to manage dependency versions instea… (#2586)
* Migrate to using gradle platform to manage dependency versions instead of global variables.

* Remove unused and fix test

* Revert test yolo

* Workaround test ordering issue by just merging them

* Spot
2021-01-27 13:54:58 +09:00
Anuraag Agrawal b4218426ee
Prevent setting global OpenTelemetry twice. (#2548)
* Prevent setting global OpenTelemetry twice.

* Unneessary volatile

* Separate testing class

* Cleanup

* Delete

* Update api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java

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

Co-authored-by: John Watson <jkwatson@gmail.com>
2021-01-21 13:55:46 +09:00
Bogdan Drutu f2974becec
Remove unused package-info files from removed packages (#2558)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-01-19 14:26:43 -08:00
Anuraag Agrawal adbed0c0fd
Remove remaining 0.14.0 deprecated stuff. (#2544) 2021-01-19 09:21:44 -08:00
Anuraag Agrawal 6dc33fe634
Register global in autoconfigure (#2552)
* Register global in autoconfigure

* Spot
2021-01-19 08:21:48 -08:00
Anuraag Agrawal 6bee59e912
Remove OpenTelemetry SPI (#2504) 2021-01-14 11:35:41 +09:00
Bogdan Drutu 53f0e30776
Extract inner classes from metrics API (#2517)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-01-13 15:26:21 -08:00
Anuraag Agrawal 9b85dfa3d4
Add test-sets tests to check which was forgotten. (#2501) 2021-01-13 13:27:49 +09:00
Anuraag Agrawal 75e01110e4
Deprecate OpenTelemetry SPI. (#2453) 2021-01-08 13:37:44 +09:00
Anuraag Agrawal e749f2b262
Add autoconfiguration wrapper artifact (#2401)
* Add autoconfiguration wrapper artifact

* WIP

* WIP

* WIP

* WIP

* WIP

* Mostly done

* Propagator classpath

* Finish

* Cleanup

* Cleanup

* Not visible

* Update sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/ConfigProperties.java

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

* More merge

Co-authored-by: John Watson <jkwatson@gmail.com>
2021-01-07 12:02:09 +09:00
John Watson 015708b7a7
Move the semantic conventions generated code into its own module (#2423)
* Move the semantic conventions generated code into its own module

* remove un-needed dependencies

* move the semconv module to the top level, out of the API namespace

* Update README.md

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

* move SemanticAttributes to a more appropriate package and deprecate the old ones in the api package.

* Apply suggestions from code review

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2021-01-06 08:25:17 -08:00
Anuraag Agrawal 6cf8f934b1
Update dependencies (#2427)
* Update dependencies

* Brave
2021-01-06 16:32:18 +09:00
Anuraag Agrawal fe78126aed
Use logunit instead of tedious jul handler modifications for testing (#2425) 2021-01-06 09:30:35 +09:00
Anuraag Agrawal 3eda37ad7f
Have projects set their release state to alpha instead of recognizing word metrics (#2428) 2021-01-05 09:07:18 -08:00
Anuraag Agrawal 70876ed4ad
Add SdkMeterProviderBuilder.buildAndRegisterGlobal (#2407) 2021-01-01 13:45:15 -08:00
Anuraag Agrawal bf77ea76d5
Add some test coverage to api module (#2408) 2020-12-26 12:48:27 -08:00
Anuraag Agrawal 2d1bdaff73
Merge non-metrics API into API artifact. (#2369)
* Merge non-metrics API into API artifact.

* Revert kotlin newline
2020-12-24 14:13:54 +09:00
jason plumb 8ef80f0db2
Deprecate trace mutli propagator (#2342)
* add deprecation

* backfill tests

* remove invalid tests

* add @

* Update extensions/trace-propagators/src/main/java/io/opentelemetry/extension/trace/propagation/TraceMultiPropagator.java

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

* Update api/context/src/test/java/io/opentelemetry/context/propagation/MultiTextMapPropagatorTest.java

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

* Update extensions/trace-propagators/src/main/java/io/opentelemetry/extension/trace/propagation/TraceMultiPropagator.java

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

* Update api/context/src/test/java/io/opentelemetry/context/propagation/MultiTextMapPropagatorTest.java

* suppress warnings

* get spotless

Co-authored-by: John Watson <jkwatson@gmail.com>
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-12-23 10:23:50 -08:00
Anuraag Agrawal 25f1f54dda
Increase API test coverage a bit. (#2389)
* Increase API test coverage a bit.

* suppress
2020-12-22 08:05:22 -08:00
Anuraag Agrawal 70f665992e
Migrate assertThrows -> assertThatThrownBy (#2375) 2020-12-21 08:57:33 -08:00
Anuraag Agrawal 462f05ae1f
Implement some simple builder implementation methods as default methods. (#2359)
* Implement some simple builder implementation methods as default methods.

* Restore nulls

* emptyList

* Actually null

* Spot

* Forgot one
2020-12-21 08:32:56 -08:00
Anuraag Agrawal f949377aa5
Return interface from AttributeKeyImpl.create (#2358) 2020-12-18 08:12:01 -08:00
Bogdan Drutu 6cf957b368
Remove unnecessary interface (#2350)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-17 19:54:48 -08:00
Anuraag Agrawal 6954d1f624
Use normal filesystem-based Gradle paths. (#2332)
* Use normal filesystem-based Gradle paths.

* Update workflow by making agnostic to jacoco project name

* More merge
2020-12-18 12:07:33 +09:00
Bogdan Drutu a8b30ea503
Remove deprecated code in the API (#2341)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-17 13:18:05 -08:00
Bogdan Drutu cbc8891cae
Mark API's classes final, caveat a bit of duplicate code (#2324)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-17 11:16:35 -08:00
jason plumb 2aa1eb2f54
Metrics are alpha take 2 (#2329)
* omit metrics artifacts (alpha) from the bill of materials (bom)

* Hack the version number for maven publications that end in -metrics.

* Remove the failed attempt.
2020-12-16 20:10:06 -08:00
Anuraag Agrawal 17fa4e9c97
Only apply java-library to projects and configure reactively. (#2319)
* Use java-library

* Only apply java-library to projects and configure reactively.

* Consistency

* Cleanup
2020-12-17 09:11:44 +09:00
Anuraag Agrawal 8a369e3695
Make public src/main classes final where possible. (#2309)
* Make public src/main classes final where possible.

* methods

* Spot
2020-12-16 13:13:04 +09:00
jason plumb 5a93b77524
inject alpha into the version for metrics api and sdk. (#2311) 2020-12-16 12:29:54 +09:00
Bogdan Drutu dbb1ae91f9
Deprecate metrics from opentelemetry-api, add a global version in metrics api (#2279)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-15 15:14:50 -08:00
Bogdan Drutu 37afb33659
Split global functionality into a separate class (#2233) (#2239)
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from
the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation.

Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-15 13:05:46 -08:00
Bogdan Drutu 25bf879df7
Split global functionality into a separate class (#2233)
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from
the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation.

Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-15 10:27:35 -08:00
Anuraag Agrawal 44186bc110
Suppress checkstyle javadoc check from non-main source sets. (#2307)
* Suppress checkstyle javadoc check from non-main source sets.

* Update checkstyle-suppressions.xml
2020-12-15 09:39:33 -08:00
Frank Spitulski c108f62158
fix(semantic-attributes): update to dec 14 2020 master (#2302) 2020-12-15 08:42:33 -08:00
Anuraag Agrawal e802b8ab35
Detect invalid use of makeCurrent in Kotlin coroutine. (#2227)
* Detect invalid use of makeCurrent in Kotlin coroutine.

* Fix and check suspending function too.

* Newline

* Doc

* Some comments

* teency
2020-12-15 15:09:34 +09:00
Anuraag Agrawal 262dd7a866
Use key as AttributeKey.toString (#2175)
* Use key as AttributeKey.toString

* Fix / more tests

* Add toString test for SpanWrapper

* Quote string values

* Fix
2020-12-15 12:49:45 +09:00
Anuraag Agrawal 13e6485a63
Add Context.toString (#2289) 2020-12-15 11:57:36 +09:00
Anuraag Agrawal 6f97da1261
Make AttributeKey compare normally with both type/key. (#2284)
* Make AttributeKey compare normally with both type/key.

* Say hi to murphy
2020-12-14 09:56:56 -08:00
Bogdan Drutu 8a8799ec9e
Small nit in internal members order (#2232)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-12 16:18:38 -08:00
Bogdan Drutu c8f1f27f07
Remove OpenTelemetryBuilder interface, every implementation will have it's own builder (#2275)
This PR also fixes the DefaultOpenTelemetry builder to be it's own class and not a sub-class.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-12 13:09:58 +09:00
Prashant Srivastava f88e207f09
Adding instructions to run benchmarks (#2271)
* benchmark readme for opentelemetry-sdk

* benchmark instructions for all the modules

* Fixing typo
2020-12-11 14:40:16 +09:00
Bogdan Drutu ca1f31dfb5
Use standard Java interfaces instead of defining custom ones (#2261)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-10 09:16:24 -08:00
Bogdan Drutu 78d1ad5cce
Remove unnecessary generic argument from AsynchronousInstrument (#2260)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-10 08:20:36 -08:00
Anuraag Agrawal f199e133fa
Implement more Span default methods. (#2242)
* Implement more Span default methods.

* A bit more
2020-12-09 13:08:52 -08:00
Bogdan Drutu a439ca6da1
Move small internal package under common (#2219)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-09 13:45:10 +09:00
Bogdan Drutu 087f58da1d
Remove references to TracingContextUtils (#2238)
* Remove references to TracingContextUtils

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

* Update api/trace/src/main/java/io/opentelemetry/api/trace/Tracer.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-12-08 16:56:49 -08:00
John Watson 704dfe270b
add some basic benchmarks for various baggage operations (#2197)
* add some basic benchmarks for various baggage operations

* update for changes from upstream; pre-allocate the strings in the benchmark.

* allocate the strings statically because we can
2020-12-08 11:00:54 -08:00
Bogdan Drutu efd6b9f3e4
Remove deprecated setCallback, change SDK to avoid volatile (#2216)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 18:37:45 -08:00
Bogdan Drutu 67b6339c70
Small nits in api packages (#2220)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 18:10:58 -08:00
Bogdan Drutu 65acc09c46
Add unit tests for isValidMetricName (#2218)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-08 09:22:20 +09:00
Bogdan Drutu be9c31ecad
Remove internal public validateLabelPairs, move to the class that uses it (#2215)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 14:42:23 -08:00
Bogdan Drutu 69208f8f79
Remove version of checkArgument not used (#2213)
This PR fixes an inconsistency that MaxLengthOfAttributeValues was allowed to be set to 0, then thrown internal exception.
We should check for arguments only at public APIs.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 13:39:33 -08:00
Bogdan Drutu 50c8f1f5c6
Move obfuscated to sdk, make it package protected (#2208)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 12:47:01 -08:00
Bogdan Drutu 7460f92bc8
Remove deprecated methods/classes before 1.0 release (#2205)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:33:17 -08:00
Bogdan Drutu 57263bf44a
Move TemporaryBuffers to be a package protected class, no need to expose this class (#2206)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:31:03 -08:00
Bogdan Drutu 3a7c0086c2
Remove deadcode from internal package (#2209)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-07 11:30:39 -08:00
Anuraag Agrawal 2770d46191
Add array implementation of Context. (#2191)
* Add array implementation of Context.

* More test
2020-12-07 12:39:35 +09:00
Anuraag Agrawal 469900eb34
Add a system property that can enable strict context checking for staging environments. (#2195) 2020-12-07 12:38:27 +09:00
Anuraag Agrawal f51332bd25
Add Labels.asMap and hide the builder implementation. (#2189)
* Add Labels.asMap and hide the builder implementation.

* Not public

* Spot

* More merge
2020-12-07 11:35:41 +09:00
Bogdan Drutu 26124ad075
Split API packages, move context in the same directory (#2199)
There are some things left to be done:
* Decide if context package should also be opentelemetry-api-context.
* Cleanup internal packages, things that are used by only one artifact should be moved there.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-05 08:33:20 -08:00
Anuraag Agrawal 8697de9afa
Detect GC leaks of scopes in StrictContextStorage. (#2164)
* Detect GC leaks of scopes in StrictContextStorage.

* More

* Finish

* Force GC more aggressively

* Cleanup

* Vendor code directly

* Copy test too

* Try waiting more

* ep

* oops

* Remove from build.gradle

* Drift

* Log on multiple

* Cleaner ourselves.

* EP

* Move into if

* Revert accidental
2020-12-04 13:04:27 +09:00
Anuraag Agrawal 643b697106
Add TraceState.asMap (#2190)
* Add TraceState.asMap

* Javadoc

* Spot
2020-12-04 12:40:11 +09:00
Anuraag Agrawal 4762c6a25d
Remove ReadableAttributes (#2187)
* Remove ReadableAttributes

* Don't rewrite history

* Drift
2020-12-03 11:26:24 -08:00
Anuraag Agrawal f8b9f0ac6a
Expose BaggageEntry / Metadata as interfaces and add asMap (#2177)
* Expose BaggageEntry / Metadata as interfaces and add asMap

* Disclaimer
2020-12-02 10:40:46 -08:00
Armin Ruech 5585e73611
Remove "semver" prefix from instrumentation library version (#2180) 2020-12-02 10:29:11 -08:00
John Watson ba9f9c09a2
Fix a bug with all tracers & meters being delegated to the global tracer. (#2176) 2020-12-02 18:06:28 +09:00
Anuraag Agrawal cf5b582c5b
Replace AttributeConsumer with BiConsumer (#2174)
* Replace AttributeConsumer with BiConsumer

* Forgot to delete
2020-12-02 16:52:06 +09:00
John Watson e90a6a886b
Convert Attributes to an interface (#2134)
* Convert Attributes to an interface

* Add javadoc explaining Attributes implementation requirements.

* Convert the AttributesBuilder into an interface.

* update from upstream changes

* move the implementation class out of the interface

* clean up some javadoc that referenced non-public classes
2020-12-01 15:54:07 -08:00
Mateusz Rzeszutek dc91c95e63
Fix buildscripts/semantic-convention/generate.sh script (#2144)
* Fix buildscripts/semantic-convention/generate.sh script

Including:
* update spec version to latest commit
* regenerate SemanticAttributes

* Code review comments

* Reference spec date
2020-12-01 11:18:32 -08:00
Anuraag Agrawal 0163a8c121
Split SpanContext into interface / impl (#1935)
* Split SpanContext into interface / impl

* Remove javadoc from impl to reduce drift change.

* Add warning

* More
2020-12-01 11:06:48 -08:00
John Watson 6be633701f
Convert Labels to be an interface. (#2137)
* Convert Labels to be an interface.

* Convert the LabelsBuilder into an interface.
2020-12-01 08:46:34 -08:00
John Watson 036f7f1477
Convert TraceState to be an interface (#2138)
* convert TraceState to an interface

* don't expose the impl

* Remove the un-needed TraceState Entry objects.

* Add additional javadoc documenting requirements for interface implementors.

* make the implementation non-public

* remove un-needed test docs

* Update api/src/main/java/io/opentelemetry/api/trace/TraceState.java

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

* Update api/src/main/java/io/opentelemetry/api/trace/TraceState.java

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

* formatting fix

* Convert the TraceStateBuilder into an interface.

* Introduce an intermediate class to get around classloading cycles.

* extract a method to remove an entry from the builder

* add a comment about the possible inefficiency in the implementation

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-12-01 08:21:36 -08:00
Anuraag Agrawal 7ed6d8d4e4
Remove Status.value (#2147)
* Remove Status.value

* Deprecate for now
2020-12-01 13:46:26 +09:00
Anuraag Agrawal 052b17f9b1
Add asMap for Attributes. (#2145)
* Add asMap for Attributes.

* AttributesMap too

* Test empty too.

* checkstyle
2020-12-01 13:27:14 +09:00
Chris Burns e0989d75e7
Changes return type from List to Collection (#2156)
- changes the return type of the fields() method in TextMapPropagator from List<String> to Collection<String>
and updated all implementations for consistency
2020-11-30 14:26:24 -08:00
John Watson 73bad773dd
Move the AsynchronousInstrument callbacks to the builders. (#2120)
Deprecate the existing setCallback method.
Update the code in the SDK to use the new API.
2020-11-30 14:12:49 -08:00
Christian Neumüller bbe8702257
Rename HttpTraceContext to W3CTraceContextPropagator. (#2116)
* Rename HttpTraceContext to W3CTraceContextPropagator.

* Add javadoc.
2020-11-25 10:27:07 +09:00
John Watson 3782def5dd
Add a static builder method to the OpenTelemetry interface. (#2118) 2020-11-24 09:22:15 -08:00
Anuraag Agrawal 96c7f404b4
Don't repeat Java 8 support among all the subproject READMEs and at top level, clarify that published artifacts are Java 8, but building requires additional instructions. (#2124) 2020-11-24 09:04:40 -08:00
Anuraag Agrawal ac672e56bf
Update dependencies (#2115) 2020-11-21 09:39:27 -08:00
Anuraag Agrawal 1828938263
Disallow null attribute array values. (#2105) 2020-11-21 09:28:58 -08:00
Anuraag Agrawal 0e013e5c73
Hide default context propagators implementation behind interface. (#2089)
* Hide default context propagators implementation behind interface.

* Deprecate

* Revamp
2020-11-20 10:58:34 +09:00
John Watson 96b480cd35
Deprecate the toBuilder methods on the OpenTelemetry classes, and add a method to set the propagators on an instance. (#2094) 2020-11-19 12:39:21 +09:00
Anuraag Agrawal a68b0bf864
Ignore invalid usage of TraceState instead of throwing. (#2084)
CHANGELOG: Invalid TraceState entries will now be ignored, rather than causing the entire TraceState to be invalidated.

* Ignore invalid usage of TraceState instead of throwing.

* Format

* Missed a test
2020-11-18 09:22:24 -08:00
Anuraag Agrawal 46408ef3fd
Don't throw exceptions for invalid baggage like other APIs (#1964)
* Don't throw exceptions for invalid baggage like other APIs

* Remove redundant null check

* Remove redundant null checks
2020-11-16 18:30:16 -08:00
John Watson 7a5d8df148
Make the OpenTelemetrySdk a subclass of DefaultOpenTelemetry (#2069)
* Make the OpenTelemetrySdk a subclass of DefaultOpenTelemetry

* Remove SPI from the explicit OpenTelemetrySdk builder usage.
Add a (super ugly) test to make sure that the clock and resource are getting set.

* Update sdk/all/src/test/java/io/opentelemetry/sdk/OpenTelemetrySdkTest.java

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

* Update sdk/all/src/test/java/io/opentelemetry/sdk/OpenTelemetrySdkTest.java

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

* address code review comments; add tests

* Require the MeterProvider to be a MeterSdkProvider

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-11-16 16:06:43 -08:00
John Watson 1fe334ff12
Some cleanup in span land. (#2062)
CHANGELOG:  Deprecated the `getCanonicalCode` method on `SpanBuilder` ; replaced with `getStatusCode`

* Some cleanup in span land.
* Clean up the SpanBuilder javadoc to match the current APIs
* Scrub mentions of canonical status code
* Deprecate the getCanonicalCode method on SpanBuilder and replace with getStatusCode

* rename an internal method to make more sense

* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>

* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>

* Update api/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>

* add tests for the deprecated method

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
2020-11-11 18:34:07 -08:00
John Watson 58ccf97929
Switch the key/value pair sorting to mergesort, because it is stable (#2049) 2020-11-11 08:04:42 -08:00
Anuraag Agrawal b5efbcf187
Move builders to top level. (#1958)
* Move builders (and TraceStateEntry) to top level.

* Revert Entry

* Fix and more revert

* Drift
2020-11-10 14:50:37 +09:00
Anuraag Agrawal 1883c578bd
Add unit to start, end and event timestamp accepting methods in Span. (#1969)
* Add unit to timestamp accepting methods in Span.

* end timestamp

* Merge

* Merge

* Add Instant versions too
2020-11-09 16:19:52 -08:00
Anuraag Agrawal 9063c385d9
Implement baggage using array of key/value pairs instead of Map. (#2016)
* Implement baggage using array of key/value pairs instead of Map.

* Cleanup
2020-11-09 08:54:22 -08:00
Marius Volkhart 3e31fd91aa
Replace all assertions with AssetJ's assertThat (#2042)
* Replace all assertions with AssetJ's assertThat

Remove uses of JUnit 4 and JUnit 5 assert* where a functional equivalent exists in AssertJ. JUnit 5's assertThrows remains.

Fixes #1994

* fixup! Replace all assertions with AssetJ's assertThat
2020-11-07 14:48:00 -08:00
John Watson d69752a6be
Move the SPI interfaces to .spi.* packages (#2005) 2020-11-06 11:08:35 +09:00
Anuraag Agrawal 9c4c52dfee
Switch animal sniffer signature to gummy bears. (#2015) 2020-11-06 08:56:26 +09:00
Carlos Alberto Cortez 5195622181
Add Getter.Keys() with Jaeger Baggage support. (#1549) 2020-11-05 12:51:07 +01:00
Anuraag Agrawal 28905b7e05
Expose foreach consumer instead of Entry for baggage. (#1982) 2020-11-04 13:41:30 -08:00
Anuraag Agrawal 5be613a3f0
Replace EndSpanOptions.Builder with factory. (#1934)
* Replace EndSpanOptions.Builder with factory.

* create

* Remove class completely
2020-11-04 13:33:10 +09:00
Anuraag Agrawal e5cf181ed9
Expose foreach consumer instead of entries for trace state. (#1979)
* Expose foreach consumer instead of entries for trace state.

* o-public
2020-11-03 16:41:27 -08:00
Anuraag Agrawal 37cce8dbca
Replace LabelConsumer with BiConsumer (#1980) 2020-11-03 15:21:52 -08:00
Anuraag Agrawal 23392d9052
Make Attribute/LabelConsumer consistent with Java 8 BiConsumer (#1983)
* Make Attribute/LabelConsumer consistent with Java 8 BiConsumer

* more

* Spot
2020-11-03 10:03:52 -08:00
John Watson d958f2ba0c
Add a Jaeger exporter which exports via the thrift-over-http format (#1875)
* Initial implementation of a jaeger thrift exporter.

* some cleanups/renaming

* fix? the formatting

* Fix the default endpoint.

* Update exporters/jaeger_thrift/README.md

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

* Update exporters/jaeger_thrift/README.md

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

* Update exporters/jaeger_thrift/src/main/java/io/opentelemetry/exporters/jaeger/Adapter.java

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

* Update exporters/jaeger_thrift/src/main/java/io/opentelemetry/exporters/jaeger/JaegerThriftSpanExporter.java

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

* cleanup from PR review

* fix from upstream change

* add assertions about the results of the exports
and fix the code to make sure the results were included.

* update for api repackaging

* add some fuzzing tests for the id <-> long conversions

* change SpanId interface to match the TraceId one.

* Made a test method non-public

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-11-03 09:41:39 -08:00
Trask Stalnaker 4699191495
Add doc explaining the restriction on return type (#1977)
* Add doc explaining the restriction on return type

* In more places
2020-11-03 14:20:16 +09:00
Tyler Benson 9c446490af
Fix outdated javadoc (#1975) 2020-11-02 11:03:42 -08:00
Anuraag Agrawal 0e937d4c55
Use fine logging in w3c/b3 propagator instead of info. (#1966)
* Use fine logging in w3c propagator instead of info.

* Fine for b3 too
2020-11-02 07:47:11 -08:00
John Watson f034adb03b
Misc. cleanup: (#1942)
Rename TraceShim factory to OpenTracingShim
Remove factory method from OpenTracingShim which used mixed pieces of the openTelemetry components.
Made the constructor for W3CBaggagePropagator private.
Updated OpenTracingShim README
2020-10-31 13:42:00 -07:00
John Watson e581182147
Create classes to hold on to the context keys. (#1945)
Inline methods in TCU and get rid of it.
2020-10-31 08:47:37 -07:00
Anuraag Agrawal c723de5b05
Merge context_prop into context artifact. (#1928) 2020-10-31 08:47:07 -07:00
Anuraag Agrawal e8c6b1dac8
Remove BaggageUtils (#1931) 2020-10-30 11:25:12 -07:00
Anuraag Agrawal d430e11421
Add test cases for array attributes with null inside. (#1933) 2020-10-30 08:19:37 -07:00
Anuraag Agrawal c6f111a48d
Add comments to all package-private methods being used by auto-instrumentation. (#1930) 2020-10-29 20:42:43 -07:00
Anuraag Agrawal e6f6f19cc9
Remove BaggageManager for real. (#1929)
* Remove BaggageManager for real.

* Spot
2020-10-29 20:42:00 -07:00
John Watson 338acd4816
Add some simplistic fuzz-based tests for the 2 built-in W3C propagators. (#1926)
* Add some simplistic fuzz-based tests for the 2 built-in propagators.

* remove unused gradle plugin
2020-10-29 17:57:25 -07:00
Bogdan Drutu 972c89a2ef
Make BaggageUtils and TracingContextUtils package protected (#1923)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-29 14:05:51 -07:00
Bogdan Drutu da7ff3da20
Ensure all public classes in the API are final (#1924)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-29 14:05:29 -07:00
Anuraag Agrawal 604aee25fa
Have Baggage context interaction API mirror Span. (#1916) 2020-10-29 12:49:54 -07:00
Anuraag Agrawal 3d69aa19a8
Restore source/targetCompatibility declarations for intellij to set version correctly and remo… (#1920)
* Restore source/targetCompatibility declarations for intellij and remove animalsniffer for java 8.

* Newer syntax
2020-10-29 08:11:15 -07:00
Anuraag Agrawal ba1fabeb64
Hide Default* implementations behind interface factory methods. (#1904)
* Hide Default* implementations behind interface factory methods.

* Renames
2020-10-29 08:02:44 -07:00
Anuraag Agrawal 34953d5fee
Add MustBeClosed to Context.makeCurrent (#1914) 2020-10-29 11:36:46 +09:00
John Watson ed75175578
Add a method to the Baggage interface to return the current baggage in the context (#1913)
* Add a method to the Baggage interface to return the current baggage in the context.

* formatting

* Fix tests broken by not clearing state

* don't try to code while overly tired. the result is scopes that aren't closed.

* remove the scope to make sure the root scope has no baggage
2020-10-29 11:07:08 +09:00
Anuraag Agrawal f83b9e4842
Remove leftover baggage spi package-info and add baggage propagation missing package-info. (#1905) 2020-10-28 07:34:04 -07:00
Anuraag Agrawal 7ebbe7979d
Move API packages to .api. package (#1892)
* Move API packages to .api. package

* Cleanup
2020-10-28 08:39:41 +09:00
Anuraag Agrawal 934c9ed8a3
Make OpenTelemetrySdk implement the OpenTelemetry interface and have SPI find it. (#1857) 2020-10-24 19:39:26 -07:00
Anuraag Agrawal a8975e83d4
Replace TracingContextUtils.currentContextWith with ImplicitContextKeyed.makeCurrent (#1855)
* Replace TracingContextUtils.currentContextWith with ImplicitContextKeyed.makeCurrent

* Dont add MustBeClosed this time since affects other code.
2020-10-24 19:38:24 -07:00
dengliming a4e23f9ed9
Span return `this` to enable chain calls (#1869)
* Span return `this` enable chain calls

* Fix spotlessCheck

* Keep return void in end method
2020-10-23 09:29:01 -07:00
Giovanni Liva d0785ff84f
Automatically generate Semantic Convention attributes (#1846)
* Automatically generate Semantic Convention attributes

* Fix checkstyle

* Transition to automatically generated class

* Pin to specific commit

* Move EXCEPTION_EVENT_NAME inside the template
2020-10-23 09:00:42 -07:00
John Watson e2f648da63
Add a toBuilder method to the Baggage (#1868)
* Add a toBuilder method to the Baggage to make it easy to amend baggage.

* formatting
2020-10-23 07:49:33 -07:00
Bogdan Drutu 185d10e395
Serialize the entire trace flags not only the sample bit (#1774)
* Serialize the entire trace flags not only the sample bit

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

* Add test for more than just sampling bit in the context

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

* Update api/src/test/java/io/opentelemetry/trace/propagation/HttpTraceContextTest.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-10-23 13:33:41 +09:00
Anuraag Agrawal 23444d6e5c
Update google java format to 1.9 (#1854)
* Update google java format to 1.9

* Spotless

* Update Contributing.md
2020-10-23 12:47:10 +09:00
John Watson 14c2faf064
Simplify a call so that we don't have cycles in the TCU->Span call chain. (#1867) 2020-10-23 11:10:45 +09:00
Bogdan Drutu 52a6af86d4
Remove baggage sdk package, move tests to API (#1865)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-22 09:55:28 -07:00
Anuraag Agrawal ee03c5eabc
Remove unused BaggageManagerFactory SPI. (#1858) 2020-10-22 09:53:50 -07:00
Anuraag Agrawal 36a0339e15
Add a factory method for creating PropagatedSpan to allow auto-instrumentation to intercept the method. (#1859) 2020-10-22 08:39:28 -07:00
Anuraag Agrawal ed5136bcda
Move Span context accessors to Span static methods. (#1843)
* Move Span context accessors to Span static methods.

* Bad IDE

* More merge

* More merge
2020-10-21 20:02:58 -07:00
Anuraag Agrawal f5082d10f6
Context.with/get, AttributesBuilder/LabelsBuilder.set (#1838)
* Context.with, AttributesBuilder/LabelsBuilder.set

* put
2020-10-21 19:51:14 -07:00
Anuraag Agrawal 34e66a1175
Rename getContext to getSpanContext. (#1852) 2020-10-21 19:38:08 -07:00
Anuraag Agrawal ea1a0a0486
Rename OpenTelemetry interface methods to normal interface conventions. (#1842) 2020-10-21 19:21:57 -07:00
John Watson f3df455d2b
Make Baggage implement ImplicitContextKeyed and make the BaggageUtils.withBaggage non-public. (#1849) 2020-10-21 16:05:25 -07:00
Anuraag Agrawal 6544923215
Extract an interface for the OpenTelemetry API to later allow an SDK … (#1805)
* Extract an interface for the OpenTelemetry API to later allow an SDK to implement it.

* Cleanups

* mine

* final

* Fix shortcuts

* Fix javadoc

* More merge
2020-10-21 12:33:50 -07:00
John Watson e13e631847
Make the baggage API fully functional in the API (#1822)
* Make the baggage API fully functional in the API
and get rid of the BaggageManager that was needed previously.

* javadoc cleanup

* more javadoc cleanup

* make the ImmutableBaggage package access
2020-10-20 21:57:17 -07:00
Anuraag Agrawal ecdfc391f2
Add a ContextValue interface to allow Context.withValue(value) withou… (#1827)
* Add a ContextValue interface to allow Context.withValue(value) without a key.

* Assertions

* Renames
2020-10-20 19:26:54 -07:00
Christian Neumüller 9b73fb06fd
Fix non-null carrier not working in extract. (#1835) 2020-10-19 13:07:02 -07:00
John Watson 57097873c8
rename StatusCanonicalCode to StatusCode (#1804) 2020-10-15 17:55:05 -07:00
Bogdan Drutu b73a063901
Remove getCurrentContext and withSpan from Tracer (#1809)
* Remove getCurrentContext and withSpan from Tracer

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

* Remove old java7 example

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-15 10:58:41 -07:00
Anuraag Agrawal 2d0f91b538
Remove DefaultSpan from public API. (#1791)
* Cleanup

* Fix comment

* isValid not valid
2020-10-15 11:37:03 +09:00
Anuraag Agrawal 0ceff17dfa
Remove since tags until 1.0.0 (#1796)
* Remove since tags until 1.0.0

* Spotless
2020-10-14 09:29:27 -07:00
Anuraag Agrawal e2b5245d73
Rename newBuilder to builder for consistency. (#1790) 2020-10-13 13:17:06 -07:00
John Watson 939d1b8ddc
Baggage propagator first implementation (#1771)
* Turn the Baggage metadata into a simple wrapper for a String.

* whoops missing final modifier

* remove unneeded nullable annotation

* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.

* update for context changeover

* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.

* Basic implementation of baggage header extraction.

* inject implemented

* cleanup checks

* update for context changeover
2020-10-13 15:30:01 +09:00
Anuraag Agrawal 487e57ea11
Add constants for message operations which are defined by spec. (#1783) 2020-10-12 09:45:13 -07:00
Anuraag Agrawal 72e17bb2cc
Add a few missing package-info.java (#1776)
* Add a few missing package-info.java

* Spotless
2020-10-09 08:06:58 -07:00
John Watson 012da09027
Remove the method to parent via Baggage. (#1767)
* Turn the Baggage metadata into a simple wrapper for a String.

* whoops missing final modifier

* remove unneeded nullable annotation

* Remove the method to parent via Baggage.
Parenting is still implemented via the Context.
Also, renamed many old variables and method to use the new baggage name.

* small javadoc tweak

* update for context changeover
2020-10-08 10:54:33 -07:00
John Watson 5f6c5bf297
Turn the Baggage metadata into a simple wrapper for a String. (#1764)
* Turn the Baggage metadata into a simple wrapper for a String.

* whoops missing final modifier

* javadoc cleanup

* use the empty metadata as the OT Shim default

* remove unneeded nullable annotation
2020-10-08 10:34:52 -07:00
Anuraag Agrawal 78fd4d1c8f
Add package-info.java to all packages and ParamatersAreNonNullByDefault. (#1772) 2020-10-08 08:26:49 -07:00
Anuraag Agrawal fd49b3f65f
Migrate usage of gRPC context to OTel context. (#1751) 2020-10-07 11:19:49 -07:00
dengliming 1a7396413a
Fix specification link in SemanticAttributes.java (#1763)
* Fix specification link in SemanticAttributes.java

* Update link
2020-10-06 10:17:44 -07:00
Bogdan Drutu 6c660d92e5
Add overload for setStatus without description, fix usages (#1754)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-05 09:05:46 -07:00
Bogdan Drutu eb4a18febc
Remove Status object from API, keep StatusCanonicalCode (#1741)
* Remove Status object from API, keep StatusCanonicalCode

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

* Respond to comments, change more old usages

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

* Fix build, run gojf

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-05 11:33:40 +09:00
Ioannis Mavroukakis 42cdff446c
subsume methods from AttributesKeys to AttributeKey (#1743)
* subsume methods from AttributesKeys to AttributeKey

* remove missed instance of AttributesKeys

* make javadoc wording more representative of method intent
2020-10-04 10:41:37 -07:00
Bogdan Drutu 50a8fbff30
Remove unnecessary methods from api/internal (#1747)
* Remove unnecessary methods from api/internal

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

* Make sdk/StringUtils package protected

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-04 09:50:34 -07:00
Bogdan Drutu b93d1a4d55
Remove Link from API, use SpanData.Link in Sampler (#1739)
* Remove Link from API, use SpanData.Link in Sampler

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

* Fix tracing_incubator

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-02 10:42:22 -07:00
dengliming 71ba8e1b87
Use the concise license header without the year (#1623)
* Use the concise license header without the year

* Use the concise license header without the year
2020-10-02 22:42:53 +09:00
Bogdan Drutu 391043fa1f
Remove redundant type argument conversion (#1734)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-01 18:41:56 -07:00
Bogdan Drutu 790018f004
Remove addLink that accepts Link interface (#1732)
* Remove addLink that accepts Link interface

Currently the Link interface cannot easily be removed, used in the Sampler interface,
will do a separate PR for that.

Based on the specs we don't have to offer a "lazy" formatted Link API (was removed some time ago).

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

* Copy javadoc instead of reference

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

Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
2020-10-01 18:24:02 -07:00
Bogdan Drutu b78fbb31fa
Remove Event interface, and it's usage (#1733)
* Remove Event interface, and it's usage

Based on the specification we are not required to expose this interface or have APIs that accept this interface.

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

* Fix links to Event

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

* Fix more javadocs references to Event

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-02 10:05:28 +09:00
John Watson 231ca02400
Make setting null-valued attributes a no-op, and document that their behavior is undefined. (#1706)
* Make setting null-valued attributes a no-op, and document that their behavior is undefined.

* also have the span itself ignore null attribute values

* Update api/src/main/java/io/opentelemetry/common/Attributes.java

Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>

* Set the non-null-by-default annotation on the package level for the common code.

* add no-op validating tests with a caveat

Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
2020-09-30 08:08:32 -07:00
Sergei Malafeev c577ee17f7
check traceparent for extra trailing characters for version 00 (#1727)
* check traceparent for extra trailing characters for version 00

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add tests and make "00" a constant

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-09-30 08:01:46 -07:00
John Watson 287eae9e5c
Update for the more restricted span status codes. (#1701)
* Update for the more restricted span status codes.

* Update status codes to match the proposed proto codes
2020-09-28 10:42:44 -07:00
Nikita Salnikov-Tarnovski e7706d63f9
Fix type for REDIS_DATABASE_INDEX semantic attribute (#1720) 2020-09-28 08:31:55 -07:00
Anuraag Agrawal 8b7ea5e366
Add overrides to allow using a long key with an int value. (#1713) 2020-09-27 12:54:24 +09:00
Bogdan Drutu 840ae850ec
Rename CorrelationContext with Baggage (#1691)
* Rename CorrelationContext with Baggage

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

* Fix review comments

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

* Rename contextBuildet to baggageBuilder

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-26 08:42:01 -07:00
John Watson 12af6d9fdf
Change the default Propagator in the API to be a no-op (#1709) 2020-09-26 08:34:19 -07:00
Christian Neumüller 83b9ba5701
Implement spec change to only accept Context as span parent. (#1611)
* Prototype for Context as span parent.

* Simplify ZipkinSpanExporterEndToEndHttpTest.

* Minimize PR diff.

* Make Codecov happy.

* Fix overcomplicated DefaultTracer.

* Fix build after merge.

* Fix build after merge.

* Revert storage of full Context.

* Lint.

* Clean up OpenTracing SpanBuilderShim.

* Rename Context -> RequestHandlerContext in testbed.
2020-09-25 11:37:37 +09:00
Sergei Malafeev 5498ab2b82
validate version from traceparent according to spec (#1688)
* #1674 validate version from traceparent according to spec

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add test

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add test

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* rename TraceVersion to WireFormatUtils

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* rename test method

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* use precalculated versions

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* get rid of unneded class

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* get rid of empty lines

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* fix style

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-09-25 09:05:29 +09:00
Bogdan Drutu 3d72a7d86d
Avoid usage of getSpanWithoutDefault when possible. (#1690)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-24 15:17:12 +09:00
Bogdan Drutu 2d146bbbb9
Remove constant labels from instruments and MetricData (#1692)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-24 15:14:04 +09:00
Christian Neumüller d9bd619b55
Add exception.escaped, clean up exception attributes javadoc. (#1672) 2020-09-23 08:50:49 -07:00
John Watson 136d5b9b7f
Make the getKey method non-nullable (#1682)
This was done by tricking AutoValue with a separate field for the storage.
2020-09-22 21:30:23 -07:00
Jason Plumb cfbe6bfe81
Rename dangling references to MeterRegistry (#1683)
* rename getMeterRegistry() to getMeterProvider() in javadocs.

* rename meterRegistry variable to meterProvider

* reformat
2020-09-22 19:37:47 -07:00
John Watson bd51a606a7
Remove the obsolete HTTP_STATUS_TEXT semantic attribute. (#1679) 2020-09-22 10:52:37 -07:00
John Watson 4f613da552
Reverse the precedence on Labels and Attributes to prefer the last one added, rather than the first. (#1656)
* Reverse the precedence on Labels and Attributes to prefer the last one added, rather than the first.

Note: this necessitated changing the way Resources were merged, and the way recordException was implemented.
Added an addAll method to the builder to support efficiently addition of attributes from existing attributes.

* run the formatter

* revert 2 unneeded assertion changes

* Update from rebase
2020-09-21 15:58:03 -07:00
John Watson bf52c0af73
Implement the keyed-attributes proposal (#1631)
* Add a generic type for the key on the ImmutableKeyValuePairs.
This necessitated changing the `get` to `getValue` to avoid clashing with the java.util.Map interface.
Also introduced convenience sub-interfaces for consuming labels and attributes, so consumers don't have to worry about the types if they don't want to.

* Make AttributesMap not extend map, and restore the get method name for Attributes.

* key class and implementation

* key class and implementation

* The code compiles

* little tweaks

* some cleanup, tests are passing

* remove AttributeValue and clean up misc. references to it.

* clean up some unused bits

* add a TODO

* a bit of cleanup; fix a todo

* update for changes from the main branch

* Change method to get the underlying key.
Move the key creators to a AttributesKeys class.
Hide the implementation classes and replace with interface use.

* use autovalue for the key implementations

* fix javadoc issues

* update benchmark keys, and a few tweaks from PR review

* Add javadoc notes to encourage using the lower-overhead attribute options.

* Add javadoc clarifying subclass responsibilities around empty keys.

* make the compareTo on AttributeKeyImpl null-safe, for extra safety

* fix formatting
2020-09-21 08:52:40 -07:00
John Watson 27090b8336
Switch to java 8 (#1665)
* switch to java 8

* update the READMEs and use Object.equals in a couple of cases to test that we're really compiling for java 8/android 24.

* formatting

* use the newer release options for the build, and change the int test to not be java 7 any more.

* switch back to source/target compatibility

* sure wish I could run docker locally to test this out.
2020-09-19 11:28:13 +09:00
Giovanni Liva 2f9443b3eb
Case-insensitive names for metric instruments (#1643)
* Fix case-insensitive

* s/NAME_MAX_LENGTH/METRIC_NAME_MAX_LENGTH
2020-09-16 16:31:42 +09:00
John Watson ddb38970fa
Move the TraceFlags isSampled boolean into the SpanContext (#1628)
* move TraceFlags into the SpanContext, and expose the relevant flags.

* Cleanup from rebase from main branch

* Address comments from PR review

* Update extensions/trace_propagators/src/main/java/io/opentelemetry/extensions/trace/propagation/AwsXRayPropagator.java

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

* Undo @anuraaga's bad suggestion. ;)

* change the traceFlags input to the TraceContext be a byte, rather than a boolean.

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-09-14 09:28:08 -07:00
Anuraag Agrawal 751177f6f1
Add FaaS attributes. (#1634)
* Add FaaS attributes.

* Move to javadoc
2020-09-11 10:55:07 -07:00
John Watson d42d4cd9e2
Add a generic type for the key on the ImmutableKeyValuePairs. (#1619)
* Add a generic type for the key on the ImmutableKeyValuePairs.
This necessitated changing the `get` to `getValue` to avoid clashing with the java.util.Map interface.
Also introduced convenience sub-interfaces for consuming labels and attributes, so consumers don't have to worry about the types if they don't want to.

* Add some javadoc to the new interfaces.

* Make AttributesMap not extend map, and restore the get method name for Attributes.

* make ImmutableKeyValuePairs also have a parameterized key type
2020-09-08 19:18:58 -07:00
Sergei Malafeev f13fd58d25
#1372 Have Propagators expose only a singleton instance (#1622)
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-09-07 10:47:05 -07:00
John Watson 485cc52c6f
SpanContext hides the TraceId/SpanId implementations (#1594)
*  This is a combination of 2 commits.
 This is the 1st commit message:

WIP on converting to String-based SpanContext

don't hand out the byte arrays publicly, but require making copies

make sure to hand out fresh invalid byte arrays.

Use strings for span and trace ids.

Switch over to CharSequence instead of String for the ids

Fix a couple of places that were casting to String

Add some simple wrappers for the generated longs to save converting until the last moment to the character-based representation.

introduce a reusable threadlocal char buffer for generating random ids.

update for changes from upstream

Change the SpanContext to store the ids as Strings internally
Change the id access methods on SpanContext to be clearly labeled as the base16 representations
Add a new create method that allows specifying offsets for traceId and spanId CharSequences

Provide an option for creating a SpanContext from longs or Strings, optionally.

fix a typo

update from upstream

 The commit message #2 will be skipped:

 don't hand out the byte arrays publicly, but require making copies

* WIP on converting to String-based SpanContext

* Update the SpanContext to only store Strings internally for Trace and Span ids.

* remove dead files

* cleanup some CharSequence usages to String

* Update api/src/main/java/io/opentelemetry/trace/BigendianEncoding.java

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

* Update extensions/trace_propagators/src/main/java/io/opentelemetry/extensions/trace/propagation/B3PropagatorInjectorSingleHeader.java

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

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

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

* Update api/src/main/java/io/opentelemetry/trace/TraceId.java

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

* updates from PR suggestion fubars

* some cleanup from PR feedback

* Switch back to String from CharSequence

* Get rid of the overload with the offsets

* Lots of bits of cleanup from PR feedback.

* more renaming of base16 to hex

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-09-03 10:03:41 -07:00
Christian Neumüller 8418753af7
Fix noParent being ignored after explicit parent. (#1617) 2020-09-02 10:28:44 -07:00
dengliming ed08e9f287
Add an overload to the recordException method to support additional attributes (#1599)
* Add an overload to the recordException method to support additional attributes

* Fix Codecov

* Fix review

* Fix review
2020-08-28 12:41:36 -07:00
Sergei Malafeev 88582202c4
Rename 'HttpTextFormat' to 'TextMapPropagator' (#1586)
* #1581 Rename 'HttpTextFormat' to 'TextMapPropagator'

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* fix long line

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add change log entry

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* add change log entry

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
2020-08-26 08:19:48 -07:00
John Watson 1175997dd1
Remove two unused internal methods. (#1591) 2020-08-25 21:06:31 -07:00
dengliming bea5492e6d
Create a static method on Attributes to create an Attributes builder from ReadableAttributes (#1578)
* Create a static method on Attributes to create an Attributes builder from ReadableAttributes

* Fix review
2020-08-24 07:47:55 -07:00
John Watson 79b6f0e14c
Update the TraceState key validations to more closely match the w3c spec (#1561)
* Update the TraceState key validations to more closely match the w3c spec.

* rework method and variable names for more clarity

* Add some tests and fix a bug
2020-08-23 09:52:45 -07:00
Mateusz Rzeszutek 3a8ed95bcd
Implement thread.id and thread.name semantic attributes (#1554)
See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/span-general.md#general-thread-attributes
2020-08-19 08:36:49 -07:00
Giovanni Liva 792f0f452b
Update Attributes API to comply the spec (#1437)
* Forbit null values

* Simplify code and better naming

* Fix error prone error

* Uniform null handling

* Improve tests for SpanAttributes

* Improve tests for Resource Attributes

* Change interface of AttributeValue

* isEmpty overrided only when necessary

* Update Attributes API

* Remove unused code

* Rename method

* Address PR feedback

* fix javadoc
2020-08-18 12:03:32 -07:00
Giovanni Liva 4a0ca4b9fc
Update android API text (#1544) 2020-08-17 07:53:34 -07:00