diff --git a/CHANGELOG.md b/CHANGELOG.md index a5511b69ca519..34dfa498ee02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Bump `com.netflix.nebula:nebula-publishing-plugin` from 19.2.0 to 20.3.0 - Bump `com.diffplug.spotless` from 6.17.0 to 6.18.0 - Bump `io.opencensus:opencensus-api` from 0.18.0 to 0.31.1 ([#7291](https://github.com/opensearch-project/OpenSearch/pull/7291)) +- Add Opentelemetry dependencies ([#7543](https://github.com/opensearch-project/OpenSearch/issues/7543)) ### Changed - [CCR] Add getHistoryOperationsFromTranslog method to fetch the history snapshot from translogs ([#3948](https://github.com/opensearch-project/OpenSearch/pull/3948)) @@ -100,6 +101,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Added @dbwiddis as on OpenSearch maintainer ([#7665](https://github.com/opensearch-project/OpenSearch/pull/7665)) - [Extensions] Add ExtensionAwarePlugin extension point to add custom settings for extensions ([#7526](https://github.com/opensearch-project/OpenSearch/pull/7526)) - Add new cluster setting to set default index replication type ([#7420](https://github.com/opensearch-project/OpenSearch/pull/7420)) +- Add distributed tracing framework ([#7543](https://github.com/opensearch-project/OpenSearch/issues/7543)) ### Dependencies - Bump `com.netflix.nebula:gradle-info-plugin` from 12.0.0 to 12.1.3 (#7564) diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 549f2574581d3..2859cea764807 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -57,3 +57,6 @@ bytebuddy = 1.14.3 # benchmark dependencies jmh = 1.35 + +# opentelemetry dependencies +opentelemetry = 1.23.1 diff --git a/distribution/src/config/log4j2.properties b/distribution/src/config/log4j2.properties index bb27aaf2e22e6..7017ef854c96d 100644 --- a/distribution/src/config/log4j2.properties +++ b/distribution/src/config/log4j2.properties @@ -232,3 +232,22 @@ logger.task_detailslog_rolling.level = trace logger.task_detailslog_rolling.appenderRef.task_detailslog_rolling.ref = task_detailslog_rolling logger.task_detailslog_rolling.appenderRef.task_detailslog_rolling_old.ref = task_detailslog_rolling_old logger.task_detailslog_rolling.additivity = false +######## Distributed Tracing logs JSON #################### +appender.tracing_log_rolling.type = RollingFile +appender.tracing_log_rolling.name = tracing_log_rolling +appender.tracing_log_rolling.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_tracing.trace +appender.tracing_log_rolling.filePermissions = rw-r----- +appender.tracing_log_rolling.layout.type = PatternLayout +appender.tracing_log_rolling.layout.pattern = %m%n +appender.tracing_log_rolling.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_tracing-%i.trace.gz +appender.tracing_log_rolling.policies.type = Policies +appender.tracing_log_rolling.policies.size.type = SizeBasedTriggeringPolicy +appender.tracing_log_rolling.policies.size.size = 1GB +appender.tracing_log_rolling.strategy.type = DefaultRolloverStrategy +appender.tracing_log_rolling.strategy.max = 4 +################################################# +logger.tracing_log.name = tracing_log +logger.tracing_log.level = trace +logger.tracing_log.appenderRef.tracing_log_rolling.ref = tracing_log_rolling +logger.tracing_log.appenderRef.tracing_log_rolling_old.ref = tracing_log_rolling +logger.tracing_log.additivity = false diff --git a/modules/tracer-otel/build.gradle b/modules/tracer-otel/build.gradle new file mode 100644 index 0000000000000..5413d4a4d3990 --- /dev/null +++ b/modules/tracer-otel/build.gradle @@ -0,0 +1,69 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.tools.ant.taskdefs.condition.Os +import org.opensearch.gradle.Architecture +import org.opensearch.gradle.OS +import org.opensearch.gradle.info.BuildParams + +opensearchplugin { + description 'Opentelemetry based Tracer implementation.' + classname 'org.opensearch.tracing.OTelTracerModulePlugin' + hasClientJar = true +} + +dependencies { + api "io.opentelemetry:opentelemetry-api:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-context:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-sdk-common:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-sdk-trace:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-sdk-metrics:${versions.opentelemetry}" + api "io.opentelemetry:opentelemetry-semconv:${versions.opentelemetry}-alpha" + api "io.opentelemetry:opentelemetry-sdk-logs:${versions.opentelemetry}-alpha" + api "io.opentelemetry:opentelemetry-api-logs:${versions.opentelemetry}-alpha" +} + + +thirdPartyAudit { + ignoreViolations( + 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField', + 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField', + 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField', + 'io.opentelemetry.internal.shaded.jctools.util.UnsafeAccess', + 'io.opentelemetry.internal.shaded.jctools.util.UnsafeRefArrayAccess' + ) + + ignoreMissingClasses( + 'io.opentelemetry.api.events.EventEmitter', + 'io.opentelemetry.api.events.EventEmitterBuilder', + 'io.opentelemetry.api.events.EventEmitterProvider' + ) +} diff --git a/server/licenses/opentelemetry-api-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-api-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-api-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-api-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-api-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-api-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-api-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-api-LICENSE.txt diff --git a/server/licenses/opentelemetry-api-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-api-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-api-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-api-NOTICE.txt diff --git a/server/licenses/opentelemetry-api-logs-1.23.1-alpha.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-api-logs-1.23.1-alpha.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-api-logs-1.23.1-alpha.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-api-logs-1.23.1-alpha.jar.sha1 diff --git a/server/licenses/opentelemetry-api-logs-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-api-logs-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-api-logs-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-api-logs-LICENSE.txt diff --git a/server/licenses/opentelemetry-api-logs-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-api-logs-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-api-logs-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-api-logs-NOTICE.txt diff --git a/server/licenses/opentelemetry-context-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-context-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-context-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-context-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-context-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-context-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-context-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-context-LICENSE.txt diff --git a/server/licenses/opentelemetry-context-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-context-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-context-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-context-NOTICE.txt diff --git a/server/licenses/opentelemetry-sdk-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-sdk-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-sdk-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-sdk-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-sdk-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-LICENSE.txt diff --git a/server/licenses/opentelemetry-sdk-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-NOTICE.txt diff --git a/server/licenses/opentelemetry-sdk-common-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-sdk-common-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-sdk-common-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-sdk-common-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-sdk-common-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-common-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-common-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-common-LICENSE.txt diff --git a/server/licenses/opentelemetry-sdk-common-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-common-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-common-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-common-NOTICE.txt diff --git a/server/licenses/opentelemetry-sdk-logs-1.23.1-alpha.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-sdk-logs-1.23.1-alpha.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-sdk-logs-1.23.1-alpha.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-sdk-logs-1.23.1-alpha.jar.sha1 diff --git a/server/licenses/opentelemetry-sdk-logs-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-logs-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-logs-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-logs-LICENSE.txt diff --git a/server/licenses/opentelemetry-sdk-logs-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-logs-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-logs-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-logs-NOTICE.txt diff --git a/server/licenses/opentelemetry-sdk-metrics-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-sdk-metrics-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-sdk-metrics-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-sdk-metrics-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-sdk-metrics-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-metrics-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-metrics-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-metrics-LICENSE.txt diff --git a/server/licenses/opentelemetry-sdk-metrics-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-metrics-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-metrics-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-metrics-NOTICE.txt diff --git a/server/licenses/opentelemetry-sdk-trace-1.23.1.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-sdk-trace-1.23.1.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-sdk-trace-1.23.1.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-sdk-trace-1.23.1.jar.sha1 diff --git a/server/licenses/opentelemetry-sdk-trace-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-trace-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-trace-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-trace-LICENSE.txt diff --git a/server/licenses/opentelemetry-sdk-trace-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-sdk-trace-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-sdk-trace-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-sdk-trace-NOTICE.txt diff --git a/server/licenses/opentelemetry-semconv-1.23.1-alpha.jar.sha1 b/modules/tracer-otel/licenses/opentelemetry-semconv-1.23.1-alpha.jar.sha1 similarity index 100% rename from server/licenses/opentelemetry-semconv-1.23.1-alpha.jar.sha1 rename to modules/tracer-otel/licenses/opentelemetry-semconv-1.23.1-alpha.jar.sha1 diff --git a/server/licenses/opentelemetry-semconv-LICENSE.txt b/modules/tracer-otel/licenses/opentelemetry-semconv-LICENSE.txt similarity index 100% rename from server/licenses/opentelemetry-semconv-LICENSE.txt rename to modules/tracer-otel/licenses/opentelemetry-semconv-LICENSE.txt diff --git a/server/licenses/opentelemetry-semconv-NOTICE.txt b/modules/tracer-otel/licenses/opentelemetry-semconv-NOTICE.txt similarity index 100% rename from server/licenses/opentelemetry-semconv-NOTICE.txt rename to modules/tracer-otel/licenses/opentelemetry-semconv-NOTICE.txt diff --git a/server/src/main/java/org/opensearch/tracing/OSSpan.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultSpan.java similarity index 79% rename from server/src/main/java/org/opensearch/tracing/OSSpan.java rename to modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultSpan.java index d5b60799cef0c..77744c4101ae7 100644 --- a/server/src/main/java/org/opensearch/tracing/OSSpan.java +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultSpan.java @@ -11,17 +11,17 @@ import io.opentelemetry.api.trace.SpanContext; /** - * Default implementation of {@link Span}. It keeps a reference of OpenTelemetry Span and handles span + * Default implementation of {@link Span} using Otel span. It keeps a reference of OpenTelemetry Span and handles span * lifecycle management by delegating calls to it. */ -class OSSpan implements Span { +class DefaultSpan implements Span { private final String spanName; private final io.opentelemetry.api.trace.Span otelSpan; private final Span parentSpan; private final Level level; - public OSSpan(String spanName, io.opentelemetry.api.trace.Span span, Span parentSpan, Level level) { + public DefaultSpan(String spanName, io.opentelemetry.api.trace.Span span, Span parentSpan, Level level) { this.spanName = spanName; this.otelSpan = span; this.parentSpan = parentSpan; diff --git a/server/src/main/java/org/opensearch/tracing/DefaultTracer.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultTracer.java similarity index 72% rename from server/src/main/java/org/opensearch/tracing/DefaultTracer.java rename to modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultTracer.java index ecaab906a5760..c4a06bc5f73bf 100644 --- a/server/src/main/java/org/opensearch/tracing/DefaultTracer.java +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/DefaultTracer.java @@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger; import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.threadpool.ThreadPool; +import org.opensearch.tracing.noop.NoopSpan; import java.io.Closeable; import java.io.IOException; @@ -30,8 +31,6 @@ */ public class DefaultTracer implements Tracer { - public static final String CURRENT_SPAN = "current_span"; - private static final Logger logger = LogManager.getLogger(DefaultTracer.class); private static final String TRACE_ID = "trace_id"; private static final String SPAN_ID = "span_id"; @@ -46,6 +45,13 @@ public class DefaultTracer implements Tracer { private final io.opentelemetry.api.trace.Tracer otelTracer; private final OpenTelemetry openTelemetry; + /** + * Creates DefaultTracer instance + * + * @param openTelemetry Otel global Opentelemetry instance + * @param threadPool Thread pool + * @param tracerSettings tracer related settings + */ public DefaultTracer(OpenTelemetry openTelemetry, ThreadPool threadPool, TracerSettings tracerSettings) { this.openTelemetry = openTelemetry; this.otelTracer = openTelemetry.getTracer("os-tracer"); @@ -93,8 +99,8 @@ public void addAttribute(String key, boolean value) { @Override public void addEvent(String event) { Span currentSpan = getCurrentSpan(); - if (currentSpan instanceof OSSpan && ((OSSpan) currentSpan).getOtelSpan() != null) { - ((OSSpan) currentSpan).getOtelSpan().addEvent(event); + if (currentSpan instanceof DefaultSpan && ((DefaultSpan) currentSpan).getOtelSpan() != null) { + ((DefaultSpan) currentSpan).getOtelSpan().addEvent(event); } } @@ -119,7 +125,7 @@ private Span spanFromHeader() { Context context = TracerUtils.extractTracerContextFromHeader(threadPool.getThreadContext().getHeaders()); if (context != null) { io.opentelemetry.api.trace.Span span = io.opentelemetry.api.trace.Span.fromContext(context); - return new OSSpan(ROOT_SPAN, span, null, Level.ROOT); + return new DefaultSpan(ROOT_SPAN, span, null, Level.ROOT); } return null; } @@ -132,14 +138,14 @@ private Optional spanFromThreadContext() { } private Span createSpan(String spanName, Span parentSpan, Level level) { - return isLevelEnabled(level) ? createOSSpan(spanName, parentSpan, level) : createNoopSpan(spanName, parentSpan, level); + return isLevelEnabled(level) ? createDefaultSpan(spanName, parentSpan, level) : createNoopSpan(spanName, parentSpan, level); } - private Span createOSSpan(String spanName, Span parentSpan, Level level) { - OSSpan parentOSSpan = getLastValidSpanInChain(parentSpan); - io.opentelemetry.api.trace.Span otelSpan = createOtelSpan(spanName, parentOSSpan); - Span span = new OSSpan(spanName, otelSpan, parentSpan, level); - logger.debug( + private Span createDefaultSpan(String spanName, Span parentSpan, Level level) { + DefaultSpan parentDefaultSpan = getLastValidSpanInChain(parentSpan); + io.opentelemetry.api.trace.Span otelSpan = createOtelSpan(spanName, parentDefaultSpan); + Span span = new DefaultSpan(spanName, otelSpan, parentSpan, level); + logger.trace( "Starting OtelSpan spanId:{} name:{}: traceId:{}", otelSpan.getSpanContext().getSpanId(), span.getSpanName(), @@ -149,22 +155,22 @@ private Span createOSSpan(String spanName, Span parentSpan, Level level) { } private NoopSpan createNoopSpan(String spanName, Span parentSpan, Level level) { - logger.debug("Starting Noop span name:{}", spanName); + logger.trace("Starting Noop span name:{}", spanName); return new NoopSpan(spanName, parentSpan, level); } - private OSSpan getLastValidSpanInChain(Span parentSpan) { + private DefaultSpan getLastValidSpanInChain(Span parentSpan) { while (parentSpan instanceof NoopSpan) { parentSpan = parentSpan.getParentSpan(); } - return (OSSpan) parentSpan; + return (DefaultSpan) parentSpan; } // visible for testing - io.opentelemetry.api.trace.Span createOtelSpan(String spanName, OSSpan parentOSSpan) { - return parentOSSpan == null + io.opentelemetry.api.trace.Span createOtelSpan(String spanName, DefaultSpan parentDefaultSpan) { + return parentDefaultSpan == null ? otelTracer.spanBuilder(spanName).startSpan() - : otelTracer.spanBuilder(spanName).setParent(Context.current().with(parentOSSpan.getOtelSpan())).startSpan(); + : otelTracer.spanBuilder(spanName).setParent(Context.current().with(parentDefaultSpan.getOtelSpan())).startSpan(); } private boolean isLevelEnabled(Level level) { @@ -186,42 +192,45 @@ private void setCurrentSpanInContext(Span span) { } private void endSpan(Span span) { - if (span instanceof OSSpan && ((OSSpan) span).getOtelSpan() != null) { - OSSpan osSpan = (OSSpan) span; - logger.debug( + if (span instanceof DefaultSpan && ((DefaultSpan) span).getOtelSpan() != null) { + DefaultSpan defaultSpan = (DefaultSpan) span; + logger.trace( "Ending span spanId:{} name:{}: traceId:{}", - osSpan.getSpanContext().getSpanId(), + defaultSpan.getSpanContext().getSpanId(), span.getSpanName(), - osSpan.getSpanContext().getTraceId() + defaultSpan.getSpanContext().getTraceId() ); - osSpan.getOtelSpan().end(); + defaultSpan.getOtelSpan().end(); } else { - logger.debug("Ending noop span name:{}", span.getSpanName()); + logger.trace("Ending noop span name:{}", span.getSpanName()); } } private void setSpanAttributes(Span span) { - if (span instanceof OSSpan) { - addDefaultAttributes((OSSpan) span); + if (span instanceof DefaultSpan) { + addDefaultAttributes((DefaultSpan) span); } } private void addSingleAttribute(AttributeKey key, T value) { Span currentSpan = getCurrentSpan(); - if (currentSpan instanceof OSSpan && ((OSSpan) currentSpan).getOtelSpan() != null) { - ((OSSpan) currentSpan).getOtelSpan().setAttribute(key, value); + if (currentSpan instanceof DefaultSpan && ((DefaultSpan) currentSpan).getOtelSpan() != null) { + ((DefaultSpan) currentSpan).getOtelSpan().setAttribute(key, value); } } - private void addDefaultAttributes(OSSpan osSpan) { - if (osSpan != null) { - addSingleAttribute(AttributeKey.stringKey(SPAN_ID), osSpan.getSpanContext().getSpanId()); - addSingleAttribute(AttributeKey.stringKey(TRACE_ID), osSpan.getSpanContext().getTraceId()); - addSingleAttribute(AttributeKey.stringKey(SPAN_NAME), osSpan.getSpanName()); + private void addDefaultAttributes(DefaultSpan defaultSpan) { + if (defaultSpan != null) { + addSingleAttribute(AttributeKey.stringKey(SPAN_ID), defaultSpan.getSpanContext().getSpanId()); + addSingleAttribute(AttributeKey.stringKey(TRACE_ID), defaultSpan.getSpanContext().getTraceId()); + addSingleAttribute(AttributeKey.stringKey(SPAN_NAME), defaultSpan.getSpanName()); addSingleAttribute(AttributeKey.stringKey(THREAD_NAME), Thread.currentThread().getName()); - if (osSpan.getParentSpan() != null && osSpan.getParentSpan() instanceof OSSpan) { - addSingleAttribute(AttributeKey.stringKey(PARENT_SPAN_ID), ((OSSpan) osSpan.getParentSpan()).getSpanContext().getSpanId()); - addSingleAttribute(AttributeKey.stringKey(PARENT_SPAN_NAME), osSpan.getParentSpan().getSpanName()); + if (defaultSpan.getParentSpan() != null && defaultSpan.getParentSpan() instanceof DefaultSpan) { + addSingleAttribute( + AttributeKey.stringKey(PARENT_SPAN_ID), + ((DefaultSpan) defaultSpan.getParentSpan()).getSpanContext().getSpanId() + ); + addSingleAttribute(AttributeKey.stringKey(PARENT_SPAN_NAME), defaultSpan.getParentSpan().getSpanName()); } } } diff --git a/server/src/main/java/org/opensearch/tracing/OTelResourceProvider.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelResourceProvider.java similarity index 85% rename from server/src/main/java/org/opensearch/tracing/OTelResourceProvider.java rename to modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelResourceProvider.java index 1eaedef88a912..b2bea01cc16df 100644 --- a/server/src/main/java/org/opensearch/tracing/OTelResourceProvider.java +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelResourceProvider.java @@ -12,12 +12,12 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator; import io.opentelemetry.context.propagation.ContextPropagators; -import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import org.opensearch.tracing.exporter.FileSpanExporter; import java.util.concurrent.TimeUnit; @@ -26,20 +26,19 @@ */ class OTelResourceProvider { - private static final Resource resource; private static final ContextPropagators contextPropagators; private static volatile OpenTelemetry OPEN_TELEMETRY; static { - resource = Resource.getDefault().merge(Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "OpenSearch"))); contextPropagators = ContextPropagators.create(W3CTraceContextPropagator.getInstance()); } static OpenTelemetry getOrCreateOpenTelemetryInstance(TracerSettings tracerSettings) { if (OPEN_TELEMETRY == null) { + Resource resource = Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "OpenSearch")); SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder() .addSpanProcessor( - BatchSpanProcessor.builder(OtlpGrpcSpanExporter.builder().setTimeout(10, TimeUnit.SECONDS).build()) + BatchSpanProcessor.builder(new FileSpanExporter()) .setScheduleDelay(tracerSettings.getExporterDelay().getSeconds(), TimeUnit.SECONDS) .setMaxExportBatchSize(tracerSettings.getExporterBatchSize()) .setMaxQueueSize(tracerSettings.getExporterMaxQueueSize()) diff --git a/modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelTracerModulePlugin.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelTracerModulePlugin.java new file mode 100644 index 0000000000000..845028cf9c7b9 --- /dev/null +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelTracerModulePlugin.java @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing; + +import io.opentelemetry.api.OpenTelemetry; +import org.opensearch.common.settings.Settings; +import org.opensearch.plugins.Plugin; +import org.opensearch.plugins.TracerPlugin; +import org.opensearch.threadpool.ThreadPool; + +import java.util.Collections; +import java.util.Map; +import java.util.function.Supplier; + +/** + * Tracer plugin based on Otel + */ +public class OTelTracerModulePlugin extends Plugin implements TracerPlugin { + + private static final String OTEL_TRACER_NAME = "otel"; + + /** + * No-args constructor + */ + public OTelTracerModulePlugin() {} + + @Override + public Settings additionalSettings() { + return Settings.builder() + // set Otel tracer as default tracer + .put(TracerModule.TRACER_DEFAULT_TYPE_SETTING.getKey(), OTEL_TRACER_NAME) + .build(); + } + + @Override + public Map> getTracers(ThreadPool threadPool, TracerSettings tracerSettings) { + return Collections.singletonMap(OTEL_TRACER_NAME, () -> createDefaultTracer(threadPool, tracerSettings)); + } + + @Override + public Map getHeaderInjectors() { + return Collections.singletonMap(OTEL_TRACER_NAME, new OtelTracerHeaderInjector()); + } + + private Tracer createDefaultTracer(ThreadPool threadPool, TracerSettings tracerSettings) { + OpenTelemetry openTelemetry = OTelResourceProvider.getOrCreateOpenTelemetryInstance(tracerSettings); + return new DefaultTracer(openTelemetry, threadPool, tracerSettings); + } +} diff --git a/modules/tracer-otel/src/main/java/org/opensearch/tracing/OtelTracerHeaderInjector.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OtelTracerHeaderInjector.java new file mode 100644 index 0000000000000..1b4b2682a11cd --- /dev/null +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/OtelTracerHeaderInjector.java @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing; + +import java.util.Map; +import java.util.function.BiConsumer; + +/** + * Otel based header injector. This adds Otel headers to facilitate context propagation. + */ +public class OtelTracerHeaderInjector implements TracerHeaderInjector { + /** + * No-args constructor + */ + public OtelTracerHeaderInjector() {} + + @Override + public BiConsumer, Map> injectHeader() { + return TracerUtils.addTracerContextToHeader(); + } +} diff --git a/server/src/main/java/org/opensearch/tracing/TracerUtils.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/TracerUtils.java similarity index 61% rename from server/src/main/java/org/opensearch/tracing/TracerUtils.java rename to modules/tracer-otel/src/main/java/org/opensearch/tracing/TracerUtils.java index 3f1234088a1d3..d1eadecba3bed 100644 --- a/server/src/main/java/org/opensearch/tracing/TracerUtils.java +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/TracerUtils.java @@ -11,16 +11,22 @@ import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapGetter; import io.opentelemetry.context.propagation.TextMapSetter; +import org.opensearch.tracing.noop.NoopSpan; import java.util.Map; +import java.util.function.BiConsumer; -import static org.opensearch.tracing.DefaultTracer.CURRENT_SPAN; +import static org.opensearch.tracing.Tracer.CURRENT_SPAN; /** * Contains utils methods for tracing */ public class TracerUtils { + private TracerUtils() { + + } + private static final TextMapSetter> TEXT_MAP_SETTER = (carrier, key, value) -> { if (carrier != null) { carrier.put(key, value); @@ -45,30 +51,35 @@ public String get(Map headers, String key) { /** * Adds current active span as tracing context in the header during outbound calls */ - public static void addTracerContextToHeader(Map requestHeaders, Map transientHeaders) { - if (transientHeaders != null && transientHeaders.containsKey(CURRENT_SPAN)) { - SpanHolder spanHolder = (SpanHolder) transientHeaders.get(CURRENT_SPAN); - Span currentSpan = spanHolder.getSpan(); - OSSpan osSpan = getLastValidSpanInChain(currentSpan); - OTelResourceProvider.getContextPropagators().getTextMapPropagator().inject(context(osSpan), requestHeaders, TEXT_MAP_SETTER); - } + public static final BiConsumer, Map> addTracerContextToHeader() { + return (requestHeaders, transientHeaders) -> { + if (transientHeaders != null && transientHeaders.containsKey(CURRENT_SPAN)) { + SpanHolder spanHolder = (SpanHolder) transientHeaders.get(CURRENT_SPAN); + Span currentSpan = spanHolder.getSpan(); + DefaultSpan defaultSpan = getLastValidSpanInChain(currentSpan); + OTelResourceProvider.getContextPropagators() + .getTextMapPropagator() + .inject(context(defaultSpan), requestHeaders, TEXT_MAP_SETTER); + } + }; } /** * Fetches the tracing context from headers + * @param headers request header map */ public static Context extractTracerContextFromHeader(Map headers) { return OTelResourceProvider.getContextPropagators().getTextMapPropagator().extract(Context.current(), headers, TEXT_MAP_GETTER); } - private static Context context(OSSpan osSpan) { - return Context.current().with(io.opentelemetry.api.trace.Span.wrap(osSpan.getSpanContext())); + private static Context context(DefaultSpan defaultSpan) { + return Context.current().with(io.opentelemetry.api.trace.Span.wrap(defaultSpan.getSpanContext())); } - private static OSSpan getLastValidSpanInChain(Span span) { + private static DefaultSpan getLastValidSpanInChain(Span span) { while (span instanceof NoopSpan) { span = span.getParentSpan(); } - return (OSSpan) span; + return (DefaultSpan) span; } } diff --git a/modules/tracer-otel/src/main/java/org/opensearch/tracing/exporter/FileSpanExporter.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/exporter/FileSpanExporter.java new file mode 100644 index 0000000000000..220b6601a6469 --- /dev/null +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/exporter/FileSpanExporter.java @@ -0,0 +1,81 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing.exporter; + +import io.opentelemetry.sdk.common.CompletableResultCode; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.trace.data.SpanData; +import io.opentelemetry.sdk.trace.export.SpanExporter; +import java.util.Collection; +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * Writes the span to a log file. This is mostly for testing where you can trace one request and all your spans + * will be written to a file. Tracing log file would be available in the logs directory. + */ +public class FileSpanExporter implements SpanExporter { + public static final String TRACING_LOG_PREFIX = "tracing_log"; + private static final Logger TRACING_LOGGER = LogManager.getLogger(TRACING_LOG_PREFIX); + private final Logger DEFAULT_LOGGER = LogManager.getLogger(FileSpanExporter.class); + private final String FIELD_SEPARATOR = "\t"; + + private final AtomicBoolean isShutdown = new AtomicBoolean(); + + @Override + public CompletableResultCode export(Collection spans) { + if (isShutdown.get()) { + return CompletableResultCode.ofFailure(); + } + StringBuilder sb = new StringBuilder(128); + for (SpanData span : spans) { + sb.setLength(0); + InstrumentationScopeInfo instrumentationScopeInfo = span.getInstrumentationScopeInfo(); + sb.append("'") + .append(span.getName()) + .append("'") + .append(FIELD_SEPARATOR) + .append(span.getTraceId()) + .append(FIELD_SEPARATOR) + .append(span.getSpanId()) + .append(FIELD_SEPARATOR) + .append(span.getParentSpanId()) + .append(FIELD_SEPARATOR) + .append(span.getKind()) + .append(FIELD_SEPARATOR) + .append(span.getStartEpochNanos()) + .append(FIELD_SEPARATOR) + .append(span.getEndEpochNanos()) + .append(FIELD_SEPARATOR) + .append("[tracer:") + .append(instrumentationScopeInfo.getName()) + .append(":") + .append(instrumentationScopeInfo.getVersion() == null ? "" : instrumentationScopeInfo.getVersion()) + .append("]") + .append(FIELD_SEPARATOR) + .append(span.getAttributes()); + TRACING_LOGGER.info(sb.toString()); + } + return CompletableResultCode.ofSuccess(); + } + + @Override + public CompletableResultCode flush() { + return CompletableResultCode.ofSuccess(); + } + + @Override + public CompletableResultCode shutdown() { + if (!isShutdown.compareAndSet(false, true)) { + DEFAULT_LOGGER.info("Duplicate shutdown() calls."); + } + return CompletableResultCode.ofSuccess(); + } +} diff --git a/modules/tracer-otel/src/main/java/org/opensearch/tracing/package-info.java b/modules/tracer-otel/src/main/java/org/opensearch/tracing/package-info.java new file mode 100644 index 0000000000000..40572895df90c --- /dev/null +++ b/modules/tracer-otel/src/main/java/org/opensearch/tracing/package-info.java @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/** + * This package contains classes needed for tracing requests. + */ +package org.opensearch.tracing; diff --git a/modules/tracer-otel/src/main/plugin-metadata/plugin-security.policy b/modules/tracer-otel/src/main/plugin-metadata/plugin-security.policy new file mode 100644 index 0000000000000..ac07c2a265bd8 --- /dev/null +++ b/modules/tracer-otel/src/main/plugin-metadata/plugin-security.policy @@ -0,0 +1,36 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +grant { +}; + + diff --git a/server/src/test/java/org/opensearch/tracing/DefaultTracerTests.java b/modules/tracer-otel/src/test/java/org/opensearch/tracing/DefaultTracerTests.java similarity index 96% rename from server/src/test/java/org/opensearch/tracing/DefaultTracerTests.java rename to modules/tracer-otel/src/test/java/org/opensearch/tracing/DefaultTracerTests.java index 85f060b4a0acd..71c6ed6388d7c 100644 --- a/server/src/test/java/org/opensearch/tracing/DefaultTracerTests.java +++ b/modules/tracer-otel/src/test/java/org/opensearch/tracing/DefaultTracerTests.java @@ -36,7 +36,7 @@ public class DefaultTracerTests extends OpenSearchTestCase { private TracerSettings tracerSettings; - private ArgumentCaptor captor; + private ArgumentCaptor captor; private SpanBuilder mockSpanBuilder; @@ -77,7 +77,7 @@ public void testStartSpanAndEndWithNoopSpans() { verify(tracer, times(4)).createOtelSpan(any(), captor.capture()); verify(mockSpanBuilder, times(4)).startSpan(); assertEquals("span4", tracer.getCurrentSpan().getSpanName()); - OSSpan value = captor.getValue(); + DefaultSpan value = captor.getValue(); assertEquals("span3", value.getSpanName()); tracer.endSpan(); assertEquals("noop-span-2", tracer.getCurrentSpan().getSpanName()); @@ -118,7 +118,7 @@ private void setupMock() { openTelemetry = mock(OpenTelemetry.class); Tracer mockTracer = mock(Tracer.class); when(openTelemetry.getTracer(any(String.class))).thenReturn(mockTracer); - captor = ArgumentCaptor.forClass(OSSpan.class); + captor = ArgumentCaptor.forClass(DefaultSpan.class); mockSpanBuilder = mock(SpanBuilder.class); mockOtelSpan = mock(io.opentelemetry.api.trace.Span.class); when(mockOtelSpan.getSpanContext()).thenReturn(mock(SpanContext.class)); diff --git a/server/src/test/java/org/opensearch/tracing/TracerUtilsTests.java b/modules/tracer-otel/src/test/java/org/opensearch/tracing/TracerUtilsTests.java similarity index 84% rename from server/src/test/java/org/opensearch/tracing/TracerUtilsTests.java rename to modules/tracer-otel/src/test/java/org/opensearch/tracing/TracerUtilsTests.java index ed9f494a37cc5..c943e7645537d 100644 --- a/server/src/test/java/org/opensearch/tracing/TracerUtilsTests.java +++ b/modules/tracer-otel/src/test/java/org/opensearch/tracing/TracerUtilsTests.java @@ -14,13 +14,14 @@ import io.opentelemetry.api.trace.TraceState; import io.opentelemetry.context.Context; import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.tracing.noop.NoopSpan; import java.util.HashMap; import java.util.Map; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.opensearch.tracing.DefaultTracer.CURRENT_SPAN; +import static org.opensearch.tracing.Tracer.CURRENT_SPAN; public class TracerUtilsTests extends OpenSearchTestCase { @@ -30,23 +31,23 @@ public class TracerUtilsTests extends OpenSearchTestCase { public void testAddTracerContextToHeader() { Span mockSpan = mock(Span.class); when(mockSpan.getSpanContext()).thenReturn(SpanContext.create(TRACE_ID, SPAN_ID, TraceFlags.getDefault(), TraceState.getDefault())); - OSSpan span = new OSSpan("spanName", mockSpan, null, Level.INFO); + DefaultSpan span = new DefaultSpan("spanName", mockSpan, null, Level.INFO); SpanHolder spanHolder = new SpanHolder(span); Map transientHeaders = Map.of(CURRENT_SPAN, spanHolder); Map requestHeaders = new HashMap<>(); - TracerUtils.addTracerContextToHeader(requestHeaders, transientHeaders); + TracerUtils.addTracerContextToHeader().accept(requestHeaders, transientHeaders); assertEquals("00-" + TRACE_ID + "-" + SPAN_ID + "-00", requestHeaders.get("traceparent")); } public void testAddTracerContextToHeaderWithNoopSpan() { Span mockSpan = mock(Span.class); when(mockSpan.getSpanContext()).thenReturn(SpanContext.create(TRACE_ID, SPAN_ID, TraceFlags.getDefault(), TraceState.getDefault())); - OSSpan span = new OSSpan("spanName", mockSpan, null, Level.INFO); + DefaultSpan span = new DefaultSpan("spanName", mockSpan, null, Level.INFO); NoopSpan noopSpan = new NoopSpan("noopSpanName", span, Level.INFO); SpanHolder spanHolder = new SpanHolder(noopSpan); Map transientHeaders = Map.of(CURRENT_SPAN, spanHolder); Map requestHeaders = new HashMap<>(); - TracerUtils.addTracerContextToHeader(requestHeaders, transientHeaders); + TracerUtils.addTracerContextToHeader().accept(requestHeaders, transientHeaders); assertEquals("00-" + TRACE_ID + "-" + SPAN_ID + "-00", requestHeaders.get("traceparent")); } diff --git a/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/FileSpanExporterTests.java b/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/FileSpanExporterTests.java new file mode 100644 index 0000000000000..6bac3030bceaa --- /dev/null +++ b/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/FileSpanExporterTests.java @@ -0,0 +1,94 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing.exporter; + +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.sdk.common.CompletableResultCode; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.internal.AttributesMap; +import io.opentelemetry.sdk.trace.data.SpanData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.mockito.Mockito; +import org.opensearch.common.logging.Loggers; +import org.opensearch.test.OpenSearchTestCase; + +import java.util.Arrays; +import java.util.Locale; + +public class FileSpanExporterTests extends OpenSearchTestCase { + private static MockAppender appender; + private static Logger testLogger1 = LogManager.getLogger(FileSpanExporter.TRACING_LOG_PREFIX); + + @BeforeClass + public static void init() throws IllegalAccessException { + appender = new MockAppender("trace_appender"); + appender.start(); + Loggers.addAppender(testLogger1, appender); + } + + @AfterClass + public static void cleanup() { + Loggers.removeAppender(testLogger1, appender); + appender.stop(); + } + + private final FileSpanExporter spanExporter = new FileSpanExporter(); + + public void testOutputFormat() { + String name = "TestSpan"; + String traceId = "6b44b6eadda4535388c406d3ba8894d4"; + String spanId = "96a0878e2febe8ba"; + String parentSpanId = "72a0878e2febg8fc"; + SpanData mockedSpanData = Mockito.mock(SpanData.class); + Mockito.when(mockedSpanData.getName()).thenReturn(name); + Mockito.when(mockedSpanData.getTraceId()).thenReturn(traceId); + Mockito.when(mockedSpanData.getSpanId()).thenReturn(spanId); + Mockito.when(mockedSpanData.getParentSpanId()).thenReturn(parentSpanId); + Mockito.when(mockedSpanData.getKind()).thenReturn(SpanKind.INTERNAL); + Mockito.when(mockedSpanData.getInstrumentationScopeInfo()) + .thenReturn(InstrumentationScopeInfo.create("instrumentation-library-name", "1.0.0", null)); + + AttributesMap attributesMap = AttributesMap.create(128, 128); + attributesMap.put(AttributeKey.stringKey("SpanId"), spanId); + + Mockito.when(mockedSpanData.getAttributes()).thenReturn(attributesMap); + + spanExporter.export(Arrays.asList(mockedSpanData)); + String logData = appender.getLastEventAndReset().getMessage().getFormattedMessage(); + assertEquals(getExpectedLogMessage(name, traceId, spanId, parentSpanId, attributesMap), logData); + assertEquals(CompletableResultCode.ofSuccess(), spanExporter.flush()); + assertEquals(CompletableResultCode.ofSuccess(), spanExporter.shutdown()); + + spanExporter.export(Arrays.asList(mockedSpanData)); + assertNull(appender.getLastEventAndReset()); + } + + private String getExpectedLogMessage(String name, String traceId, String spanId, String parentSpanId, AttributesMap attributesMap) { + return String.format( + Locale.ROOT, + "'%s'\t%s\t%s\t%s\t%s\t%d\t%d\t[%s:%s:%s]\t%s", + name, + traceId, + spanId, + parentSpanId, + "INTERNAL", + 0, + 0, + "tracer", + "instrumentation-library-name", + "1.0.0", + attributesMap + ); + } + +} diff --git a/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/MockAppender.java b/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/MockAppender.java new file mode 100644 index 0000000000000..b74d2cc8c0820 --- /dev/null +++ b/modules/tracer-otel/src/test/java/org/opensearch/tracing/exporter/MockAppender.java @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +package org.opensearch.tracing.exporter; + +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.appender.AbstractAppender; +import org.apache.logging.log4j.core.filter.RegexFilter; +import org.apache.logging.log4j.message.ParameterizedMessage; + +public class MockAppender extends AbstractAppender { + public LogEvent lastEvent; + + public MockAppender(final String name) throws IllegalAccessException { + super(name, RegexFilter.createFilter(".*(\n.*)*", new String[0], false, null, null), null); + } + + @Override + public void append(LogEvent event) { + lastEvent = event.toImmutable(); + } + + ParameterizedMessage lastParameterizedMessage() { + return (ParameterizedMessage) lastEvent.getMessage(); + } + + public LogEvent getLastEventAndReset() { + LogEvent toReturn = lastEvent; + lastEvent = null; + return toReturn; + } +} diff --git a/server/build.gradle b/server/build.gradle index eefc174b6a403..62c0002dc1398 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -134,23 +134,6 @@ dependencies { // precentil ranks aggregation api 'org.hdrhistogram:HdrHistogram:2.1.12' - // opentelemetry - api 'io.opentelemetry:opentelemetry-api:1.23.1' - api 'io.opentelemetry:opentelemetry-context:1.23.1' - api 'io.opentelemetry:opentelemetry-sdk:1.23.1' - api 'io.opentelemetry:opentelemetry-sdk-common:1.23.1' - api 'io.opentelemetry:opentelemetry-sdk-metrics:1.23.1' - api 'io.opentelemetry:opentelemetry-sdk-trace:1.23.1' - api 'io.opentelemetry:opentelemetry-exporter-otlp:1.23.1' - api 'io.opentelemetry:opentelemetry-exporter-common:1.23.1' - api 'io.opentelemetry:opentelemetry-exporter-otlp-common:1.23.1' - api 'io.opentelemetry:opentelemetry-semconv:1.23.1-alpha' - api 'com.squareup.okhttp3:okhttp:4.10.0' - api 'org.jetbrains.kotlin:kotlin-stdlib:1.6.20' - api 'com.squareup.okio:okio-jvm:3.0.0' - api 'io.opentelemetry:opentelemetry-sdk-logs:1.23.1-alpha' - api 'io.opentelemetry:opentelemetry-api-logs:1.23.1-alpha' - // lucene spatial api "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}", optional api "org.locationtech.jts:jts-core:${versions.jts}", optional @@ -352,59 +335,6 @@ tasks.named("thirdPartyAudit").configure { 'com.google.common.geometry.S2$Metric', 'com.google.common.geometry.S2LatLng', - // from opentelemetry - 'android.net.http.X509TrustManagerExtensions', - 'android.net.ssl.SSLSockets', - 'android.os.Build$VERSION', - 'android.security.NetworkSecurityPolicy', - 'android.util.Log', - 'com.google.common.io.ByteStreams', - 'com.google.common.util.concurrent.FutureCallback', - 'com.google.common.util.concurrent.Futures', - 'com.google.common.util.concurrent.ListenableFuture', - 'com.google.common.util.concurrent.MoreExecutors', - 'io.grpc.CallOptions', - 'io.grpc.Channel', - 'io.grpc.ClientInterceptor', - 'io.grpc.ClientInterceptors', - 'io.grpc.Codec', - 'io.grpc.Codec$Identity', - 'io.grpc.Drainable', - 'io.grpc.KnownLength', - 'io.grpc.ManagedChannel', - 'io.grpc.ManagedChannelBuilder', - 'io.grpc.Metadata', - 'io.grpc.Metadata$Key', - 'io.grpc.MethodDescriptor', - 'io.grpc.MethodDescriptor$Builder', - 'io.grpc.MethodDescriptor$Marshaller', - 'io.grpc.MethodDescriptor$MethodType', - 'io.grpc.Status', - 'io.grpc.Status$Code', - 'io.grpc.netty.GrpcSslContexts', - 'io.grpc.netty.NettyChannelBuilder', - 'io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts', - 'io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder', - 'io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder', - 'io.grpc.okhttp.OkHttpChannelBuilder', - 'io.grpc.stub.AbstractFutureStub', - 'io.grpc.stub.AbstractStub', - 'io.grpc.stub.ClientCalls', - 'io.grpc.stub.MetadataUtils', - 'io.netty.handler.ssl.SslContextBuilder', - 'io.opentelemetry.api.events.EventEmitter', - 'io.opentelemetry.api.events.EventEmitterBuilder', - 'io.opentelemetry.api.events.EventEmitterProvider', - 'io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties', - 'io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider', - 'io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider', - 'org.bouncycastle.jsse.BCSSLParameters', - 'org.bouncycastle.jsse.BCSSLSocket', - 'org.conscrypt.Conscrypt', - 'org.conscrypt.Conscrypt$Version', - 'org.conscrypt.ConscryptHostnameVerifier', - 'org.openjsse.javax.net.ssl.SSLParameters', - 'org.openjsse.javax.net.ssl.SSLSocket' ) @@ -417,12 +347,6 @@ tasks.named("thirdPartyAudit").configure { 'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor', 'com.google.protobuf.UnsafeUtil$MemoryAccessor', - // from opentelemetry - 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField', - 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField', - 'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField', - 'io.opentelemetry.internal.shaded.jctools.util.UnsafeAccess', - 'io.opentelemetry.internal.shaded.jctools.util.UnsafeRefArrayAccess' ) } diff --git a/server/licenses/kotlin-stdlib-1.6.20.jar.sha1 b/server/licenses/kotlin-stdlib-1.6.20.jar.sha1 deleted file mode 100644 index a26a3b6591dcf..0000000000000 --- a/server/licenses/kotlin-stdlib-1.6.20.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -6cedc143badbb4f1c6b7f5a340b04edff1743208 \ No newline at end of file diff --git a/server/licenses/kotlin-stdlib-LICENSE.txt b/server/licenses/kotlin-stdlib-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/kotlin-stdlib-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/kotlin-stdlib-NOTICE.txt b/server/licenses/kotlin-stdlib-NOTICE.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/licenses/okhttp-4.10.0.jar.sha1 b/server/licenses/okhttp-4.10.0.jar.sha1 deleted file mode 100644 index 7cd464ff3effb..0000000000000 --- a/server/licenses/okhttp-4.10.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -cd63657ac15770ed1420647154c9f44645533bef \ No newline at end of file diff --git a/server/licenses/okhttp-LICENSE.txt b/server/licenses/okhttp-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/okhttp-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/okhttp-NOTICE.txt b/server/licenses/okhttp-NOTICE.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/licenses/okio-jvm-3.0.0.jar.sha1 b/server/licenses/okio-jvm-3.0.0.jar.sha1 deleted file mode 100644 index b75b63ec015bd..0000000000000 --- a/server/licenses/okio-jvm-3.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -0ab5a73fa2ccb4a36b0b5c69fe10b16d0255bcf8 \ No newline at end of file diff --git a/server/licenses/okio-jvm-LICENSE.txt b/server/licenses/okio-jvm-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/okio-jvm-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/okio-jvm-NOTICE.txt b/server/licenses/okio-jvm-NOTICE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/okio-jvm-NOTICE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/opentelemetry-exporter-common-1.23.1.jar.sha1 b/server/licenses/opentelemetry-exporter-common-1.23.1.jar.sha1 deleted file mode 100644 index 3cf6f53767f58..0000000000000 --- a/server/licenses/opentelemetry-exporter-common-1.23.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e1e68d1ce6b4661e3a10f36a4ae5f364b06b27ed \ No newline at end of file diff --git a/server/licenses/opentelemetry-exporter-common-LICENSE.txt b/server/licenses/opentelemetry-exporter-common-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/opentelemetry-exporter-common-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/opentelemetry-exporter-common-NOTICE.txt b/server/licenses/opentelemetry-exporter-common-NOTICE.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/licenses/opentelemetry-exporter-otlp-1.23.1.jar.sha1 b/server/licenses/opentelemetry-exporter-otlp-1.23.1.jar.sha1 deleted file mode 100644 index 2ba5197454396..0000000000000 --- a/server/licenses/opentelemetry-exporter-otlp-1.23.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -39b79499dcedd4b662c60eecc2db03b1efbdd368 \ No newline at end of file diff --git a/server/licenses/opentelemetry-exporter-otlp-LICENSE.txt b/server/licenses/opentelemetry-exporter-otlp-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/opentelemetry-exporter-otlp-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/opentelemetry-exporter-otlp-NOTICE.txt b/server/licenses/opentelemetry-exporter-otlp-NOTICE.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/licenses/opentelemetry-exporter-otlp-common-1.23.1.jar.sha1 b/server/licenses/opentelemetry-exporter-otlp-common-1.23.1.jar.sha1 deleted file mode 100644 index 3ab5a1acf2bc6..0000000000000 --- a/server/licenses/opentelemetry-exporter-otlp-common-1.23.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -0b131ab306d726260a91ea437e7a65b1e31ef417 \ No newline at end of file diff --git a/server/licenses/opentelemetry-exporter-otlp-common-LICENSE.txt b/server/licenses/opentelemetry-exporter-otlp-common-LICENSE.txt deleted file mode 100644 index d645695673349..0000000000000 --- a/server/licenses/opentelemetry-exporter-otlp-common-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/server/licenses/opentelemetry-exporter-otlp-common-NOTICE.txt b/server/licenses/opentelemetry-exporter-otlp-common-NOTICE.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java b/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java index 6db763ff148ce..1be07a7c29675 100644 --- a/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java +++ b/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java @@ -51,7 +51,7 @@ import org.opensearch.tasks.TaskManager; import org.opensearch.tasks.TaskResourceTrackingService; import org.opensearch.tasks.consumer.TopNSearchTasksLogger; -import org.opensearch.tracing.TracerSettings; +import org.opensearch.tracing.TracerModule; import org.opensearch.tracing.TracerSettings; import org.opensearch.watcher.ResourceWatcherService; import org.opensearch.action.admin.cluster.configuration.TransportAddVotingConfigExclusionsAction; @@ -657,7 +657,9 @@ public void apply(Settings value, Settings current, Settings previous) { TracerSettings.TRACER_LEVEL_SETTING, TracerSettings.TRACER_EXPORTER_DELAY_SETTING, TracerSettings.TRACER_EXPORTER_BATCH_SIZE_SETTING, - TracerSettings.TRACER_EXPORTER_MAX_QUEUE_SIZE_SETTING + TracerSettings.TRACER_EXPORTER_MAX_QUEUE_SIZE_SETTING, + TracerModule.TRACER_DEFAULT_TYPE_SETTING, + TracerModule.TRACER_TYPE_SETTING ) ) ); diff --git a/server/src/main/java/org/opensearch/common/util/concurrent/ThreadContext.java b/server/src/main/java/org/opensearch/common/util/concurrent/ThreadContext.java index 5e81d130e7a22..029ece235abba 100644 --- a/server/src/main/java/org/opensearch/common/util/concurrent/ThreadContext.java +++ b/server/src/main/java/org/opensearch/common/util/concurrent/ThreadContext.java @@ -45,7 +45,7 @@ import org.opensearch.common.settings.Settings; import org.opensearch.http.HttpTransportSettings; import org.opensearch.tracing.SpanHolder; -import org.opensearch.tracing.TracerUtils; +import org.opensearch.tracing.TracerManager; import org.opensearch.tasks.Task; import java.io.IOException; @@ -68,8 +68,8 @@ import static org.opensearch.http.HttpTransportSettings.SETTING_HTTP_MAX_WARNING_HEADER_COUNT; import static org.opensearch.http.HttpTransportSettings.SETTING_HTTP_MAX_WARNING_HEADER_SIZE; -import static org.opensearch.tracing.DefaultTracer.CURRENT_SPAN; import static org.opensearch.tasks.TaskResourceTrackingService.TASK_ID; +import static org.opensearch.tracing.Tracer.CURRENT_SPAN; /** * A ThreadContext is a map of string headers and a transient map of keyed objects that are associated with @@ -725,7 +725,7 @@ private ThreadContextStruct copyHeaders(Iterable> head } private void writeTo(StreamOutput out, Map defaultHeaders) throws IOException { - TracerUtils.addTracerContextToHeader(this.requestHeaders, this.transientHeaders); + TracerManager.getTracerHeaderInjector().injectHeader().accept(this.requestHeaders, this.transientHeaders); final Map requestHeaders; if (defaultHeaders.isEmpty()) { diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index fd522b7a14c58..bd50f6521608d 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -56,7 +56,7 @@ import org.opensearch.monitor.fs.FsProbe; import org.opensearch.plugins.ExtensionAwarePlugin; import org.opensearch.plugins.SearchPipelinePlugin; -import org.opensearch.tracing.TracerFactory; +import org.opensearch.tracing.TracerManager; import org.opensearch.search.backpressure.SearchBackpressureService; import org.opensearch.search.backpressure.settings.SearchBackpressureSettings; import org.opensearch.search.pipeline.SearchPipelineService; @@ -64,6 +64,7 @@ import org.opensearch.tasks.consumer.TopNSearchTasksLogger; import org.opensearch.threadpool.RunnableTaskExecutionListener; import org.opensearch.index.store.RemoteSegmentStoreDirectoryFactory; +import org.opensearch.tracing.TracerModule; import org.opensearch.tracing.TracerSettings; import org.opensearch.watcher.ResourceWatcherService; import org.opensearch.core.Assertions; @@ -194,6 +195,7 @@ import org.opensearch.plugins.ScriptPlugin; import org.opensearch.plugins.SearchPlugin; import org.opensearch.plugins.SystemIndexPlugin; +import org.opensearch.plugins.TracerPlugin; import org.opensearch.repositories.RepositoriesModule; import org.opensearch.repositories.RepositoriesService; import org.opensearch.rest.RestController; @@ -1011,8 +1013,10 @@ protected Node( ); final TracerSettings tracerSettings = new TracerSettings(settings, clusterService.getClusterSettings()); - TracerFactory.initTracerFactory(threadPool, tracerSettings); - resourcesToClose.add(TracerFactory::closeTracer); + List tracerPlugins = pluginsService.filterPlugins(TracerPlugin.class); + TracerModule tracerModule = new TracerModule(settings, tracerPlugins, threadPool, tracerSettings); + TracerManager.initTracerManager(tracerSettings, tracerModule.getTracerSupplier(), tracerModule.getTracerHeaderInjector()); + resourcesToClose.add(TracerManager::closeTracer); final List> tasksExecutors = pluginsService.filterPlugins(PersistentTaskPlugin.class) .stream() @@ -1471,7 +1475,7 @@ public synchronized void close() throws IOException { toClose.add(() -> stopWatch.stop().start("node_environment")); toClose.add(injector.getInstance(NodeEnvironment.class)); toClose.add(stopWatch::stop); - toClose.add(TracerFactory::closeTracer); + toClose.add(TracerManager::closeTracer); if (logger.isTraceEnabled()) { toClose.add(() -> logger.trace("Close times for each service:\n{}", stopWatch.prettyPrint())); diff --git a/server/src/main/java/org/opensearch/plugins/TracerPlugin.java b/server/src/main/java/org/opensearch/plugins/TracerPlugin.java new file mode 100644 index 0000000000000..830a4f6e3a1f1 --- /dev/null +++ b/server/src/main/java/org/opensearch/plugins/TracerPlugin.java @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.plugins; + +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.tracing.Tracer; +import org.opensearch.tracing.TracerHeaderInjector; +import org.opensearch.tracing.TracerSettings; + +import java.util.Map; +import java.util.function.Supplier; + +/** + * Plugin for extending tracing related classes + */ +public interface TracerPlugin { + + Map> getTracers(ThreadPool threadPool, TracerSettings tracerSettings); + + Map getHeaderInjectors(); +} diff --git a/server/src/main/java/org/opensearch/tracing/Tracer.java b/server/src/main/java/org/opensearch/tracing/Tracer.java index 147d45f117654..3c6230681e7db 100644 --- a/server/src/main/java/org/opensearch/tracing/Tracer.java +++ b/server/src/main/java/org/opensearch/tracing/Tracer.java @@ -18,6 +18,8 @@ */ public interface Tracer extends Closeable { + String CURRENT_SPAN = "current_span"; + /** * Starts the {@link Span} with given name and level * diff --git a/server/src/main/java/org/opensearch/tracing/TracerHeaderInjector.java b/server/src/main/java/org/opensearch/tracing/TracerHeaderInjector.java new file mode 100644 index 0000000000000..e0780e11ad3ef --- /dev/null +++ b/server/src/main/java/org/opensearch/tracing/TracerHeaderInjector.java @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing; + +import java.util.Map; +import java.util.function.BiConsumer; + +/** + * Interface to add in tracing related context in header + */ +public interface TracerHeaderInjector { + + BiConsumer, Map> injectHeader(); + +} diff --git a/server/src/main/java/org/opensearch/tracing/TracerFactory.java b/server/src/main/java/org/opensearch/tracing/TracerManager.java similarity index 53% rename from server/src/main/java/org/opensearch/tracing/TracerFactory.java rename to server/src/main/java/org/opensearch/tracing/TracerManager.java index e36b46abb2a6a..a8726c5112656 100644 --- a/server/src/main/java/org/opensearch/tracing/TracerFactory.java +++ b/server/src/main/java/org/opensearch/tracing/TracerManager.java @@ -8,38 +8,44 @@ package org.opensearch.tracing; -import io.opentelemetry.api.OpenTelemetry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.threadpool.ThreadPool; +import org.opensearch.tracing.noop.NoopTracer; +import org.opensearch.tracing.noop.NoopTracerHeaderInjector; import java.io.IOException; +import java.util.function.Supplier; /** - * TracerFactory represents a single global class that is used to access tracers. + * TracerManager represents a single global class that is used to access tracers. * - * The Tracer singleton object can be retrieved using TracerFactory.getTracer(). The TracerFactory object + * The Tracer singleton object can be retrieved using TracerManager.getTracer(). The TracerManager object * is created during class initialization and cannot subsequently be changed. */ -public class TracerFactory { +public class TracerManager { - private static final Logger logger = LogManager.getLogger(TracerFactory.class); - private static final Tracer noopTracer = new NoopTracer(); - private static volatile TracerFactory INSTANCE; + private static final Logger logger = LogManager.getLogger(TracerManager.class); + private static volatile TracerManager INSTANCE; - private final ThreadPool threadPool; - private final TracerSettings tracerSettings; - private final Object mutex = new Object(); private volatile Tracer defaultTracer; + private final Object mutex = new Object(); + private final TracerSettings tracerSettings; + private final Supplier tracerSupplier; + private final TracerHeaderInjector tracerHeaderInjector; /** * Initializes the TracerFactory singleton instance - * @param threadPool threadpool instance - * @param tracerSettings tracer settings instance + * + * @param tracerSettings tracer settings instance + * @param tracerHeaderInjector tracer header injector */ - public static synchronized void initTracerFactory(ThreadPool threadPool, TracerSettings tracerSettings) { + public static synchronized void initTracerManager( + TracerSettings tracerSettings, + Supplier tracerSupplier, + TracerHeaderInjector tracerHeaderInjector + ) { if (INSTANCE == null) { - INSTANCE = new TracerFactory(threadPool, tracerSettings); + INSTANCE = new TracerManager(tracerSettings, tracerSupplier, tracerHeaderInjector); } else { logger.warn("Trying to double initialize TracerFactory, skipping"); } @@ -50,7 +56,11 @@ public static synchronized void initTracerFactory(ThreadPool threadPool, TracerS * @return Tracer instance */ public static Tracer getTracer() { - return INSTANCE == null ? noopTracer : INSTANCE.tracer(); + return INSTANCE == null ? NoopTracer.INSTANCE : INSTANCE.tracer(); + } + + public static TracerHeaderInjector getTracerHeaderInjector() { + return INSTANCE == null ? NoopTracerHeaderInjector.INSTANCE : INSTANCE.tracerHeaderInjector(); } /** @@ -66,13 +76,18 @@ public static void closeTracer() { } } - public TracerFactory(ThreadPool threadPool, TracerSettings tracerSettings) { - this.threadPool = threadPool; + public TracerManager(TracerSettings tracerSettings, Supplier tracerSupplier, TracerHeaderInjector tracerHeaderInjector) { this.tracerSettings = tracerSettings; + this.tracerSupplier = tracerSupplier; + this.tracerHeaderInjector = tracerHeaderInjector; } private Tracer tracer() { - return isTracingDisabled() ? noopTracer : getOrCreateDefaultTracerInstance(); + return isTracingDisabled() ? NoopTracer.INSTANCE : getOrCreateDefaultTracerInstance(); + } + + private TracerHeaderInjector tracerHeaderInjector() { + return isTracingDisabled() ? NoopTracerHeaderInjector.INSTANCE : tracerHeaderInjector; } private boolean isTracingDisabled() { @@ -84,8 +99,7 @@ private Tracer getOrCreateDefaultTracerInstance() { synchronized (mutex) { if (defaultTracer == null) { logger.info("Creating Otel tracer..."); - OpenTelemetry openTelemetry = OTelResourceProvider.getOrCreateOpenTelemetryInstance(tracerSettings); - defaultTracer = new DefaultTracer(openTelemetry, threadPool, tracerSettings); + defaultTracer = tracerSupplier.get(); } } } diff --git a/server/src/main/java/org/opensearch/tracing/TracerModule.java b/server/src/main/java/org/opensearch/tracing/TracerModule.java new file mode 100644 index 0000000000000..1068820257e73 --- /dev/null +++ b/server/src/main/java/org/opensearch/tracing/TracerModule.java @@ -0,0 +1,97 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing; + +import org.opensearch.common.settings.Setting; +import org.opensearch.common.settings.Settings; +import org.opensearch.plugins.TracerPlugin; +import org.opensearch.threadpool.ThreadPool; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +/** + * A module for loading classes for tracer + * + * @opensearch.internal + */ +public class TracerModule { + + private static final String TRACER_TYPE_DEFAULT_KEY = "tracer.type.default"; + private static final String TRACER_TYPE_KEY = "tracer.type"; + + public static final Setting TRACER_DEFAULT_TYPE_SETTING = Setting.simpleString( + TRACER_TYPE_DEFAULT_KEY, + Setting.Property.NodeScope + ); + public static final Setting TRACER_TYPE_SETTING = Setting.simpleString(TRACER_TYPE_KEY, Setting.Property.NodeScope); + + private final Settings settings; + private final Map> tracerFactories = new HashMap<>(); + private final Map tracerHeaderInjectors = new HashMap<>(); + + public TracerModule(Settings settings, List tracerPlugins, ThreadPool threadPool, TracerSettings tracerSettings) { + this.settings = settings; + + for (TracerPlugin tracerPlugin : tracerPlugins) { + Map> tracerFactory = tracerPlugin.getTracers(threadPool, tracerSettings); + for (Map.Entry> entry : tracerFactory.entrySet()) { + registerTracer(entry.getKey(), entry.getValue()); + } + + Map headerInjectors = tracerPlugin.getHeaderInjectors(); + for (Map.Entry entry : headerInjectors.entrySet()) { + registerTracerHeaderInjector(entry.getKey(), entry.getValue()); + } + + } + } + + public Supplier getTracerSupplier() { + final String tracerType = getTracerType(); + + final Supplier factory = tracerFactories.get(tracerType); + /*if (factory == null) { + throw new IllegalStateException("Unsupported tracer.type [" + tracerType + "]"); + }*/ + return factory; + } + + public TracerHeaderInjector getTracerHeaderInjector() { + final String tracerType = getTracerType(); + + final TracerHeaderInjector tracerHeaderInjector = tracerHeaderInjectors.get(tracerType); + /*if (tracerHeaderInjector == null) { + throw new IllegalStateException("Unsupported tracer.type [" + tracerType + "]"); + }*/ + return tracerHeaderInjector; + } + + private String getTracerType() { + final String tracerType = TRACER_DEFAULT_TYPE_SETTING.exists(settings) + ? TRACER_DEFAULT_TYPE_SETTING.get(settings) + : TRACER_TYPE_SETTING.get(settings); + return tracerType; + } + + private void registerTracer(String key, Supplier factory) { + if (tracerFactories.putIfAbsent(key, factory) != null) { + throw new IllegalArgumentException("tracer for name: " + key + " is already registered"); + } + } + + private void registerTracerHeaderInjector(String key, TracerHeaderInjector tracerHeaderInjector) { + if (tracerHeaderInjectors.putIfAbsent(key, tracerHeaderInjector) != null) { + throw new IllegalArgumentException("tracer injector for name: " + key + " is already registered"); + } + } + +} diff --git a/server/src/main/java/org/opensearch/tracing/TracerSettings.java b/server/src/main/java/org/opensearch/tracing/TracerSettings.java index d595217039672..5e0c3954d2d1d 100644 --- a/server/src/main/java/org/opensearch/tracing/TracerSettings.java +++ b/server/src/main/java/org/opensearch/tracing/TracerSettings.java @@ -17,6 +17,7 @@ * Wrapper class to encapsulate tracing related settings */ public class TracerSettings { + // TODO move this public static final Setting TRACER_EXPORTER_BATCH_SIZE_SETTING = Setting.intSetting( "tracer.exporter.batch_size", 512, diff --git a/server/src/main/java/org/opensearch/tracing/NoopSpan.java b/server/src/main/java/org/opensearch/tracing/noop/NoopSpan.java similarity index 76% rename from server/src/main/java/org/opensearch/tracing/NoopSpan.java rename to server/src/main/java/org/opensearch/tracing/noop/NoopSpan.java index fb7bc0f433654..516f07380ca15 100644 --- a/server/src/main/java/org/opensearch/tracing/NoopSpan.java +++ b/server/src/main/java/org/opensearch/tracing/noop/NoopSpan.java @@ -6,17 +6,15 @@ * compatible open source license. */ -package org.opensearch.tracing; +package org.opensearch.tracing.noop; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.opensearch.tracing.Level; +import org.opensearch.tracing.Span; /** * No-op implementation of Span */ -class NoopSpan implements Span { - private static final Logger logger = LogManager.getLogger(NoopSpan.class); - +public class NoopSpan implements Span { private final String spanName; private final Span parentSpan; private final Level level; diff --git a/server/src/main/java/org/opensearch/tracing/NoopTracer.java b/server/src/main/java/org/opensearch/tracing/noop/NoopTracer.java similarity index 81% rename from server/src/main/java/org/opensearch/tracing/NoopTracer.java rename to server/src/main/java/org/opensearch/tracing/noop/NoopTracer.java index b6f6a90026dba..73f0a7e1a88de 100644 --- a/server/src/main/java/org/opensearch/tracing/NoopTracer.java +++ b/server/src/main/java/org/opensearch/tracing/noop/NoopTracer.java @@ -6,12 +6,20 @@ * compatible open source license. */ -package org.opensearch.tracing; +package org.opensearch.tracing.noop; + +import org.opensearch.tracing.Level; +import org.opensearch.tracing.Span; +import org.opensearch.tracing.Tracer; /** * No-op implementation of Tracer */ -class NoopTracer implements Tracer { +public class NoopTracer implements Tracer { + + public static final Tracer INSTANCE = new NoopTracer(); + + private NoopTracer() {} @Override public void startSpan(String spanName, Level level) { diff --git a/server/src/main/java/org/opensearch/tracing/noop/NoopTracerHeaderInjector.java b/server/src/main/java/org/opensearch/tracing/noop/NoopTracerHeaderInjector.java new file mode 100644 index 0000000000000..0f4a419e0d38d --- /dev/null +++ b/server/src/main/java/org/opensearch/tracing/noop/NoopTracerHeaderInjector.java @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.tracing.noop; + +import org.opensearch.tracing.TracerHeaderInjector; + +import java.util.Map; +import java.util.function.BiConsumer; + +/** + * No-op implementation of TracerHeaderInjector + */ +public class NoopTracerHeaderInjector implements TracerHeaderInjector { + + public static final TracerHeaderInjector INSTANCE = new NoopTracerHeaderInjector(); + + private NoopTracerHeaderInjector() {} + + @Override + public BiConsumer, Map> injectHeader() { + return (x, y) -> {}; + } +} diff --git a/server/src/main/java/org/opensearch/tracing/noop/package-info.java b/server/src/main/java/org/opensearch/tracing/noop/package-info.java new file mode 100644 index 0000000000000..66b557c48ed20 --- /dev/null +++ b/server/src/main/java/org/opensearch/tracing/noop/package-info.java @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/** + * Contains No-op implementations + */ +package org.opensearch.tracing.noop; diff --git a/server/src/main/resources/org/opensearch/bootstrap/security.policy b/server/src/main/resources/org/opensearch/bootstrap/security.policy index f6ba29763f5f7..3671782b9d12f 100644 --- a/server/src/main/resources/org/opensearch/bootstrap/security.policy +++ b/server/src/main/resources/org/opensearch/bootstrap/security.policy @@ -181,8 +181,5 @@ grant { permission java.io.FilePermission "/sys/fs/cgroup/cpuacct/-", "read"; permission java.io.FilePermission "/sys/fs/cgroup/memory", "read"; permission java.io.FilePermission "/sys/fs/cgroup/memory/-", "read"; - // needed by Opentelemetry - permission java.net.NetPermission "getProxySelector"; - permission java.net.SocketPermission "127.0.0.1:4317", "connect,resolve"; }; diff --git a/server/src/test/java/org/opensearch/tracing/TracerFactoryTests.java b/server/src/test/java/org/opensearch/tracing/TracerManagerTests.java similarity index 73% rename from server/src/test/java/org/opensearch/tracing/TracerFactoryTests.java rename to server/src/test/java/org/opensearch/tracing/TracerManagerTests.java index cedc722b4d56d..01e7bb7c0116f 100644 --- a/server/src/test/java/org/opensearch/tracing/TracerFactoryTests.java +++ b/server/src/test/java/org/opensearch/tracing/TracerManagerTests.java @@ -13,24 +13,24 @@ import org.opensearch.common.settings.ClusterSettings; import org.opensearch.common.settings.Settings; import org.opensearch.test.OpenSearchTestCase; -import org.opensearch.threadpool.ThreadPool; +import org.opensearch.tracing.noop.NoopTracer; import static org.mockito.Mockito.mock; -public class TracerFactoryTests extends OpenSearchTestCase { +public class TracerManagerTests extends OpenSearchTestCase { @Before public void setup() { - TracerFactory.clear(); + TracerManager.clear(); } @After public void close() { - TracerFactory.closeTracer(); + TracerManager.closeTracer(); } public void testGetTracerWithUninitializedTracerFactory() { - Tracer tracer = TracerFactory.getTracer(); + Tracer tracer = TracerManager.getTracer(); assertTrue(tracer instanceof NoopTracer); } @@ -40,9 +40,9 @@ public void testGetTracerWithTracingDisabledReturnsNoopTracer() { settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS) ); - TracerFactory.initTracerFactory(mock(ThreadPool.class), tracerSettings); + TracerManager.initTracerManager(tracerSettings, null, null); - Tracer tracer = TracerFactory.getTracer(); + Tracer tracer = TracerManager.getTracer(); assertTrue(tracer instanceof NoopTracer); } @@ -52,10 +52,10 @@ public void testGetTracerWithTracingEnabledReturnsDefaultTracer() { settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS) ); - TracerFactory.initTracerFactory(mock(ThreadPool.class), tracerSettings); + TracerManager.initTracerManager(tracerSettings, () -> mock(Tracer.class), null); - Tracer tracer = TracerFactory.getTracer(); - assertTrue(tracer instanceof DefaultTracer); + Tracer tracer = TracerManager.getTracer(); + assertFalse(tracer instanceof NoopTracer); } }