Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry API version update #9652

Merged
merged 3 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ com.microsoft.azure:azure-storage;8.0.0
com.microsoft.azure:msal4j;1.3.0
com.sun.activation:jakarta.activation;1.2.1
commons-collections:commons-collections;3.2.2
io.opentelemetry:opentelemetry-api;0.2.0
io.opentelemetry:opentelemetry-sdk;0.2.0
io.opentelemetry:opentelemetry-api;0.2.4
samvaity marked this conversation as resolved.
Show resolved Hide resolved
io.opentelemetry:opentelemetry-sdk;0.2.4
io.projectreactor:reactor-test;3.3.0.RELEASE
junit:junit;4.13-beta-3
org.assertj:assertj-core;3.11.1
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core-tracing-opentelemetry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>0.2.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<version>0.2.4</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -47,7 +47,7 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<version>0.2.4</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import com.azure.core.util.CoreUtils;
import com.azure.core.util.UrlBuilder;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.common.AttributeValue;
import io.opentelemetry.context.propagation.HttpTextFormat;
import io.opentelemetry.trace.AttributeValue;
import io.opentelemetry.trace.Span;
import io.opentelemetry.trace.SpanContext;
import io.opentelemetry.trace.Tracer;
Expand All @@ -42,7 +42,7 @@ public HttpPipelinePolicy create() {
}

// Singleton OpenTelemetry tracer capable of starting and exporting spans.
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
private static final Tracer TRACER = OpenTelemetry.getTracerProvider().get("Azure-OpenTelemetry");

// standard attributes with http call information
private static final String HTTP_USER_AGENT = "http.user_agent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.tracing.ProcessKind;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.trace.AttributeValue;
import io.opentelemetry.common.AttributeValue;
import io.opentelemetry.trace.Span;
import io.opentelemetry.trace.Span.Builder;
import io.opentelemetry.trace.SpanContext;
Expand All @@ -29,7 +29,7 @@
* requests.
*/
public class OpenTelemetryTracer implements com.azure.core.util.tracing.Tracer {
private static final Tracer TRACER = OpenTelemetry.getTracerFactory().get("Azure-OpenTelemetry");
private static final Tracer TRACER = OpenTelemetry.getTracerProvider().get("Azure-OpenTelemetry");

// standard attributes with AMQP request
static final String AZ_NAMESPACE_KEY = "az.namespace";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.opentelemetry.trace.SpanId;
import io.opentelemetry.trace.TraceFlags;
import io.opentelemetry.trace.TraceId;
import io.opentelemetry.trace.Tracestate;
import io.opentelemetry.trace.TraceState;

import java.util.Objects;

Expand Down Expand Up @@ -71,13 +71,13 @@ private static SpanContext fromDiagnosticId(String diagnosticId) {
TraceId.getInvalid(),
SpanId.getInvalid(),
TraceFlags.getDefault(),
Tracestate.getDefault()
TraceState.getDefault()
);
}
return SpanContext.create(
TraceId.fromLowerBase16(diagnosticId, 3),
SpanId.fromLowerBase16(diagnosticId, 36),
TraceFlags.fromLowerBase16(diagnosticId, 53),
Tracestate.builder().build());
TraceState.builder().build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

