diff --git a/api/src/main/java/io/opentelemetry/api/OpenTelemetry.java b/api/src/main/java/io/opentelemetry/api/OpenTelemetry.java index d4c61656da3..0dc9ce0a99a 100644 --- a/api/src/main/java/io/opentelemetry/api/OpenTelemetry.java +++ b/api/src/main/java/io/opentelemetry/api/OpenTelemetry.java @@ -12,6 +12,7 @@ import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.propagation.ContextPropagators; +import javax.annotation.Nullable; /** * The entrypoint to telemetry functionality for tracing, metrics and baggage. @@ -169,7 +170,7 @@ default Tracer getTracer(String instrumentationName) { * "semver:1.0.0"). * @return a tracer instance. */ - default Tracer getTracer(String instrumentationName, String instrumentationVersion) { + default Tracer getTracer(String instrumentationName, @Nullable String instrumentationVersion) { return getGlobalTracerProvider().get(instrumentationName, instrumentationVersion); } diff --git a/api/src/main/java/io/opentelemetry/api/metrics/DefaultMeterProvider.java b/api/src/main/java/io/opentelemetry/api/metrics/DefaultMeterProvider.java index 4516c098dc5..b35a5a288a4 100644 --- a/api/src/main/java/io/opentelemetry/api/metrics/DefaultMeterProvider.java +++ b/api/src/main/java/io/opentelemetry/api/metrics/DefaultMeterProvider.java @@ -5,6 +5,7 @@ package io.opentelemetry.api.metrics; +import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; @ThreadSafe @@ -22,7 +23,7 @@ public Meter get(String instrumentationName) { } @Override - public Meter get(String instrumentationName, String instrumentationVersion) { + public Meter get(String instrumentationName, @Nullable String instrumentationVersion) { return Meter.getDefault(); } diff --git a/api/src/main/java/io/opentelemetry/api/metrics/MeterProvider.java b/api/src/main/java/io/opentelemetry/api/metrics/MeterProvider.java index ceedaca7da3..92719ecb1e2 100644 --- a/api/src/main/java/io/opentelemetry/api/metrics/MeterProvider.java +++ b/api/src/main/java/io/opentelemetry/api/metrics/MeterProvider.java @@ -6,6 +6,7 @@ package io.opentelemetry.api.metrics; import io.opentelemetry.api.OpenTelemetry; +import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; /** @@ -43,5 +44,5 @@ static MeterProvider getDefault() { * @param instrumentationVersion The version of the instrumentation library. * @return a tracer instance. */ - Meter get(String instrumentationName, String instrumentationVersion); + Meter get(String instrumentationName, @Nullable String instrumentationVersion); } diff --git a/api/src/main/java/io/opentelemetry/api/trace/DefaultTracerProvider.java b/api/src/main/java/io/opentelemetry/api/trace/DefaultTracerProvider.java index 7cb4219efc8..88ac1b216c8 100644 --- a/api/src/main/java/io/opentelemetry/api/trace/DefaultTracerProvider.java +++ b/api/src/main/java/io/opentelemetry/api/trace/DefaultTracerProvider.java @@ -5,6 +5,7 @@ package io.opentelemetry.api.trace; +import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; @ThreadSafe @@ -22,7 +23,7 @@ public Tracer get(String instrumentationName) { } @Override - public Tracer get(String instrumentationName, String instrumentationVersion) { + public Tracer get(String instrumentationName, @Nullable String instrumentationVersion) { return Tracer.getDefault(); } diff --git a/api/src/main/java/io/opentelemetry/api/trace/TracerProvider.java b/api/src/main/java/io/opentelemetry/api/trace/TracerProvider.java index 67bd240c6b7..c2eec22944d 100644 --- a/api/src/main/java/io/opentelemetry/api/trace/TracerProvider.java +++ b/api/src/main/java/io/opentelemetry/api/trace/TracerProvider.java @@ -7,6 +7,7 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.spi.TracerProviderFactory; +import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; /** @@ -45,5 +46,5 @@ static TracerProvider getDefault() { * "semver:1.0.0"). * @return a tracer instance. */ - Tracer get(String instrumentationName, String instrumentationVersion); + Tracer get(String instrumentationName, @Nullable String instrumentationVersion); } diff --git a/api/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java b/api/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java index 94986824b31..ba1e7ad6629 100644 --- a/api/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java +++ b/api/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java @@ -206,7 +206,7 @@ public Tracer get(String instrumentationName) { } @Override - public Tracer get(String instrumentationName, String instrumentationVersion) { + public Tracer get(String instrumentationName, @Nullable String instrumentationVersion) { return get(instrumentationName); } @@ -230,7 +230,7 @@ public Meter get(String instrumentationName) { } @Override - public Meter get(String instrumentationName, String instrumentationVersion) { + public Meter get(String instrumentationName, @Nullable String instrumentationVersion) { return get(instrumentationName); } @@ -332,7 +332,7 @@ public Meter get(String instrumentationName) { } @Override - public Meter get(String instrumentationName, String instrumentationVersion) { + public Meter get(String instrumentationName, @Nullable String instrumentationVersion) { return get(instrumentationName); } } diff --git a/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java b/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java index 14e7d4430af..50fc91a8247 100644 --- a/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java +++ b/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java @@ -299,7 +299,7 @@ public Tracer get(String instrumentationName) { } @Override - public Tracer get(String instrumentationName, String instrumentationVersion) { + public Tracer get(String instrumentationName, @Nullable String instrumentationVersion) { return delegate.get(instrumentationName, instrumentationVersion); }