Commit Graph

94 Commits

Author SHA1 Message Date
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
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 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
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
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
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 2046ec050e
Move testing-internal artifact to sdk-testing (#1987)
* Move testing-internal artifact to sdk-testing

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

* Fix missed usage of TestSpanData

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-03 13:54:43 -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
Anuraag Agrawal 8b363595bc
Rename getHasRemoteParent and getHasEnded to remove get. (#1918) 2020-10-29 08:22:20 -07:00
Anuraag Agrawal f20e724405
Rename IdsGenerator to IdGenerator (#1919) 2020-10-29 08:20:45 -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 1b0a25a24b
Move samplers into samplers package instead of outer class. (#1903)
* Move samplers into samplers package instead of outer class.

* Sampler

* Sampler

* Drift
2020-10-29 08:13:39 +09:00
Anuraag Agrawal 4455569668
Expose factory for random IDs generator instead of type. (#1901)
* Expose factory for random IDs generator instead of type.

* Maybe this works
2020-10-27 19:04:42 -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
John Watson 173e67aa50
Make the ParentBased sampler public so users can create their own combinations. (#1899) 2020-10-27 16:21:33 -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
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
Bogdan Drutu 5e31e99877
Nit: move Context as first argument to SpanProcessor.onStart (#1866)
* Nit: move Context as first argument to SpanProcessor.onStart

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

* ./gradlew spotlessApply

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-22 19:28:36 -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
Anuraag Agrawal 9efb503544
Fix build breakage due to conflicting merges. (#1844)
* Fix build breakage due to conflicting merges.

* Test too
2020-10-21 13:33:00 +09:00
John Watson f20b3d73a9
Change the sampling API to take a parent Context, rather than SpanContext (#1840) 2020-10-21 12:53:47 +09:00
dengliming c1fbaaf479
Update Jaeger exporter to conform to updated specification (#1839)
* Update Jaeger exporter to conform to updated specification

* Add default getDroppedAttributesCount method to Event
2020-10-20 19:29:29 -07:00
dengliming e1016d66e2
Fix Logger name (#1837)
* Fix Logger name

* Fix spotlessCheck
2020-10-20 19:28:37 -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
dengliming fbfba34134
Update TraceConfig configuration option names (#1824)
* Update TraceConfig configuration option names

* Update span default limit config

* Update constant names
2020-10-18 12:00:03 -07:00
John Watson 57097873c8
rename StatusCanonicalCode to StatusCode (#1804) 2020-10-15 17:55:05 -07:00
Xi Xia 329d7876bd
toString calls through getDescription (#1813) 2020-10-15 15:58:16 -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
Christian Neumüller e539890037
Add Context arg to SpanProcessor.OnStart. (#1792) 2020-10-14 11:34:19 +09:00
Anuraag Agrawal e2b5245d73
Rename newBuilder to builder for consistency. (#1790) 2020-10-13 13:17:06 -07:00
John Watson 22281d6f61
Change the Sampler interface to allow a SamplingResult to update the TraceState (#1707)
* Change the Sampler interface to have the SamplingResult contain the TraceState to use.

* revert errant change from another PR

* Change the SamplingResult API to allow a Function that will update the TraceState.

* revert an odd change from a rebase

* Change the SamplingResult to not have a functional response a concrete one.

* Add an additional bit of javadoc to the new method.
2020-10-12 22:46:02 -07:00
John Watson b5cae9b28b
Make the RERS return isRecording=false after it has ended. (#1789) 2020-10-13 11:45:11 +09:00
Bogdan Drutu 69117e6dea
Fix warnings found by idea IDE in the SDK dir. (#1773)
* Fix warnings found by idea IDE.

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

* Run spotlessApply

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

Co-authored-by: Anuraag Agrawal <aanuraag@amazon.co.jp>
2020-10-12 17:42:09 +09: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
Anuraag Agrawal d361dfa2f9
Remove SpanData implementation classes from public API. (#1761) 2020-10-06 10:17:11 -07:00