Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@
<suppress checks="FinalClass" files="RequestResponseLink.java"/>
<suppress checks="FinalClass" files="Util.java"/>

<!-- Public API with Impl in Public API TODO confirm, remove -->
<suppress checks="NoImplInPublicAPI" files="OpenTelemetryTracer.java"/>
<!-- Public API with Impl in Public API TODO confirm, remove after fixing https://github.com/Azure/azure-sdk-for-java/issues/5132 -->
<suppress checks="com.azure.tools.checkstyle.checks.NoImplInPublicAPI" files="com.azure.core.tracing.opencensus.OpenCensusTracer.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck" files="com.azure.core.tracing.opencensus.implementation.HttpTraceUtil.java"/>

<!-- Star imports are ok in unit tests - it makes it easier to import all assertions, etc -->
<suppress checks="AvoidStarImport" files=".*[/\\]src[/\\]test[/\\]java[/\\].*\.java"/>
Expand Down Expand Up @@ -126,8 +127,8 @@
<!-- Don't apply custom Checkstyle rules to files under checkstyle package. -->
<suppress checks="com\.azure\.tools\.checkstyle\.checks\..+" files=".*[/\\]tools[/\\]checkstyle[/\\].*"/>

<!-- OpenCensus should only be depended on from within the tracing-opencensus module -->
<suppress checks="IllegalImport" files=".*[/\\]com[/\\]azure[/\\]tracing[/\\]opentelemetry[/\\]*"/>
<!-- Identity and OpenCensus tracing are plugin packages and shouldn't be referenced -->
<suppress checks="IllegalImport" files=".*[/\\]com[/\\]azure[/\\]core[/\\]tracing[/\\]opencensus[/\\]*"/>
<suppress checks="IllegalImport" files=".*[/\\]com[/\\]azure[/\\]identity[/\\]*"/>

<!-- Suppress warnings for Event Processor until the usage of "Client" is discussed and resolved: https://github.com/Azure/azure-sdk/issues/321 -->
Expand Down
5 changes: 3 additions & 2 deletions pom.client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@
</group>
<group>
<title>Azure Telemetry</title>
<packages>com.azure.tracing.opentelemetry*</packages>
<title>Azure Telemetry - OpenCensus</title>
<packages>com.azure.core.tracing*</packages>
</group>
</groups>
<links>
Expand Down Expand Up @@ -868,6 +869,6 @@
<module>sdk/storage/azure-storage-file-datalake</module>
<module>sdk/storage/azure-storage-queue</module>
<module>sdk/storage/azure-storage-queue-cryptography</module>
<module>sdk/tracing/tracing-opentelemetry</module>
<module>sdk/tracing/azure-core-tracing-opencensus</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the MIT License.
package com.azure.core.amqp.implementation;

import static com.azure.core.util.tracing.Tracer.OPENTELEMETRY_SPAN_KEY;

import com.azure.core.amqp.exception.AmqpException;
import com.azure.core.implementation.tracing.ProcessKind;
import com.azure.core.util.Context;
Expand All @@ -14,6 +12,8 @@
import java.util.Objects;
import reactor.core.publisher.Signal;

import static com.azure.core.util.tracing.Tracer.OPENCENSUS_SPAN_KEY;

