-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract Otel dependencies to a separate module
Signed-off-by: suranjay <surajkumar.tu@gmail.com>
- Loading branch information
Showing
78 changed files
with
805 additions
and
1,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,6 @@ bytebuddy = 1.14.3 | |
|
||
# benchmark dependencies | ||
jmh = 1.35 | ||
|
||
# opentelemetry dependencies | ||
opentelemetry = 1.23.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
modules/tracer-otel/src/main/java/org/opensearch/tracing/OTelTracerModulePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, Supplier<Tracer>> getTracers(ThreadPool threadPool, TracerSettings tracerSettings) { | ||
return Collections.singletonMap(OTEL_TRACER_NAME, () -> createDefaultTracer(threadPool, tracerSettings)); | ||
} | ||
|
||
@Override | ||
public Map<String, TracerHeaderInjector> 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); | ||
} | ||
} |
Oops, something went wrong.