From ea599fd2f0be3068c0fae3c8dfd7c2b945769603 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Fri, 31 Mar 2023 16:08:19 -0500 Subject: [PATCH 1/5] Promote log API / SDK to stable --- README.md | 1 - .../api/GlobalOpenTelemetry.java | 6 + .../io/opentelemetry/api/OpenTelemetry.java | 49 +++++++ .../opentelemetry/api/logs/DefaultLogger.java | 0 .../api/logs/DefaultLoggerProvider.java | 0 .../api/logs/LogRecordBuilder.java | 0 .../io/opentelemetry/api/logs/Logger.java | 0 .../opentelemetry/api/logs/LoggerBuilder.java | 0 .../api/logs/LoggerProvider.java | 0 .../io/opentelemetry/api/logs/Severity.java | 0 .../opentelemetry/api/logs/package-info.java | 17 +++ .../opentelemetry/api/OpenTelemetryTest.java | 3 + .../api/logs/DefaultLoggerProviderTest.java | 0 .../api/logs/DefaultLoggerTest.java | 0 api/logs/build.gradle.kts | 13 -- api/logs/gradle.properties | 1 - .../api/logs/GlobalLoggerProvider.java | 58 -------- .../api/logs/GlobalLoggerProviderTest.java | 49 ------- .../current_vs_latest/opentelemetry-api.txt | 68 ++++++++- .../opentelemetry-sdk-logs.txt | 135 ++++++++++++++++++ .../current_vs_latest/opentelemetry-sdk.txt | 4 +- integration-tests/otlp/build.gradle.kts | 1 + .../OtlpExporterIntegrationTest.java | 2 +- sdk-extensions/autoconfigure/build.gradle.kts | 4 +- ...AutoConfiguredOpenTelemetrySdkBuilder.java | 4 +- .../AutoConfiguredOpenTelemetrySdkTest.java | 6 +- .../AutoConfiguredOpenTelemetrySdkTest.java | 2 - .../sdk/autoconfigure/ConfigErrorTest.java | 2 - .../sdk/autoconfigure/FullConfigTest.java | 5 +- sdk/all/build.gradle.kts | 5 +- .../opentelemetry/sdk/OpenTelemetrySdk.java | 44 +++++- sdk/logs/build.gradle.kts | 5 +- sdk/logs/gradle.properties | 1 - .../SdkEventEmitterProvider.java | 2 +- .../SdkEventEmitterProviderTest.java | 4 +- settings.gradle.kts | 1 - 36 files changed, 334 insertions(+), 158 deletions(-) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/DefaultLogger.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/DefaultLoggerProvider.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/Logger.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java (100%) rename api/{logs => all}/src/main/java/io/opentelemetry/api/logs/Severity.java (100%) create mode 100644 api/all/src/main/java/io/opentelemetry/api/logs/package-info.java rename api/{logs => all}/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java (100%) rename api/{logs => all}/src/test/java/io/opentelemetry/api/logs/DefaultLoggerTest.java (100%) delete mode 100644 api/logs/build.gradle.kts delete mode 100644 api/logs/gradle.properties delete mode 100644 api/logs/src/main/java/io/opentelemetry/api/logs/GlobalLoggerProvider.java delete mode 100644 api/logs/src/test/java/io/opentelemetry/api/logs/GlobalLoggerProviderTest.java create mode 100644 docs/apidiffs/current_vs_latest/opentelemetry-sdk-logs.txt delete mode 100644 sdk/logs/gradle.properties rename sdk/logs/src/main/java/io/opentelemetry/sdk/logs/{ => internal}/SdkEventEmitterProvider.java (98%) rename sdk/logs/src/test/java/io/opentelemetry/sdk/logs/{ => internal}/SdkEventEmitterProviderTest.java (94%) diff --git a/README.md b/README.md index 4af52f0a7af..34df730e40d 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,6 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti |-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| | [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | 1.24.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) | | [Events API](./api/logs) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.24.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | -| [Logs API](./api/logs) | OpenTelemetry Log API for bridging log frameworks (NOT a replacement for application logging frameworks like SLF4J, JUL, etc.) | `opentelemetry-api-logs` | 1.24.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-logs.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-logs) | | [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | 1.24.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) | | [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions | `opentelemetry-semconv` | 1.24.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) | diff --git a/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java b/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java index 10cb8953ff6..f48bb7b0611 100644 --- a/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java +++ b/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java @@ -7,6 +7,7 @@ import io.opentelemetry.api.internal.ConfigUtil; import io.opentelemetry.api.internal.GuardedBy; +import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.api.metrics.MeterBuilder; import io.opentelemetry.api.metrics.MeterProvider; @@ -281,6 +282,11 @@ public MeterProvider getMeterProvider() { return delegate.getMeterProvider(); } + @Override + public LoggerProvider getLoggerProvider() { + return delegate.getLoggerProvider(); + } + @Override public ContextPropagators getPropagators() { return delegate.getPropagators(); diff --git a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java index 9dbe5c7da3d..5de255e1551 100644 --- a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java +++ b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java @@ -5,6 +5,9 @@ package io.opentelemetry.api; +import io.opentelemetry.api.logs.Logger; +import io.opentelemetry.api.logs.LoggerBuilder; +import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.api.metrics.MeterBuilder; import io.opentelemetry.api.metrics.MeterProvider; @@ -113,6 +116,52 @@ default MeterBuilder meterBuilder(String instrumentationScopeName) { return getMeterProvider().meterBuilder(instrumentationScopeName); } + /** + * Returns the {@link LoggerProvider} for this {@link OpenTelemetry}. + * + *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge + * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via + * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. + * + * @since 1.26.0 + */ + default LoggerProvider getLoggerProvider() { + return LoggerProvider.noop(); + } + + /** + * Gets or creates a named logger instance from the {@link MeterProvider} for this {@link + * OpenTelemetry}. + * + *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge + * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via + * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. + * + * @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as + * the instrumentation library, package, or fully qualified class name. Must not be null. + * @return a Logger instance. + * @since 1.26.0 + */ + default Logger getLogger(String instrumentationScopeName) { + return getLoggerProvider().get(instrumentationScopeName); + } + + /** + * Creates a {@link LoggerBuilder} for a named {@link Tracer} instance. + * + *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge + * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via + * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. + * + * @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as + * the instrumentation library, package, or fully qualified class name. Must not be null. + * @return a LoggerBuilder instance. + * @since 1.26.0 + */ + default LoggerBuilder loggerBuilder(String instrumentationScopeName) { + return getLoggerProvider().loggerBuilder(instrumentationScopeName); + } + /** Returns the {@link ContextPropagators} for this {@link OpenTelemetry}. */ ContextPropagators getPropagators(); } diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/DefaultLogger.java b/api/all/src/main/java/io/opentelemetry/api/logs/DefaultLogger.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/DefaultLogger.java rename to api/all/src/main/java/io/opentelemetry/api/logs/DefaultLogger.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/DefaultLoggerProvider.java b/api/all/src/main/java/io/opentelemetry/api/logs/DefaultLoggerProvider.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/DefaultLoggerProvider.java rename to api/all/src/main/java/io/opentelemetry/api/logs/DefaultLoggerProvider.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java b/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java rename to api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/Logger.java b/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/Logger.java rename to api/all/src/main/java/io/opentelemetry/api/logs/Logger.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java rename to api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java rename to api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/Severity.java b/api/all/src/main/java/io/opentelemetry/api/logs/Severity.java similarity index 100% rename from api/logs/src/main/java/io/opentelemetry/api/logs/Severity.java rename to api/all/src/main/java/io/opentelemetry/api/logs/Severity.java diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/package-info.java b/api/all/src/main/java/io/opentelemetry/api/logs/package-info.java new file mode 100644 index 00000000000..fdeebc0e9a0 --- /dev/null +++ b/api/all/src/main/java/io/opentelemetry/api/logs/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * API for writing log appenders. + * + *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge + * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via + * {@link io.opentelemetry.api.logs.Logger#logRecordBuilder()}. It is NOT a replacement log + * framework. + */ +@ParametersAreNonnullByDefault +package io.opentelemetry.api.logs; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java b/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java index b84b01561ee..2ec175080d1 100644 --- a/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java +++ b/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java @@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; +import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.api.metrics.MeterProvider; import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.propagation.ContextPropagators; @@ -33,6 +34,7 @@ void testDefault() { assertThat(OpenTelemetry.noop().getTracerProvider()).isSameAs(TracerProvider.noop()); assertThat(OpenTelemetry.noop().getPropagators()).isSameAs(ContextPropagators.noop()); assertThat(OpenTelemetry.noop().getMeterProvider()).isSameAs(MeterProvider.noop()); + assertThat(OpenTelemetry.noop().getLoggerProvider()).isSameAs(LoggerProvider.noop()); } @Test @@ -42,6 +44,7 @@ void propagating() { assertThat(openTelemetry.getTracerProvider()).isSameAs(TracerProvider.noop()); assertThat(openTelemetry.getMeterProvider()).isSameAs(MeterProvider.noop()); + assertThat(openTelemetry.getLoggerProvider()).isSameAs(LoggerProvider.noop()); assertThat(openTelemetry.getPropagators()).isSameAs(contextPropagators); } diff --git a/api/logs/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java b/api/all/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java similarity index 100% rename from api/logs/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java rename to api/all/src/test/java/io/opentelemetry/api/logs/DefaultLoggerProviderTest.java diff --git a/api/logs/src/test/java/io/opentelemetry/api/logs/DefaultLoggerTest.java b/api/all/src/test/java/io/opentelemetry/api/logs/DefaultLoggerTest.java similarity index 100% rename from api/logs/src/test/java/io/opentelemetry/api/logs/DefaultLoggerTest.java rename to api/all/src/test/java/io/opentelemetry/api/logs/DefaultLoggerTest.java diff --git a/api/logs/build.gradle.kts b/api/logs/build.gradle.kts deleted file mode 100644 index db0a7514c43..00000000000 --- a/api/logs/build.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -plugins { - id("otel.java-conventions") - id("otel.publish-conventions") - - id("otel.animalsniffer-conventions") -} - -description = "OpenTelemetry Logs API" -otelJava.moduleName.set("io.opentelemetry.api.logs") - -dependencies { - api(project(":api:all")) -} diff --git a/api/logs/gradle.properties b/api/logs/gradle.properties deleted file mode 100644 index bbcbb896228..00000000000 --- a/api/logs/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -otel.release=alpha \ No newline at end of file diff --git a/api/logs/src/main/java/io/opentelemetry/api/logs/GlobalLoggerProvider.java b/api/logs/src/main/java/io/opentelemetry/api/logs/GlobalLoggerProvider.java deleted file mode 100644 index 1434ce87251..00000000000 --- a/api/logs/src/main/java/io/opentelemetry/api/logs/GlobalLoggerProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.api.logs; - -import io.opentelemetry.api.GlobalOpenTelemetry; -import java.util.concurrent.atomic.AtomicReference; -import javax.annotation.Nullable; - -/** - * This class provides a temporary global accessor for {@link LoggerProvider} until the log API is - * marked stable. It will eventually be merged into {@link GlobalOpenTelemetry}. - */ -// We intentionally assign to be used for error reporting. -@SuppressWarnings("StaticAssignmentOfThrowable") -public final class GlobalLoggerProvider { - - private static final AtomicReference instance = - new AtomicReference<>(LoggerProvider.noop()); - - @Nullable private static volatile Throwable setInstanceCaller; - - private GlobalLoggerProvider() {} - - /** Returns the globally registered {@link LoggerProvider}. */ - // instance cannot be set to null - @SuppressWarnings("NullAway") - public static LoggerProvider get() { - return instance.get(); - } - - /** - * Sets the global {@link LoggerProvider}. Future calls to {@link #get()} will return the provided - * {@link LoggerProvider} instance. This should be called once as early as possible in your - * application initialization logic. - */ - public static void set(LoggerProvider loggerProvider) { - boolean changed = instance.compareAndSet(LoggerProvider.noop(), loggerProvider); - if (!changed && (loggerProvider != LoggerProvider.noop())) { - throw new IllegalStateException( - "GlobalLoggerProvider.set has already been called. GlobalLoggerProvider.set " - + "must be called only once before any calls to GlobalLoggerProvider.get. " - + "Previous invocation set to cause of this exception.", - setInstanceCaller); - } - setInstanceCaller = new Throwable(); - } - - /** - * Unsets the global {@link LoggerProvider}. This is only meant to be used from tests which need - * to reconfigure {@link LoggerProvider}. - */ - public static void resetForTest() { - instance.set(LoggerProvider.noop()); - } -} diff --git a/api/logs/src/test/java/io/opentelemetry/api/logs/GlobalLoggerProviderTest.java b/api/logs/src/test/java/io/opentelemetry/api/logs/GlobalLoggerProviderTest.java deleted file mode 100644 index 5d1a9151adb..00000000000 --- a/api/logs/src/test/java/io/opentelemetry/api/logs/GlobalLoggerProviderTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.api.logs; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -class GlobalLoggerProviderTest { - - @BeforeAll - static void beforeClass() { - GlobalLoggerProvider.resetForTest(); - } - - @AfterEach - void after() { - GlobalLoggerProvider.resetForTest(); - } - - @Test - void setAndGet() { - assertThat(GlobalLoggerProvider.get()).isEqualTo(LoggerProvider.noop()); - LoggerProvider loggerProvider = - instrumentationScopeName -> LoggerProvider.noop().loggerBuilder(instrumentationScopeName); - GlobalLoggerProvider.set(loggerProvider); - assertThat(GlobalLoggerProvider.get()).isEqualTo(loggerProvider); - } - - @Test - void setThenSet() { - GlobalLoggerProvider.set( - instrumentationScopeName -> LoggerProvider.noop().loggerBuilder(instrumentationScopeName)); - assertThatThrownBy( - () -> - GlobalLoggerProvider.set( - instrumentationScopeName -> - LoggerProvider.noop().loggerBuilder(instrumentationScopeName))) - .isInstanceOf(IllegalStateException.class) - .hasMessageContaining("GlobalLoggerProvider.set has already been called") - .hasStackTraceContaining("setThenSet"); - } -} diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt index df26146497b..96535efa12a 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt @@ -1,2 +1,68 @@ Comparing source compatibility of against -No changes. \ No newline at end of file ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.Logger (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder logRecordBuilder() ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LoggerBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.Logger build() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LoggerBuilder setInstrumentationVersion(java.lang.String) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LoggerBuilder setSchemaUrl(java.lang.String) ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LoggerProvider (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.Logger get(java.lang.String) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LoggerBuilder loggerBuilder(java.lang.String) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.api.logs.LoggerProvider noop() ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) void emit() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LogRecordBuilder setAllAttributes(io.opentelemetry.api.common.Attributes) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setAttribute(io.opentelemetry.api.common.AttributeKey, java.lang.Object) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setBody(java.lang.String) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setContext(io.opentelemetry.context.Context) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setEpoch(long, java.util.concurrent.TimeUnit) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setEpoch(java.time.Instant) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setSeverity(io.opentelemetry.api.logs.Severity) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.LogRecordBuilder setSeverityText(java.lang.String) ++++ NEW ENUM: PUBLIC(+) FINAL(+) io.opentelemetry.api.logs.Severity (compatible) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: java.lang.constant.Constable + +++ NEW INTERFACE: java.lang.Comparable + +++ NEW INTERFACE: java.io.Serializable + +++ NEW SUPERCLASS: java.lang.Enum + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity WARN2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity WARN3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity WARN4 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity INFO + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity TRACE2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity DEBUG4 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity DEBUG3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity TRACE4 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity TRACE3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity ERROR + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity FATAL + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity TRACE + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity FATAL2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity FATAL3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity ERROR2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity ERROR3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity ERROR4 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity DEBUG2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity INFO3 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity DEBUG + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity INFO2 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity WARN + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity INFO4 + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity UNDEFINED_SEVERITY_NUMBER + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.api.logs.Severity FATAL4 + +++ NEW METHOD: PUBLIC(+) int getSeverityNumber() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.api.logs.Severity valueOf(java.lang.String) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.api.logs.Severity[] values() +*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.api.OpenTelemetry (not serializable) + === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.Logger getLogger(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLoggerProvider() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerBuilder loggerBuilder(java.lang.String) diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-logs.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-logs.txt new file mode 100644 index 00000000000..f7fd36e0b83 --- /dev/null +++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-logs.txt @@ -0,0 +1,135 @@ +Comparing source compatibility of against ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.data.Body (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String asString() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.data.Body empty() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.data.Body$Type getType() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.data.Body string(java.lang.String) ++++ NEW ENUM: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.sdk.logs.data.Body$Type (compatible) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: java.lang.constant.Constable + +++ NEW INTERFACE: java.lang.Comparable + +++ NEW INTERFACE: java.io.Serializable + +++ NEW SUPERCLASS: java.lang.Enum + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.sdk.logs.data.Body$Type STRING + +++ NEW FIELD: PUBLIC(+) STATIC(+) FINAL(+) io.opentelemetry.sdk.logs.data.Body$Type EMPTY + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.data.Body$Type valueOf(java.lang.String) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.data.Body$Type[] values() ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.data.LogRecordData (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.common.Attributes getAttributes() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.data.Body getBody() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) long getEpochNanos() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.resources.Resource getResource() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.logs.Severity getSeverity() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.String getSeverityText() + +++ NEW ANNOTATION: javax.annotation.Nullable + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.trace.SpanContext getSpanContext() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getTotalAttributeCount() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: io.opentelemetry.sdk.logs.LogRecordProcessor + +++ NEW INTERFACE: java.io.Closeable + +++ NEW INTERFACE: java.lang.AutoCloseable + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder builder(io.opentelemetry.sdk.logs.export.LogRecordExporter) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode forceFlush() + +++ NEW METHOD: PUBLIC(+) void onEmit(io.opentelemetry.context.Context, io.opentelemetry.sdk.logs.ReadWriteLogRecord) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() + +++ NEW METHOD: PUBLIC(+) java.lang.String toString() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor build() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setExporterTimeout(long, java.util.concurrent.TimeUnit) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setExporterTimeout(java.time.Duration) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setMaxExportBatchSize(int) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setMaxQueueSize(int) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setMeterProvider(io.opentelemetry.api.metrics.MeterProvider) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setScheduleDelay(long, java.util.concurrent.TimeUnit) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder setScheduleDelay(java.time.Duration) ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.export.InMemoryLogRecordExporter (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: io.opentelemetry.sdk.logs.export.LogRecordExporter + +++ NEW INTERFACE: java.io.Closeable + +++ NEW INTERFACE: java.lang.AutoCloseable + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.export.InMemoryLogRecordExporter create() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode export(java.util.Collection) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode flush() + +++ NEW METHOD: PUBLIC(+) java.util.List getFinishedLogItems() + +++ NEW METHOD: PUBLIC(+) void reset() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.export.LogRecordExporter (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: java.io.Closeable + +++ NEW INTERFACE: java.lang.AutoCloseable + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) void close() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.export.LogRecordExporter composite(io.opentelemetry.sdk.logs.export.LogRecordExporter[]) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.export.LogRecordExporter composite(java.lang.Iterable) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.common.CompletableResultCode export(java.util.Collection) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.common.CompletableResultCode flush() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.export.SimpleLogRecordProcessor (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: io.opentelemetry.sdk.logs.LogRecordProcessor + +++ NEW INTERFACE: java.io.Closeable + +++ NEW INTERFACE: java.lang.AutoCloseable + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.LogRecordProcessor create(io.opentelemetry.sdk.logs.export.LogRecordExporter) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode forceFlush() + +++ NEW METHOD: PUBLIC(+) void onEmit(io.opentelemetry.context.Context, io.opentelemetry.sdk.logs.ReadWriteLogRecord) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() + +++ NEW METHOD: PUBLIC(+) java.lang.String toString() ++++ NEW CLASS: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.LogLimits (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.LogLimitsBuilder builder() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.LogLimits getDefault() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getMaxAttributeValueLength() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) int getMaxNumberOfAttributes() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.LogLimitsBuilder toBuilder() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.LogLimitsBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.LogLimits build() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.LogLimitsBuilder setMaxAttributeValueLength(int) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.LogLimitsBuilder setMaxNumberOfAttributes(int) ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.LogRecordProcessor (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW INTERFACE: java.io.Closeable + +++ NEW INTERFACE: java.lang.AutoCloseable + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) void close() + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.LogRecordProcessor composite(io.opentelemetry.sdk.logs.LogRecordProcessor[]) + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.LogRecordProcessor composite(java.lang.Iterable) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode forceFlush() + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) void onEmit(io.opentelemetry.context.Context, io.opentelemetry.sdk.logs.ReadWriteLogRecord) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() ++++ NEW INTERFACE: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.ReadWriteLogRecord (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.ReadWriteLogRecord setAttribute(io.opentelemetry.api.common.AttributeKey, java.lang.Object) + +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.logs.data.LogRecordData toLogRecordData() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.SdkLoggerProvider (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder builder() + +++ NEW METHOD: PUBLIC(+) void close() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode forceFlush() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.Logger get(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerBuilder loggerBuilder(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.common.CompletableResultCode shutdown() + +++ NEW METHOD: PUBLIC(+) java.lang.String toString() ++++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder (not serializable) + +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. + +++ NEW SUPERCLASS: java.lang.Object + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder addLogRecordProcessor(io.opentelemetry.sdk.logs.LogRecordProcessor) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.SdkLoggerProvider build() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder setClock(io.opentelemetry.sdk.common.Clock) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder setLogLimits(java.util.function.Supplier) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder setResource(io.opentelemetry.sdk.resources.Resource) diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt index df26146497b..bb9e05af91c 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt @@ -1,2 +1,4 @@ Comparing source compatibility of against -No changes. \ No newline at end of file +*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.OpenTelemetrySdk (not serializable) + === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLoggerProvider() diff --git a/integration-tests/otlp/build.gradle.kts b/integration-tests/otlp/build.gradle.kts index 6b1dd94765e..514f0583cd7 100644 --- a/integration-tests/otlp/build.gradle.kts +++ b/integration-tests/otlp/build.gradle.kts @@ -10,6 +10,7 @@ dependencies { implementation(project(":exporters:otlp:all")) implementation(project(":exporters:otlp:logs")) + implementation(project(":api:events")) implementation(project(":semconv")) implementation("com.linecorp.armeria:armeria-grpc-protocol") diff --git a/integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java b/integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java index 691845a18e9..c2d5606126c 100644 --- a/integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java +++ b/integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java @@ -56,10 +56,10 @@ import io.opentelemetry.proto.trace.v1.ResourceSpans; import io.opentelemetry.proto.trace.v1.ScopeSpans; import io.opentelemetry.proto.trace.v1.Span.Link; -import io.opentelemetry.sdk.logs.SdkEventEmitterProvider; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; import io.opentelemetry.sdk.logs.export.LogRecordExporter; +import io.opentelemetry.sdk.logs.internal.SdkEventEmitterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.export.MetricExporter; import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader; diff --git a/sdk-extensions/autoconfigure/build.gradle.kts b/sdk-extensions/autoconfigure/build.gradle.kts index 03ed1932377..a45be6ed08e 100644 --- a/sdk-extensions/autoconfigure/build.gradle.kts +++ b/sdk-extensions/autoconfigure/build.gradle.kts @@ -8,10 +8,9 @@ otelJava.moduleName.set("io.opentelemetry.sdk.autoconfigure") dependencies { api(project(":sdk:all")) - api(project(":sdk:metrics")) - api(project(":sdk:logs")) api(project(":sdk-extensions:autoconfigure-spi")) + implementation(project(":api:events")) implementation(project(":semconv")) annotationProcessor("com.google.auto.value:auto-value") @@ -53,6 +52,7 @@ testing { } val testFullConfig by registering(JvmTestSuite::class) { dependencies { + implementation(project(":api:events")) implementation(project(":extensions:trace-propagators")) implementation(project(":exporters:jaeger")) implementation(project(":exporters:logging")) diff --git a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java index b983f431475..767ecf39224 100644 --- a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java +++ b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java @@ -9,7 +9,6 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.events.GlobalEventEmitterProvider; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.sdk.OpenTelemetrySdk; @@ -19,10 +18,10 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties; -import io.opentelemetry.sdk.logs.SdkEventEmitterProvider; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder; import io.opentelemetry.sdk.logs.export.LogRecordExporter; +import io.opentelemetry.sdk.logs.internal.SdkEventEmitterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; import io.opentelemetry.sdk.metrics.export.MetricExporter; @@ -399,7 +398,6 @@ public AutoConfiguredOpenTelemetrySdk build() { if (setResultAsGlobal) { GlobalOpenTelemetry.set(openTelemetrySdk); - GlobalLoggerProvider.set(openTelemetrySdk.getSdkLoggerProvider()); GlobalEventEmitterProvider.set( SdkEventEmitterProvider.create(openTelemetrySdk.getSdkLoggerProvider())); logger.log( diff --git a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java index 513c1f25638..9e4c6c39305 100644 --- a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java +++ b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java @@ -23,7 +23,6 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.events.GlobalEventEmitterProvider; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanId; import io.opentelemetry.api.trace.TraceId; @@ -38,9 +37,9 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.logs.LogRecordProcessor; -import io.opentelemetry.sdk.logs.SdkEventEmitterProvider; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder; +import io.opentelemetry.sdk.logs.internal.SdkEventEmitterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; import io.opentelemetry.sdk.metrics.export.MetricReader; @@ -145,7 +144,6 @@ public SdkLoggerProviderBuilder apply( @BeforeEach void resetGlobal() { GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); GlobalEventEmitterProvider.resetForTest(); builder = AutoConfiguredOpenTelemetrySdk.builder() @@ -360,7 +358,6 @@ void builder_setResultAsGlobalFalse() { OpenTelemetrySdk openTelemetry = builder.setResultAsGlobal(false).build().getOpenTelemetrySdk(); assertThat(GlobalOpenTelemetry.get()).extracting("delegate").isNotSameAs(openTelemetry); - assertThat(GlobalLoggerProvider.get()).isNotSameAs(openTelemetry.getSdkLoggerProvider()); assertThat(GlobalEventEmitterProvider.get()).isNotSameAs(openTelemetry.getSdkLoggerProvider()); } @@ -369,7 +366,6 @@ void builder_setResultAsGlobalTrue() { OpenTelemetrySdk openTelemetry = builder.setResultAsGlobal(true).build().getOpenTelemetrySdk(); assertThat(GlobalOpenTelemetry.get()).extracting("delegate").isSameAs(openTelemetry); - assertThat(GlobalLoggerProvider.get()).isSameAs(openTelemetry.getSdkLoggerProvider()); assertThat(GlobalEventEmitterProvider.get()) .isInstanceOf(SdkEventEmitterProvider.class) .extracting("delegateLoggerProvider") diff --git a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java index cdbc8efb9fc..c501d77991f 100644 --- a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java +++ b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkTest.java @@ -11,7 +11,6 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.events.GlobalEventEmitterProvider; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.sdk.OpenTelemetrySdk; import java.lang.reflect.Field; import org.junit.jupiter.api.BeforeEach; @@ -29,7 +28,6 @@ class AutoConfiguredOpenTelemetrySdkTest { @BeforeEach void setUp() { GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); GlobalEventEmitterProvider.resetForTest(); } diff --git a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/ConfigErrorTest.java b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/ConfigErrorTest.java index ca1f923c201..a1bf8dc10b2 100644 --- a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/ConfigErrorTest.java +++ b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/ConfigErrorTest.java @@ -11,7 +11,6 @@ import io.github.netmikey.logunit.api.LogCapturer; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.internal.testing.slf4j.SuppressLogger; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; @@ -32,7 +31,6 @@ class ConfigErrorTest { @BeforeEach void setup() { GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); } @Test diff --git a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java index 28f65682fd0..8f0723e10d5 100644 --- a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java +++ b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java @@ -20,7 +20,6 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.events.EventEmitter; import io.opentelemetry.api.events.GlobalEventEmitterProvider; -import io.opentelemetry.api.logs.GlobalLoggerProvider; import io.opentelemetry.api.logs.Logger; import io.opentelemetry.api.logs.Severity; import io.opentelemetry.api.metrics.Meter; @@ -162,7 +161,6 @@ void setUp() { // Initialize here so we can shutdown when done GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); GlobalEventEmitterProvider.resetForTest(); openTelemetrySdk = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk(); } @@ -171,7 +169,6 @@ void setUp() { void afterEach() { openTelemetrySdk.close(); GlobalOpenTelemetry.resetForTest(); - GlobalLoggerProvider.resetForTest(); GlobalEventEmitterProvider.resetForTest(); } @@ -207,7 +204,7 @@ void configures() throws Exception { .add(1, Attributes.builder().put("allowed", "bear").put("not allowed", "dog").build()); meter.counterBuilder("my-other-metric").build().add(1); - Logger logger = GlobalLoggerProvider.get().get("test"); + Logger logger = GlobalOpenTelemetry.get().getLogger("test"); logger.logRecordBuilder().setBody("debug log message").setSeverity(Severity.DEBUG).emit(); logger.logRecordBuilder().setBody("info log message").setSeverity(Severity.INFO).emit(); diff --git a/sdk/all/build.gradle.kts b/sdk/all/build.gradle.kts index 5f711c8c3a6..88d18b78ac7 100644 --- a/sdk/all/build.gradle.kts +++ b/sdk/all/build.gradle.kts @@ -15,10 +15,7 @@ dependencies { api(project(":sdk:common")) api(project(":sdk:trace")) api(project(":sdk:metrics")) - - // implementation dependency to require users to add the artifact directly to their build to use - // SdkLoggerProvider. - implementation(project(":sdk:logs")) + api(project(":sdk:logs")) annotationProcessor("com.google.auto.value:auto-value") 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 0d732f71b26..9095049ce53 100644 --- a/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java +++ b/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java @@ -6,6 +6,8 @@ package io.opentelemetry.sdk; import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.logs.LoggerBuilder; +import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.api.metrics.MeterBuilder; import io.opentelemetry.api.metrics.MeterProvider; import io.opentelemetry.api.trace.Tracer; @@ -33,7 +35,7 @@ public final class OpenTelemetrySdk implements OpenTelemetry, Closeable { private final AtomicBoolean isShutdown = new AtomicBoolean(false); private final ObfuscatedTracerProvider tracerProvider; private final ObfuscatedMeterProvider meterProvider; - private final SdkLoggerProvider loggerProvider; + private final ObfuscatedLoggerProvider loggerProvider; private final ContextPropagators propagators; OpenTelemetrySdk( @@ -43,7 +45,7 @@ public final class OpenTelemetrySdk implements OpenTelemetry, Closeable { ContextPropagators propagators) { this.tracerProvider = new ObfuscatedTracerProvider(tracerProvider); this.meterProvider = new ObfuscatedMeterProvider(meterProvider); - this.loggerProvider = loggerProvider; + this.loggerProvider = new ObfuscatedLoggerProvider(loggerProvider); this.propagators = propagators; } @@ -75,13 +77,18 @@ public SdkMeterProvider getSdkMeterProvider() { return meterProvider.unobfuscate(); } + @Override + public LoggerProvider getLoggerProvider() { + return loggerProvider; + } + /** * Returns the {@link SdkLoggerProvider} for this {@link OpenTelemetrySdk}. * * @since 1.19.0 */ public SdkLoggerProvider getSdkLoggerProvider() { - return loggerProvider; + return loggerProvider.unobfuscate(); } @Override @@ -103,7 +110,7 @@ public CompletableResultCode shutdown() { List results = new ArrayList<>(); results.add(tracerProvider.unobfuscate().shutdown()); results.add(meterProvider.unobfuscate().shutdown()); - results.add(loggerProvider.shutdown()); + results.add(loggerProvider.unobfuscate().shutdown()); return CompletableResultCode.ofAll(results); } @@ -120,7 +127,7 @@ public String toString() { + ", meterProvider=" + meterProvider.unobfuscate() + ", loggerProvider=" - + loggerProvider + + loggerProvider.unobfuscate() + ", propagators=" + propagators + "}"; @@ -189,4 +196,31 @@ public SdkMeterProvider unobfuscate() { return delegate; } } + + /** + * This class allows the SDK to unobfuscate an obfuscated static global provider. + * + *

Static global providers are obfuscated when they are returned from the API to prevent users + * from casting them to their SDK specific implementation. For example, we do not want users to + * use patterns like {@code (SdkMeterProvider) openTelemetry.getMeterProvider()}. + */ + @ThreadSafe + // Visible for testing + static class ObfuscatedLoggerProvider implements LoggerProvider { + + private final SdkLoggerProvider delegate; + + ObfuscatedLoggerProvider(SdkLoggerProvider delegate) { + this.delegate = delegate; + } + + @Override + public LoggerBuilder loggerBuilder(String instrumentationScopeName) { + return delegate.loggerBuilder(instrumentationScopeName); + } + + public SdkLoggerProvider unobfuscate() { + return delegate; + } + } } diff --git a/sdk/logs/build.gradle.kts b/sdk/logs/build.gradle.kts index 20c023af412..20c448c20dc 100644 --- a/sdk/logs/build.gradle.kts +++ b/sdk/logs/build.gradle.kts @@ -10,10 +10,11 @@ description = "OpenTelemetry Log SDK" otelJava.moduleName.set("io.opentelemetry.sdk.logs") dependencies { - api(project(":api:logs")) - api(project(":api:events")) + api(project(":api:all")) api(project(":sdk:common")) + implementation(project(":api:events")) + testImplementation(project(":sdk:logs-testing")) testImplementation("org.awaitility:awaitility") diff --git a/sdk/logs/gradle.properties b/sdk/logs/gradle.properties deleted file mode 100644 index 4476ae57e31..00000000000 --- a/sdk/logs/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -otel.release=alpha diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkEventEmitterProvider.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProvider.java similarity index 98% rename from sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkEventEmitterProvider.java rename to sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProvider.java index 1f36627fd05..810a90da032 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkEventEmitterProvider.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProvider.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.sdk.logs; +package io.opentelemetry.sdk.logs.internal; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; diff --git a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkEventEmitterProviderTest.java b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProviderTest.java similarity index 94% rename from sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkEventEmitterProviderTest.java rename to sdk/logs/src/test/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProviderTest.java index 550a7da2263..339e2780162 100644 --- a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkEventEmitterProviderTest.java +++ b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/internal/SdkEventEmitterProviderTest.java @@ -3,12 +3,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.sdk.logs; +package io.opentelemetry.sdk.logs.internal; import static io.opentelemetry.sdk.testing.assertj.LogAssertions.assertThat; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.logs.ReadWriteLogRecord; +import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.resources.Resource; import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.api.Test; diff --git a/settings.gradle.kts b/settings.gradle.kts index 5951d4cc89c..bec1ba39282 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,6 @@ rootProject.name = "opentelemetry-java" include(":all") include(":api:all") include(":api:events") -include(":api:logs") include(":semconv") include(":bom") include(":bom-alpha") From 07ac849800caf44916cfd758dd326b035cd090a4 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Tue, 4 Apr 2023 16:59:42 -0500 Subject: [PATCH 2/5] Reduce log API surface area, rename accessor to getLogsBridge --- .../api/GlobalOpenTelemetry.java | 4 +- .../io/opentelemetry/api/OpenTelemetry.java | 45 +++---------------- .../io/opentelemetry/api/logs/Logger.java | 4 ++ .../api/logs/LoggerProvider.java | 6 +-- .../opentelemetry/api/OpenTelemetryTest.java | 4 +- .../current_vs_latest/opentelemetry-api.txt | 4 +- .../current_vs_latest/opentelemetry-sdk.txt | 2 +- .../sdk/autoconfigure/FullConfigTest.java | 2 +- .../opentelemetry/sdk/OpenTelemetrySdk.java | 2 +- 9 files changed, 20 insertions(+), 53 deletions(-) diff --git a/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java b/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java index f48bb7b0611..3e2244a95bb 100644 --- a/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java +++ b/api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java @@ -283,8 +283,8 @@ public MeterProvider getMeterProvider() { } @Override - public LoggerProvider getLoggerProvider() { - return delegate.getLoggerProvider(); + public LoggerProvider getLogsBridge() { + return delegate.getLogsBridge(); } @Override diff --git a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java index 5de255e1551..a5d8e89e664 100644 --- a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java +++ b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java @@ -5,8 +5,6 @@ package io.opentelemetry.api; -import io.opentelemetry.api.logs.Logger; -import io.opentelemetry.api.logs.LoggerBuilder; import io.opentelemetry.api.logs.LoggerProvider; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.api.metrics.MeterBuilder; @@ -117,51 +115,18 @@ default MeterBuilder meterBuilder(String instrumentationScopeName) { } /** - * Returns the {@link LoggerProvider} for this {@link OpenTelemetry}. + * Returns the {@link LoggerProvider} for bridging logs into OpenTelemetry. * - *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge - * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via - * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. + *

The OpenTelemetry logs bridge API exists to enable bridging logs from other log frameworks + * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log + * API. * * @since 1.26.0 */ - default LoggerProvider getLoggerProvider() { + default LoggerProvider getLogsBridge() { return LoggerProvider.noop(); } - /** - * Gets or creates a named logger instance from the {@link MeterProvider} for this {@link - * OpenTelemetry}. - * - *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge - * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via - * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. - * - * @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as - * the instrumentation library, package, or fully qualified class name. Must not be null. - * @return a Logger instance. - * @since 1.26.0 - */ - default Logger getLogger(String instrumentationScopeName) { - return getLoggerProvider().get(instrumentationScopeName); - } - - /** - * Creates a {@link LoggerBuilder} for a named {@link Tracer} instance. - * - *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge - * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via - * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. - * - * @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as - * the instrumentation library, package, or fully qualified class name. Must not be null. - * @return a LoggerBuilder instance. - * @since 1.26.0 - */ - default LoggerBuilder loggerBuilder(String instrumentationScopeName) { - return getLoggerProvider().loggerBuilder(instrumentationScopeName); - } - /** Returns the {@link ContextPropagators} for this {@link OpenTelemetry}. */ ContextPropagators getPropagators(); } diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java b/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java index 900a2a51727..60beb9118bf 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java @@ -12,6 +12,10 @@ * *

Obtain a {@link #logRecordBuilder()}, add properties using the setters, and emit it via {@link * LogRecordBuilder#emit()}. + * + *

The OpenTelemetry logs bridge API exists to enable bridging logs from other log frameworks + * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log + * API. */ @ThreadSafe public interface Logger { diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java index f105fdb0113..d7b7debea30 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java @@ -11,9 +11,9 @@ * A registry for creating scoped {@link Logger}s. The name Provider is for consistency with * other languages and it is NOT loaded using reflection. * - *

The OpenTelemetry logging API exists to enable the creation of log appenders, which bridge - * logs from other log frameworks (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry via - * {@link Logger#logRecordBuilder()}. It is NOT a replacement log framework. + *

The OpenTelemetry logs bridge API exists to enable bridging logs from other log frameworks + * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log + * API. * * @see Logger */ diff --git a/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java b/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java index 2ec175080d1..5acab04f817 100644 --- a/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java +++ b/api/all/src/test/java/io/opentelemetry/api/OpenTelemetryTest.java @@ -34,7 +34,7 @@ void testDefault() { assertThat(OpenTelemetry.noop().getTracerProvider()).isSameAs(TracerProvider.noop()); assertThat(OpenTelemetry.noop().getPropagators()).isSameAs(ContextPropagators.noop()); assertThat(OpenTelemetry.noop().getMeterProvider()).isSameAs(MeterProvider.noop()); - assertThat(OpenTelemetry.noop().getLoggerProvider()).isSameAs(LoggerProvider.noop()); + assertThat(OpenTelemetry.noop().getLogsBridge()).isSameAs(LoggerProvider.noop()); } @Test @@ -44,7 +44,7 @@ void propagating() { assertThat(openTelemetry.getTracerProvider()).isSameAs(TracerProvider.noop()); assertThat(openTelemetry.getMeterProvider()).isSameAs(MeterProvider.noop()); - assertThat(openTelemetry.getLoggerProvider()).isSameAs(LoggerProvider.noop()); + assertThat(openTelemetry.getLogsBridge()).isSameAs(LoggerProvider.noop()); assertThat(openTelemetry.getPropagators()).isSameAs(contextPropagators); } diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt index 96535efa12a..18252be0b1f 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt @@ -63,6 +63,4 @@ Comparing source compatibility of against +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.api.logs.Severity[] values() *** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.api.OpenTelemetry (not serializable) === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 - +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.Logger getLogger(java.lang.String) - +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLoggerProvider() - +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerBuilder loggerBuilder(java.lang.String) + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLogsBridge() diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt index bb9e05af91c..2a24e0786f8 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk.txt @@ -1,4 +1,4 @@ Comparing source compatibility of against *** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.OpenTelemetrySdk (not serializable) === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 - +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLoggerProvider() + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.logs.LoggerProvider getLogsBridge() diff --git a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java index 8f0723e10d5..7a1a1f705f5 100644 --- a/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java +++ b/sdk-extensions/autoconfigure/src/testFullConfig/java/io/opentelemetry/sdk/autoconfigure/FullConfigTest.java @@ -204,7 +204,7 @@ void configures() throws Exception { .add(1, Attributes.builder().put("allowed", "bear").put("not allowed", "dog").build()); meter.counterBuilder("my-other-metric").build().add(1); - Logger logger = GlobalOpenTelemetry.get().getLogger("test"); + Logger logger = GlobalOpenTelemetry.get().getLogsBridge().get("test"); logger.logRecordBuilder().setBody("debug log message").setSeverity(Severity.DEBUG).emit(); logger.logRecordBuilder().setBody("info log message").setSeverity(Severity.INFO).emit(); 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 9095049ce53..81c1c3dd8c1 100644 --- a/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java +++ b/sdk/all/src/main/java/io/opentelemetry/sdk/OpenTelemetrySdk.java @@ -78,7 +78,7 @@ public SdkMeterProvider getSdkMeterProvider() { } @Override - public LoggerProvider getLoggerProvider() { + public LoggerProvider getLogsBridge() { return loggerProvider; } From 17ce101bd7c3a60ff6dc0c11e3aac833073a2ff6 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Fri, 21 Apr 2023 11:33:29 -0500 Subject: [PATCH 3/5] Fix broken link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d705a6e8e20..48621fa3be3 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti | Component | Description | Artifact ID | Version | Javadoc | |-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| | [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | 1.25.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) | -| [Events API](./api/logs) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.25.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | +| [Events API](./api/events) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.25.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | | [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | 1.25.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) | | [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions | `opentelemetry-semconv` | 1.25.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) | From 030e8569a3603f5dc48db1ee0b764e88b337d3ec Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Fri, 5 May 2023 16:51:10 -0500 Subject: [PATCH 4/5] Fix readme --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index fa70b71dd45..67e658c1b1c 100644 --- a/README.md +++ b/README.md @@ -223,18 +223,10 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti | Component | Description | Artifact ID | Version | Javadoc | |-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| -<<<<<<< HEAD -| [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | 1.25.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) | -| [Events API](./api/events) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.25.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | -| [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | 1.25.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) | -| [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions | `opentelemetry-semconv` | 1.25.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) | -======= | [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | 1.26.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) | -| [Events API](./api/logs) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.26.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | -| [Logs API](./api/logs) | OpenTelemetry Log API for bridging log frameworks (NOT a replacement for application logging frameworks like SLF4J, JUL, etc.) | `opentelemetry-api-logs` | 1.26.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-logs.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-logs) | +| [Events API](./api/events) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | 1.26.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) | | [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | 1.26.0 | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) | | [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions | `opentelemetry-semconv` | 1.26.0-alpha | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) | ->>>>>>> 7812ad82e25c81d755bca8a38406faad5a9a0b9c ### API Extensions From 0c61c4584af86767491658747430ef8157a70fb8 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Mon, 8 May 2023 15:07:18 -0500 Subject: [PATCH 5/5] Add since annotations --- .../src/main/java/io/opentelemetry/api/OpenTelemetry.java | 2 +- .../java/io/opentelemetry/api/logs/LogRecordBuilder.java | 2 ++ api/all/src/main/java/io/opentelemetry/api/logs/Logger.java | 2 ++ .../main/java/io/opentelemetry/api/logs/LoggerBuilder.java | 2 ++ .../main/java/io/opentelemetry/api/logs/LoggerProvider.java | 1 + .../src/main/java/io/opentelemetry/api/logs/Severity.java | 5 +++++ .../src/main/java/io/opentelemetry/sdk/logs/LogLimits.java | 2 ++ .../java/io/opentelemetry/sdk/logs/LogLimitsBuilder.java | 6 +++++- .../java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java | 6 +++++- .../java/io/opentelemetry/sdk/logs/SdkLoggerProvider.java | 6 +++++- .../io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java | 6 +++++- .../src/main/java/io/opentelemetry/sdk/logs/data/Body.java | 2 ++ .../java/io/opentelemetry/sdk/logs/data/LogRecordData.java | 2 ++ .../sdk/logs/export/BatchLogRecordProcessor.java | 2 ++ .../sdk/logs/export/BatchLogRecordProcessorBuilder.java | 6 +++++- .../io/opentelemetry/sdk/logs/export/LogRecordExporter.java | 2 ++ .../sdk/logs/export/SimpleLogRecordProcessor.java | 2 ++ 17 files changed, 50 insertions(+), 6 deletions(-) diff --git a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java index a5d8e89e664..22851ade5d9 100644 --- a/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java +++ b/api/all/src/main/java/io/opentelemetry/api/OpenTelemetry.java @@ -121,7 +121,7 @@ default MeterBuilder meterBuilder(String instrumentationScopeName) { * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log * API. * - * @since 1.26.0 + * @since 1.27.0 */ default LoggerProvider getLogsBridge() { return LoggerProvider.noop(); diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java b/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java index 7f158810842..1b7e24d19a9 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java @@ -16,6 +16,8 @@ * *

Obtain a {@link Logger#logRecordBuilder()}, add properties using the setters, and emit the log * record by calling {@link #emit()}. + * + * @since 1.27.0 */ public interface LogRecordBuilder { diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java b/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java index 60beb9118bf..50b8035bb5d 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/Logger.java @@ -16,6 +16,8 @@ *

The OpenTelemetry logs bridge API exists to enable bridging logs from other log frameworks * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log * API. + * + * @since 1.27.0 */ @ThreadSafe public interface Logger { diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java index fb3cc737980..859315998bf 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerBuilder.java @@ -11,6 +11,8 @@ *

{@link Logger}s are identified by their scope name, version, and schema URL. These identifying * fields, along with attributes, combine to form the instrumentation scope, which is attached to * all log records produced by the {@link Logger}. + * + * @since 1.27.0 */ public interface LoggerBuilder { diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java index d7b7debea30..d00cb310ffc 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/LoggerProvider.java @@ -15,6 +15,7 @@ * (e.g. SLF4J, Log4j, JUL, Logback, etc) into OpenTelemetry and is NOT a replacement log * API. * + * @since 1.27.0 * @see Logger */ @ThreadSafe diff --git a/api/all/src/main/java/io/opentelemetry/api/logs/Severity.java b/api/all/src/main/java/io/opentelemetry/api/logs/Severity.java index 91b4d825a91..95ea5bc3c20 100644 --- a/api/all/src/main/java/io/opentelemetry/api/logs/Severity.java +++ b/api/all/src/main/java/io/opentelemetry/api/logs/Severity.java @@ -5,6 +5,11 @@ package io.opentelemetry.api.logs; +/** + * Log record severity options. + * + * @since 1.27.0 + */ public enum Severity { UNDEFINED_SEVERITY_NUMBER(0), TRACE(1), diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimits.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimits.java index 97420043e77..eb98802acd9 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimits.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimits.java @@ -16,6 +16,8 @@ *

Note: To allow dynamic updates of {@link LogLimits} you should register a {@link * java.util.function.Supplier} with {@link SdkLoggerProviderBuilder#setLogLimits(Supplier)} which * supplies dynamic configs when queried. + * + * @since 1.27.0 */ @AutoValue @Immutable diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimitsBuilder.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimitsBuilder.java index 847829784d7..22650d4d896 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimitsBuilder.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/LogLimitsBuilder.java @@ -8,7 +8,11 @@ import io.opentelemetry.api.internal.Utils; import io.opentelemetry.sdk.logs.data.LogRecordData; -/** Builder for {@link LogLimits}. */ +/** + * Builder for {@link LogLimits}. + * + * @since 1.27.0 + */ public final class LogLimitsBuilder { private static final int DEFAULT_LOG_MAX_NUM_ATTRIBUTES = 128; diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java index d491b1e94e7..aa86dc82488 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java @@ -8,7 +8,11 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.sdk.logs.data.LogRecordData; -/** A log record that can be read from and written to. */ +/** + * A log record that can be read from and written to. + * + * @since 1.27.0 + */ public interface ReadWriteLogRecord { /** diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProvider.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProvider.java index eceb0f5d36b..9b9b2e1a97d 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProvider.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProvider.java @@ -20,7 +20,11 @@ import java.util.logging.Level; import javax.annotation.Nullable; -/** SDK implementation for {@link LoggerProvider}. */ +/** + * SDK implementation for {@link LoggerProvider}. + * + * @since 1.27.0 + */ public final class SdkLoggerProvider implements LoggerProvider, Closeable { static final String DEFAULT_LOGGER_NAME = "unknown"; diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java index 0c1d7c69e69..485731822f1 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/SdkLoggerProviderBuilder.java @@ -17,7 +17,11 @@ import java.util.List; import java.util.function.Supplier; -/** Builder class for {@link SdkLoggerProvider} instances. */ +/** + * Builder class for {@link SdkLoggerProvider} instances. + * + * @since 1.27.0 + */ public final class SdkLoggerProviderBuilder { private final List logRecordProcessors = new ArrayList<>(); diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/Body.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/Body.java index 78bcdeb2509..a13ecc003fe 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/Body.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/Body.java @@ -12,6 +12,8 @@ * have 1 type of values: {@code String}, represented through {@code Body.Type}. This class will * likely be extended in the future to include additional body types supported by the OpenTelemetry * log data model. + * + * @since 1.27.0 */ @Immutable public interface Body { diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/LogRecordData.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/LogRecordData.java index 1631e55ce3b..eb2f8dcde81 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/LogRecordData.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/data/LogRecordData.java @@ -18,6 +18,8 @@ * Log definition as described in OpenTelemetry * Log Data Model. + * + * @since 1.27.0 */ @Immutable public interface LogRecordData { diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessor.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessor.java index 01b5effc7fa..e31d0548703 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessor.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessor.java @@ -36,6 +36,8 @@ * {@code maxQueueSize} maximum size, if queue is full logs are dropped). Logs are exported either * when there are {@code maxExportBatchSize} pending logs or {@code scheduleDelayNanos} has passed * since the last export finished. + * + * @since 1.27.0 */ public final class BatchLogRecordProcessor implements LogRecordProcessor { diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessorBuilder.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessorBuilder.java index c47cbafc94e..6aafa9525aa 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessorBuilder.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/BatchLogRecordProcessorBuilder.java @@ -12,7 +12,11 @@ import java.time.Duration; import java.util.concurrent.TimeUnit; -/** Builder class for {@link BatchLogRecordProcessor}. */ +/** + * Builder class for {@link BatchLogRecordProcessor}. + * + * @since 1.27.0 + */ public final class BatchLogRecordProcessorBuilder { // Visible for testing diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/LogRecordExporter.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/LogRecordExporter.java index 180d0d8ef29..9b0fd51facb 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/LogRecordExporter.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/LogRecordExporter.java @@ -19,6 +19,8 @@ /** * An exporter is responsible for taking a collection of {@link LogRecordData}s and transmitting * them to their ultimate destination. + * + * @since 1.27.0 */ public interface LogRecordExporter extends Closeable { diff --git a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/SimpleLogRecordProcessor.java b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/SimpleLogRecordProcessor.java index a548fec9126..9b5c4791ef4 100644 --- a/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/SimpleLogRecordProcessor.java +++ b/sdk/logs/src/main/java/io/opentelemetry/sdk/logs/export/SimpleLogRecordProcessor.java @@ -29,6 +29,8 @@ * so unless you know what you're doing, strongly consider using {@link BatchLogRecordProcessor} * instead, including in special environments such as serverless runtimes. {@link * SimpleLogRecordProcessor} is generally meant to for testing only. + * + * @since 1.27.0 */ public final class SimpleLogRecordProcessor implements LogRecordProcessor {