Commit Graph

579 Commits

Author SHA1 Message Date
John Watson c03efbcc13
Add an option to the SDK builder to specify an initial TraceConfig (#2192)
* Add an option to set the initial TraceConfig when building an SDK, and a TracerSdkProvider.

* add the missing javadoc
2020-12-04 14:12:48 +09: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
Prashant Srivastava efe5fbf0aa
Refactoring span benchmarking as per the spec (#2186)
* Refactoring SpanBenchmark to span configuration by the spec

* Some style check changes
2020-12-03 12:12:38 -08:00
Anuraag Agrawal 4762c6a25d
Remove ReadableAttributes (#2187)
* Remove ReadableAttributes

* Don't rewrite history

* Drift
2020-12-03 11:26:24 -08:00
John Watson d7ab0addfa
Add an option to set an IdGenerator when building an SDK. (#2185)
rename a few lingering pluralized idGenerator symbols.
2020-12-03 09:18:05 +09:00
Armin Ruech 5585e73611
Remove "semver" prefix from instrumentation library version (#2180) 2020-12-02 10:29:11 -08: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 4d73431a96
cleanup work (#2172)
* remove 3 classes that got left behind in a repackaging

* actually disable the stress test
2020-12-01 17:03:32 -08:00
Anuraag Agrawal 18355e9683
Remove Guava dependencies from SDK (#2148)
* Remove Guava from SDK

* Clean
2020-12-01 11:10:38 -08:00
Anuraag Agrawal ca3714053f
Replace SpanData.hasRemoteParent/getParentSpanId with getParentSpanContext (#2146)
* Remove SpanData.hasRemoteParent

* Replace parentSpanId with parentSpanContext

* Update sdk/trace/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java

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

* Keep parentId

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
2020-12-01 09:50:11 -08: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
Anuraag Agrawal 09d371ba09
Enable tooling for mrjar and use it to get epoch time in best way for Java 8 or 9+. (#2154) 2020-12-01 09:30:05 +09: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
Mateusz Rzeszutek 2130644667
Support process.runtime.* resource attributes (#2143)
* Support process.runtime.* resource attributes

* Code review comments

* Add process.runtime.* attributes to README.md
2020-11-30 10:12:15 -08:00
Vladimir Šor ee0dac1a97
Add getKind to the ReadableSpan interface in SDK. (#2162) 2020-11-30 09:48:02 -08:00
Anuraag Agrawal 14d23dcd46
Some more test coverage for OpenTelemetrySDK. (#2130)
* Some more test coverage for OpenTelemetrySDK.

* Fix assertion

* Update OpenTelemetrySdk.java
2020-11-25 18:12:56 -08:00
Anuraag Agrawal 8b1c4c50d1
Shutdown BSP in benchmarks (#2127) 2020-11-25 11:13:17 -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
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
John Watson 4897f4c320
rename tracing to trace for the module (#2112) 2020-11-23 10:14:33 -08:00
Anuraag Agrawal ac672e56bf
Update dependencies (#2115) 2020-11-21 09:39:27 -08:00
Anuraag Agrawal 7c29e2b6ed
Fix post-merge conflict by using public APIs to test. (#2106)
* Fix post-merge conflict by using public APIs to test.

* IDE fail
2020-11-20 08:18:11 -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
Anuraag Agrawal d940947e53
Hide implementation of MultiSpanExporter/Processor behind interface. (#2091)
* Hide implementation of MultiSpanExporter behind interface.

* spanprocessor too

* composite

* composite

* Optimize composites based on number of items.

* Spotless

* IntelliJ + spotless race condition

* Fix test
2020-11-20 10:54:35 +09:00
John Watson c0b53e9901
Add the option to add SpanProcessors when building an OpenTelemetrySdk instance (#2102)
* add the ability to add span processors to the SDK when building.

* formatting
2020-11-19 17:54:11 -08:00
John Watson 97ff6ae1f3
remove methods deprecated in 0.11.0 (#2103)
- SpanData.getCanonicalCode() and implementations
2020-11-20 10:48:52 +09:00
Anuraag Agrawal bd652270dd
Remove usages of beta Guava APIs. (#2095) 2020-11-19 12:18:34 -08: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
John Watson c4791e9fbb
Very basic Aggregation-configuration API in the SDK. (#2037)
CHANGELOG: SDK : Enhancement: A basic aggregation configuration API has been added to the SDK's meter provider implementation.

* Create a very basic view API in the SDK.

* fix formatting

* move the ViewRegistry up one package, and clean up the visibility of other classes

* Support matching by instrument name

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/ViewRegistry.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java

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

* fix formatting issues from GH

* small renaming to a big name

* small renaming to a big name

* re-order matching check and fix a merge issue

* Update from upstream changes.

* Update from upstream changes.

* Adjust defaults based on the latest behavior

* refactor before writing tests

* tests for the AggregationChooser and a bugfix they uncovered

* tests for the ViewRegistry

* Javadoc for the AggregationConfiguration

* Add more javadoc.

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/Batcher.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/AggregationConfiguration.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/AggregationConfiguration.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/AggregationConfiguration.java

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

* Update sdk/src/main/java/io/opentelemetry/sdk/metrics/view/AggregationConfiguration.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/AggregationConfiguration.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

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

* fix formatting issues

* Update sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/view/InstrumentSelector.java

Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
2020-11-18 13:05:37 -08:00
Ruben Vargas Palma b851f7c4e2
Report BatchSpanProcessor current queue size (#2087)
* Report BatchSpanProcessor current queue size

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>

* class name and span processor label to static fields

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
2020-11-18 14:02:54 +09: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
Marius Volkhart 4bc4f04e75
Prevent SDK from throwing on null instrumentation name (#1941)
CHANGELOG: the SDK will no longer throw an exception with a null instrumentation name on tracers or meters, but this is still not recommended usage.

* Provide a default Tracer and Meter for invalid instrumentation names

According to the spec, https://github.com/open-telemetry/opentelemetry-specification/blob/v0.6.0/specification/trace/api.md#tracerprovider-operations both a null and empty instrumentation name are invalid and a default implementation should be provided.

However, the spec is vague on what default means. See https://github.com/open-telemetry/opentelemetry-specification/issues/586#issuecomment-669856711

This change interprets "default" as meaning, "it should still work, but it's not ideal". Accordingly, a real Tracer or Meter implementation from the SDK is used. It meets the requirements of exporters and such by using a valid instrumentation name. It meets the requirements of application developers by producing valid tracing data. It also warns library and application developers by logging at the WARN level that an invalid value has been given.

The rational for this interpretation is that things should always work for the application developer. If an app developer doesn't provide a name, they should be chided, but they are instrumenting their own app, and likely don't care about the lack of name. If an app developer incorporates a library that doesn't specify the instrumentation name, the instrumentation should still be made available to application devs, but they should be able to turn if off (hence a valid name) and be made aware of something not being right (hence the logging) so they can report it to the library maintainers.

Fies #1879

* Mark instrumentation version nullable in MeterProvider and TracerProvider

The spec dictates this to be optional, and the implementations treat it as nullable already.

* Remove ComponentRegistry#get(String) overload

This overload is not no longer used by our code.

* fixup! Mark instrumentation version nullable in MeterProvider and TracerProvider

* fixup! Provide a default Tracer and Meter for invalid instrumentation names

* fixup! Provide a default Tracer and Meter for invalid instrumentation names

* fixup! Remove ComponentRegistry#get(String) overload

This reverts commit db56814c

* Revert "Mark instrumentation version nullable in MeterProvider and TracerProvider"

This reverts commit 7e92b396
2020-11-13 09:48:44 -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
Anuraag Agrawal 9d17c6619a
Add assertj helpers for asserting traces and expose from the junit5 h… (#2051)
* Add assertj helpers for asserting traces and expose from the junit5 helper.

* Style and stability of map

* Revert rename, any order comes in future.

* Add coverage for protected method implementations.

* Test hasTraceId

* Check hasTraceId failure too.
2020-11-12 09:06:00 +09:00
John Watson 5ea50d3104
Make the BatchRecorderSdk actually batch the recordings (#2007)
* Make the BatchRecorderSdk actually batch the recordings
Rather than just forwarding them immediately.

* rework the batch recorder to use a queue of recordings

* remove an allocation per recording by introducing some typed classes
2020-11-10 09:44:16 -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 cdc725c3c3
Add AssertJ custom assertions for SpanData and ReadableAttributes. (#2035)
* Add AssertJ custom assertions for SpanData and ReadableAttributes.

* Simpler?

* Cleanup
2020-11-09 08:36:27 -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
dengliming 16bb99b028
Provide default implementations for SpanProcessor.shutdown and forceFlush (#2025)
* Provide default implementations for SpanProcessor.shutdown and forceFlush

* Fix review
2020-11-05 16:33:30 -08: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 570924b4b7
Fix post-merge conflict in OpenTelemetryRule. (#2014) 2020-11-04 19:05:43 -08:00
Anuraag Agrawal f01456bebd
Add a junit4 rule for OTel testing. (#1996)
* Add a junit4 rule for OTel testing.

* Docs to 4

* A bit more 4

* Volatile just in case
2020-11-05 11:37:51 +09:00
John Watson d0e0b5a553
Keep Span Attributes in order, as the spec strongly suggests. (#2004) 2020-11-05 11:30:07 +09:00
Bogdan Drutu 381133ab26
Remove testbed artifact, add testbed tests to trace sdk (#1999)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-04 09:00:33 -08:00
Bogdan Drutu 18d45beb4f
Remove inmemory exporter artifact, move to sdk-testing (#1991)
* Remove unused class InMemoryTracing, junit5 helper is enough

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

* Remove inmemory exporter artifact, move to sdk-tracing

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-04 08:18:01 -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
Bogdan Drutu 6dfbc14e19
Rename package name for exporters to singular exporter (#1992)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-03 16:27:57 -08:00