public class TracerProvider {
private final ClientLogger logger = new ClientLogger(TracerProvider.class);
private final List<Tracer> tracers = new ArrayList<>();
Expand Down Expand Up @@ -62,7 +62,7 @@ public void endSpan(Context context, Signal<Void> signal) {
Objects.requireNonNull(signal, "'signal' cannot be null");

// Get the context that was added to the mono, this will contain the information needed to end the span.
if (!context.getData(OPENTELEMETRY_SPAN_KEY).isPresent()) {
if (!context.getData(OPENCENSUS_SPAN_KEY).isPresent()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;
import java.util.Optional;

import static com.azure.core.util.tracing.Tracer.OPENTELEMETRY_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.OPENCENSUS_SPAN_KEY;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
Expand Down Expand Up @@ -114,7 +114,7 @@ public void startSpanReturnsUpdatedContext() {
@Test
public void endSpanSuccess() {
// Act
tracerProvider.endSpan(new Context(OPENTELEMETRY_SPAN_KEY, "value"), Signal.complete());
tracerProvider.endSpan(new Context(OPENCENSUS_SPAN_KEY, "value"), Signal.complete());

// Assert
for (Tracer t : tracers) {
Expand All @@ -137,7 +137,7 @@ public void endSpanNoKey() {
public void endSpanError() {
// Arrange
Throwable testThrow = new Throwable("testError");
Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value");
Context sendContext = new Context(OPENCENSUS_SPAN_KEY, "value");

// Act
tracerProvider.endSpan(sendContext, Signal.error(testThrow));
Expand All @@ -152,7 +152,7 @@ public void endSpanError() {
public void endSpanOnSubscribe() {
// Arrange
Throwable testThrow = new Throwable("testError");
Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value");
Context sendContext = new Context(OPENCENSUS_SPAN_KEY, "value");

// Act
tracerProvider.endSpan(sendContext, Signal.error(testThrow));
Expand All @@ -168,7 +168,7 @@ public void endSpanAmqpException() {
// Arrange
final ErrorCondition errorCondition = ErrorCondition.NOT_FOUND;
final Exception exception = new AmqpException(true, errorCondition, "", null);
Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value");
Context sendContext = new Context(OPENCENSUS_SPAN_KEY, "value");

// Act
tracerProvider.endSpan(sendContext, Signal.error(exception));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
*/
public interface Tracer {
/**
* Key for {@link Context} which indicates that the context contains OpenTelemetry span data. This span will be used
* Key for {@link Context} which indicates that the context contains OpenCensus span data. This span will be used
* as the parent span for all spans the SDK creates.
*
* If no span data is listed when the SDK creates its first span it will be used as the parent for all further spans
* it creates.
*/
String OPENTELEMETRY_SPAN_KEY = "opentelemetry-span";
String OPENCENSUS_SPAN_KEY = "opencensus-span";

/**
* Key for {@link Context} which indicates that the context contains the name for the OpenTelemetry spans that are
* Key for {@link Context} which indicates that the context contains the name for the OpenCensus spans that are
* created.
*
* If no span name is listed when the span is created it will default to using the calling method's name.
*/
String OPENTELEMETRY_SPAN_NAME_KEY = "opentelemetry-span-name";
String OPENCENSUS_SPAN_NAME_KEY = "opencensus-span-name";

/**
* Key for {@link Context} which indicates that the context contains the Entity Path, remote endpoint path.
Expand Down
8 changes: 4 additions & 4 deletions sdk/core/azure-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@
com.azure.storage.file, // FIXME this should not be a long-term solution
com.azure.storage.queue; // FIXME this should not be a long-term solution
exports com.azure.core.implementation.util to
com.azure.core.amqp, // FIXME this should not be a long-term solution
com.azure.core.management, // FIXME this should not be a long-term solution
com.azure.core.test, // FIXME this should not be a long-term solution
com.azure.core.amqp, // FIXME this should not be a long-term solution
com.azure.core.tracing.opencensus, // FIXME this should not be a long-term solution
com.azure.data.appconfiguration, // FIXME this should not be a long-term solution
com.azure.http.netty, // FIXME this should not be a long-term solution
com.azure.messaging.eventhubs, // FIXME this should not be a long-term solution
Expand All @@ -103,7 +104,6 @@
com.azure.security.keyvault.keys, // FIXME this should not be a long-term solution
com.azure.security.keyvault.secrets, // FIXME this should not be a long-term solution
com.azure.storage.common, // FIXME this should not be a long-term solution
com.azure.tracing.opentelemetry, // FIXME this should not be a long-term solution
com.azure.storage.blob, // FIXME this should not be a long-term solution
com.azure.storage.file, // FIXME this should not be a long-term solution
com.azure.storage.queue; // FIXME this should not be a long-term solution
Expand All @@ -118,7 +118,7 @@
com.azure.security.keyvault.keys, // FIXME this should not be a long-term solution
com.azure.security.keyvault.secrets, // FIXME this should not be a long-term solution
com.azure.storage.common, // FIXME this should not be a long-term solution
com.azure.tracing.opentelemetry, // FIXME this should not be a long-term solution
com.azure.core.tracing.opencensus, // FIXME this should not be a long-term solution
com.azure.storage.blob, // FIXME this should not be a long-term solution
com.azure.storage.file, // FIXME this should not be a long-term solution
com.azure.storage.queue; // FIXME this should not be a long-term solution
Expand All @@ -133,7 +133,7 @@
com.azure.security.keyvault.keys, // FIXME this should not be a long-term solution
com.azure.security.keyvault.secrets, // FIXME this should not be a long-term solution
com.azure.storage.common, // FIXME this should not be a long-term solution
com.azure.tracing.opentelemetry, // FIXME this should not be a long-term solution
com.azure.core.tracing.opencensus, // FIXME this should not be a long-term solution
com.azure.storage.blob, // FIXME this should not be a long-term solution
com.azure.storage.file, // FIXME this should not be a long-term solution
com.azure.storage.queue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import java.util.List;

import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY;
import static com.azure.core.util.tracing.Tracer.OPENTELEMETRY_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.OPENCENSUS_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -196,14 +196,14 @@ public void sendStartSpanSingleMessage() {
when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value");
return passed.addData(OPENCENSUS_SPAN_KEY, "value");
}
);

when(tracer1.start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2");
return passed.addData(OPENCENSUS_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2");
}
);

Expand Down Expand Up @@ -243,7 +243,7 @@ public void sendMessageAddlink() {
when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value");
return passed.addData(OPENCENSUS_SPAN_KEY, "value");
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.List;

import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY;
import static com.azure.core.util.tracing.Tracer.OPENTELEMETRY_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.OPENCENSUS_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -126,14 +126,14 @@ public void sendStartSpanSingleMessage() {
when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value");
return passed.addData(OPENCENSUS_SPAN_KEY, "value");
}
);

when(tracer1.start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2");
return passed.addData(OPENCENSUS_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2");
}
);
//Act
Expand Down Expand Up @@ -166,7 +166,7 @@ public void sendMessageAddlink() {
when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer(
invocation -> {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(OPENTELEMETRY_SPAN_KEY, "value");
return passed.addData(OPENCENSUS_SPAN_KEY, "value");
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.azure.messaging.eventhubs;

import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY;
import static com.azure.core.util.tracing.Tracer.OPENTELEMETRY_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.OPENCENSUS_SPAN_KEY;
import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -217,7 +217,7 @@ public void testErrorProcessSpans() throws Exception {
return passed.addData(SPAN_CONTEXT, "value1")
.addData("scope", (Closeable) () -> {
})
.addData(OPENTELEMETRY_SPAN_KEY, "value2");
.addData(OPENCENSUS_SPAN_KEY, "value2");
}
);

Expand Down Expand Up @@ -274,7 +274,7 @@ public void testProcessSpans() throws Exception {
Context passed = invocation.getArgument(1, Context.class);
return passed.addData(SPAN_CONTEXT, "value1").addData("scope", (Closeable) () -> {
return;
}).addData(OPENTELEMETRY_SPAN_KEY, "value2");
}).addData(OPENCENSUS_SPAN_KEY, "value2");
}
);

Expand Down
21 changes: 0 additions & 21 deletions sdk/tracing/README.md

This file was deleted.

Loading