module com.azure.core.tracing.opentelemetry {
requires transitive com.azure.core;
requires opentelemetry.api;

requires io.opentelemetry.api;
requires io.opentelemetry.context.propagation;

opens com.azure.core.tracing.opentelemetry to com.fasterxml.jackson.databind;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
```

Expand All @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.1.0</version>
<version>4.2.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opentelemetry</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -44,7 +44,7 @@ import com.azure.security.keyvault.secrets.SecretAsyncClient;
import com.azure.security.keyvault.secrets.SecretClientBuilder;
import com.azure.security.keyvault.secrets.models.KeyVaultSecret;
import io.opentelemetry.context.Scope;
import io.opentelemetry.sdk.trace.TracerSdkFactory;
import io.opentelemetry.sdk.trace.TracerSdkProvider;
import io.opentelemetry.trace.Span;
import io.opentelemetry.trace.Tracer;
import reactor.util.context.Context;
Expand All @@ -61,11 +61,11 @@ public class Sample {

private static final Logger LOGGER = getLogger("Sample");
private static final Tracer TRACER;
private static final TracerSdkFactory TRACER_SDK_FACTORY;
private static final TracerSdkProvider TRACER_SDK_PROVIDER;

static {
TRACER_SDK_FACTORY = Helper.configureOpenTelemetryAndJaegerExporter(LOGGER);
TRACER = TRACER_SDK_FACTORY.get("Sample");
TRACER_SDK_PROVIDER = Helper.configureOpenTelemetryAndLoggingExporter();
TRACER = TRACER_SDK_PROVIDER.get("Sample");
}

public static void main(String[] args) throws InterruptedException {
Expand All @@ -74,9 +74,17 @@ public class Sample {
doClientWork();
userSpan.end();
scope.close();
TRACER_SDK_FACTORY.shutdown();
TRACER_SDK_PROVIDER.shutdown();
}


private static TracerSdkProvider configureOpenTelemetryAndLoggingExporter() {
LoggingExporter exporter = new LoggingExporter();
TracerSdkProvider tracerSdkProvider = (TracerSdkProvider) OpenTelemetry.getTracerFactory();
tracerSdkProvider.addSpanProcessor(SimpleSpansProcessor.newBuilder(exporter).build());

return tracerSdkProvider;
}

public static void doClientWork() throws InterruptedException {
SecretAsyncClient client = new SecretClientBuilder()
.vaultUrl("YOUR_VAULT_URL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
```

Expand All @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-appconfiguration</artifactId>
<version>1.0.1</version>
<version>1.2.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opentelemetry</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -43,11 +43,8 @@ import com.azure.core.util.Context;
import com.azure.data.appconfiguration.ConfigurationClient;
import com.azure.data.appconfiguration.ConfigurationClientBuilder;
import com.azure.data.appconfiguration.models.ConfigurationSetting;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.context.Scope;
import io.opentelemetry.exporters.logging.LoggingExporter;
import io.opentelemetry.sdk.trace.TracerSdkFactory;
import io.opentelemetry.sdk.trace.export.SimpleSpansProcessor;
import io.opentelemetry.sdk.trace.TracerSdkProvider;
import io.opentelemetry.trace.Span;
import io.opentelemetry.trace.Tracer;

Expand All @@ -60,24 +57,24 @@ public class Sample {
final static String CONNECTION_STRING = "<YOUR-CONNECTION_STRING>";
private static final Logger LOGGER = getLogger("Sample");
private static final Tracer TRACER;
private static final TracerSdkFactory TRACER_SDK_FACTORY;
private static final TracerSdkProvider TRACER_SDK_PROVIDER;

static {
TRACER_SDK_FACTORY = configureOpenTelemetryAndLoggingExporter();
TRACER = TRACER_SDK_FACTORY.get("Sample");
TRACER_SDK_PROVIDER = configureOpenTelemetryAndLoggingExporter();
TRACER = TRACER_SDK_PROVIDER.get("Sample");
}

public static void main(String[] args) {
doClientWork();
TRACER_SDK_FACTORY.shutdown();
TRACER_SDK_PROVIDER.shutdown();
}

private static TracerSdkFactory configureOpenTelemetryAndLoggingExporter() {
private static TracerSdkProvider configureOpenTelemetryAndLoggingExporter() {
LoggingExporter exporter = new LoggingExporter();
TracerSdkFactory tracerSdkFactory = (TracerSdkFactory) OpenTelemetry.getTracerFactory();
tracerSdkFactory.addSpanProcessor(SimpleSpansProcessor.newBuilder(exporter).build());
TracerSdkProvider tracerSdkProvider = (TracerSdkProvider) OpenTelemetry.getTracerFactory();
tracerSdkProvider.addSpanProcessor(SimpleSpansProcessor.newBuilder(exporter).build());

return tracerSdkFactory;
return tracerSdkProvider;
}

private static void doClientWork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporters-logging</artifactId>
<version>0.2.0</version>
<version>0.2.4</version>
</dependency>
```

Expand All @@ -23,7 +23,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.1.0</version>
<version>4.2.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -32,7 +32,7 @@ Sample uses **[opentelemetry-sdk][opentelemetry_sdk]** as implementation package
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-tracing-opentelemetry</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,7 +45,7 @@ import com.azure.security.keyvault.secrets.SecretClient;
import com.azure.security.keyvault.secrets.SecretClientBuilder;
import com.azure.security.keyvault.secrets.models.KeyVaultSecret;
import io.opentelemetry.context.Scope;
import io.opentelemetry.sdk.trace.TracerSdkFactory;
import io.opentelemetry.sdk.trace.TracerSdkProvider;
import io.opentelemetry.trace.Span;
import io.opentelemetry.trace.Tracer;

Expand All @@ -58,29 +58,29 @@ public class Sample {
final static String VAULT_URL = "<YOUR_VAULT_URL>";
private static final Logger LOGGER = getLogger("Sample");
private static final Tracer TRACER;
private static final TracerSdkFactory TRACER_SDK_FACTORY;
private static final TracerSdkProvider TRACER_SDK_PROVIDER;

static {
TRACER_SDK_FACTORY = configureOpenTelemetryAndLoggingExporter();
TRACER = TRACER_SDK_FACTORY.get("Sample");
TRACER_SDK_PROVIDER = configureOpenTelemetryAndLoggingExporter();
TRACER = TRACER_SDK_PROVIDER.get("Sample");
}

public static void main(String[] args) {
doClientWork();
TRACER_SDK_FACTORY.shutdown();
TRACER_SDK_PROVIDER.shutdown();
}

private static TracerSdkFactory configureOpenTelemetryAndLoggingExporter() {
private static TracerSdkProvider configureOpenTelemetryAndLoggingExporter() {
LoggingExporter exporter = new LoggingExporter();
TracerSdkFactory tracerSdkFactory = (TracerSdkFactory) OpenTelemetry.getTracerFactory();
tracerSdkFactory.addSpanProcessor(SimpleSpansProcessor.newBuilder(exporter).build());
TracerSdkProvider tracerSdkProvider = (TracerSdkProvider) OpenTelemetry.getTracerFactory();
tracerSdkProvider.addSpanProcessor(SimpleSpansProcessor.newBuilder(exporter).build());

return tracerSdkFactory;
return tracerSdkProvider;
}

private static void doClientWork() {
SecretClient secretClient = new SecretClientBuilder()
.vaultUrl(VAULT_URL)
.vaultUrl("VAULT_URL")
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();

Expand Down
Loading