Skip to content

Commit

Permalink
Update Opentelemetry dependencies to GA version 1.0.0 (Azure#19581)
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity authored Mar 4, 2021
1 parent 6af12fd commit 0f616e4
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 51 deletions.
9 changes: 4 additions & 5 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ com.microsoft.azure:azure-storage;8.0.0
com.microsoft.azure:msal4j;1.8.1
com.microsoft.azure:msal4j-persistence-extension;1.0.0
com.sun.activation:jakarta.activation;1.2.2
io.opentelemetry:opentelemetry-api;0.17.1
io.opentelemetry:opentelemetry-sdk;0.17.1
io.opentelemetry:opentelemetry-exporter-logging;0.17.1
io.opentelemetry:opentelemetry-exporter-jaeger;0.17.1
com.google.errorprone:error_prone_annotations;2.5.1
io.opentelemetry:opentelemetry-api;1.0.0
io.opentelemetry:opentelemetry-sdk;1.0.0
io.opentelemetry:opentelemetry-exporter-logging;1.0.0
io.opentelemetry:opentelemetry-exporter-jaeger;1.0.0
io.projectreactor:reactor-test;3.3.12.RELEASE
junit:junit;4.13.1
commons-cli:commons-cli;1.3
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Release History

## 1.0.0-beta.8 (Unreleased)
- Updated versions of `opentelemetry-api` to `0.17.1` version.
More detailed information about the new OpenTelemetry API version can be found in [OpenTelemetry changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md#version-0171---2021-02-19).
- Updated versions of `opentelemetry-api` to `1.0.0` version.
More detailed information about the new OpenTelemetry API version can be found in [OpenTelemetry changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md#version-100---2021-02-26).

## 1.0.0-beta.7 (2021-02-05)

Expand Down
23 changes: 11 additions & 12 deletions sdk/core/azure-core-tracing-opentelemetry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.14.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core;current} -->
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.5.1</version> <!-- {x-version-update;com.google.errorprone:error_prone_annotations;external_dependency} -->
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version> <!-- {x-version-update;com.google.code.findbugs:jsr305;external_dependency} -->
<scope>provided</scope>
</dependency>

<!--test dependencies -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -91,13 +91,13 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-logging</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-exporter-logging;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-exporter-logging;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-jaeger</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-exporter-jaeger;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-exporter-jaeger;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -153,11 +153,10 @@
<rules>
<bannedDependencies>
<includes>
<include>io.opentelemetry:opentelemetry-api:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<include>com.google.errorprone:error_prone_annotations:[2.5.1]</include> <!-- {x-include-update;com.google.errorprone:error_prone_annotations;external_dependency} -->
<include>io.opentelemetry:opentelemetry-sdk:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<include>io.opentelemetry:opentelemetry-exporter-logging:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-exporter-logging;external_dependency} -->
<include>io.opentelemetry:opentelemetry-exporter-jaeger:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-exporter-jaeger;external_dependency} -->
<include>io.opentelemetry:opentelemetry-api:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<include>io.opentelemetry:opentelemetry-sdk:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<include>io.opentelemetry:opentelemetry-exporter-logging:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-exporter-logging;external_dependency} -->
<include>io.opentelemetry:opentelemetry-exporter-jaeger:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-exporter-jaeger;external_dependency} -->
</includes>
</bannedDependencies>
</rules>
Expand Down
4 changes: 2 additions & 2 deletions sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
- Updated versions of `opentelemetry-api` and `opentelemetry-sdk` to `0.17.1` version.
More detailed information about the new OpenTelemetry API version can be found in [OpenTelemetry changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md#version-0171---2021-02-19).
- Updated versions of `opentelemetry-api` and `opentelemetry-sdk` to `1.0.0` version.
More detailed information about the new OpenTelemetry API version can be found in [OpenTelemetry changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md#version-100---2021-02-26).

## 1.0.0-beta.3 (2021-02-09)

Expand Down
8 changes: 4 additions & 4 deletions sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>0.17.1</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<version>1.0.0</version> <!-- {x-version-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
</dependency>

<dependency>
Expand Down Expand Up @@ -131,8 +131,8 @@
<rules>
<bannedDependencies>
<includes>
<include>io.opentelemetry:opentelemetry-api:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<include>io.opentelemetry:opentelemetry-sdk:[0.17.1]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
<include>io.opentelemetry:opentelemetry-api:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-api;external_dependency} -->
<include>io.opentelemetry:opentelemetry-sdk:[1.0.0]</include> <!-- {x-include-update;io.opentelemetry:opentelemetry-sdk;external_dependency} -->
</includes>
</bannedDependencies>
</rules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.opentelemetry.sdk.trace.data.LinkData;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import reactor.util.context.Context;

import java.net.URI;
Expand Down Expand Up @@ -248,22 +247,22 @@ private void exportRemoteDependency(SpanData span, boolean inProc,
}

private void applySemanticConventions(Attributes attributes, RemoteDependencyData remoteDependencyData, SpanKind spanKind) {
String httpMethod = attributes.get(SemanticAttributes.HTTP_METHOD);
String httpMethod = attributes.get(AttributeKey.stringKey("http.method"));
if (httpMethod != null) {
applyHttpClientSpan(attributes, remoteDependencyData);
return;
}
String rpcSystem = attributes.get(SemanticAttributes.RPC_SYSTEM);
String rpcSystem = attributes.get(AttributeKey.stringKey("rpc.system"));
if (rpcSystem != null) {
applyRpcClientSpan(attributes, remoteDependencyData, rpcSystem);
return;
}
String dbSystem = attributes.get(SemanticAttributes.DB_SYSTEM);
String dbSystem = attributes.get(AttributeKey.stringKey("db.system"));
if (dbSystem != null) {
applyDatabaseClientSpan(attributes, remoteDependencyData, dbSystem);
return;
}
String messagingSystem = attributes.get(SemanticAttributes.MESSAGING_SYSTEM);
String messagingSystem = attributes.get(AttributeKey.stringKey("messaging.system"));
if (messagingSystem != null) {
applyMessagingClientSpan(attributes, remoteDependencyData, messagingSystem, spanKind);
return;
Expand All @@ -277,7 +276,7 @@ private void applyHttpClientSpan(Attributes attributes, RemoteDependencyData tel
// * http.scheme, http.host, http.target
// * http.scheme, net.peer.name, net.peer.port, http.target
// * http.scheme, net.peer.ip, net.peer.port, http.target
String scheme = attributes.get(SemanticAttributes.HTTP_SCHEME);
String scheme = attributes.get(AttributeKey.stringKey("http.scheme"));
int defaultPort;
if ("http".equals(scheme)) {
defaultPort = 80;
Expand All @@ -288,9 +287,9 @@ private void applyHttpClientSpan(Attributes attributes, RemoteDependencyData tel
}
String target = getTargetFromPeerAttributes(attributes, defaultPort);
if (target == null) {
target = attributes.get(SemanticAttributes.HTTP_HOST);
target = attributes.get(AttributeKey.stringKey("http.host"));
}
String url = attributes.get(SemanticAttributes.HTTP_URL);
String url = attributes.get(AttributeKey.stringKey("http.url"));
if (target == null && url != null) {
try {
URI uri = new URI(url);
Expand Down Expand Up @@ -322,7 +321,7 @@ private void applyHttpClientSpan(Attributes attributes, RemoteDependencyData tel
telemetry.setTarget(target + " | " + targetAppId);
}

Long httpStatusCode = attributes.get(SemanticAttributes.HTTP_STATUS_CODE);
Long httpStatusCode = attributes.get(AttributeKey.longKey("http.status_code"));
if (httpStatusCode != null) {
telemetry.setResultCode(Long.toString(httpStatusCode));
}
Expand All @@ -331,20 +330,20 @@ private void applyHttpClientSpan(Attributes attributes, RemoteDependencyData tel
}

private static String getTargetFromPeerAttributes(Attributes attributes, int defaultPort) {
String target = attributes.get(SemanticAttributes.PEER_SERVICE);
String target = attributes.get(AttributeKey.stringKey("peer.service"));
if (target != null) {
// do not append port if peer.service is provided
return target;
}
target = attributes.get(SemanticAttributes.NET_PEER_NAME);
target = attributes.get(AttributeKey.stringKey("net.peer.name"));
if (target == null) {
target = attributes.get(SemanticAttributes.NET_PEER_IP);
target = attributes.get(AttributeKey.stringKey("net.peer.ip"));
}
if (target == null) {
return null;
}
// append net.peer.port to target
Long port = attributes.get(SemanticAttributes.NET_PEER_PORT);
Long port = attributes.get(AttributeKey.longKey("net.peer.port"));
if (port != null && port != defaultPort) {
return target + ":" + port;
}
Expand All @@ -362,7 +361,7 @@ private static void applyRpcClientSpan(Attributes attributes, RemoteDependencyDa
}

private static void applyDatabaseClientSpan(Attributes attributes, RemoteDependencyData telemetry, String dbSystem) {
String dbStatement = attributes.get(SemanticAttributes.DB_STATEMENT);
String dbStatement = attributes.get(AttributeKey.stringKey("db.statement"));
String type;
if (SQL_DB_SYSTEMS.contains(dbSystem)) {
type = "SQL";
Expand All @@ -383,7 +382,7 @@ private static void applyDatabaseClientSpan(Attributes attributes, RemoteDepende
telemetry.setType(type);
telemetry.setData(dbStatement);
String target = nullAwareConcat(getTargetFromPeerAttributes(attributes, getDefaultPortForDbSystem(dbSystem)),
attributes.get(SemanticAttributes.DB_NAME), "/");
attributes.get(AttributeKey.stringKey("db.name")), "/");
if (target == null) {
target = dbSystem;
}
Expand All @@ -397,7 +396,7 @@ private void applyMessagingClientSpan(Attributes attributes, RemoteDependencyDat
// e.g. CONSUMER kind (without remote parent) and CLIENT kind
telemetry.setType(messagingSystem);
}
String destination = attributes.get(SemanticAttributes.MESSAGING_DESTINATION);
String destination = attributes.get(AttributeKey.stringKey("messaging.destination"));
if (destination != null) {
telemetry.setTarget(destination);
} else {
Expand Down Expand Up @@ -445,11 +444,11 @@ private void exportRequest(SpanData span, List<TelemetryItem> telemetryItems) {
source = sourceAppId;
}
if (source == null) {
String messagingSystem = attributes.get(SemanticAttributes.MESSAGING_SYSTEM);
String messagingSystem = attributes.get(AttributeKey.stringKey("messaging.system"));
if (messagingSystem != null) {
// TODO (trask) should this pass default port for messaging.system?
source = nullAwareConcat(getTargetFromPeerAttributes(attributes, 0),
attributes.get(SemanticAttributes.MESSAGING_DESTINATION), "/");
attributes.get(AttributeKey.stringKey("messaging.destination")), "/");
if (source == null) {
source = messagingSystem;
}
Expand All @@ -464,14 +463,14 @@ private void exportRequest(SpanData span, List<TelemetryItem> telemetryItems) {
requestData.setSource(source);

addLinks(requestData.getProperties(), span.getLinks());
Long httpStatusCode = attributes.get(SemanticAttributes.HTTP_STATUS_CODE);
Long httpStatusCode = attributes.get(AttributeKey.longKey("http.status_code"));

requestData.setResponseCode("200");
if (httpStatusCode != null) {
requestData.setResponseCode(Long.toString(httpStatusCode));
}

String httpUrl = attributes.get(SemanticAttributes.HTTP_URL);
String httpUrl = attributes.get(AttributeKey.stringKey("http.url"));
if (httpUrl != null) {
requestData.setUrl(httpUrl);
}
Expand Down Expand Up @@ -556,9 +555,9 @@ private void exportEvents(SpanData span, Double samplingPercentage, List<Telemet
telemetryItem.setTime(getFormattedTime(event.getEpochNanos()));
setExtraAttributes(telemetryItem, eventData.getProperties(), event.getAttributes());

if (event.getAttributes().get(SemanticAttributes.EXCEPTION_TYPE) != null
|| event.getAttributes().get(SemanticAttributes.EXCEPTION_MESSAGE) != null) {
String stacktrace = event.getAttributes().get(SemanticAttributes.EXCEPTION_STACKTRACE);
if (event.getAttributes().get(AttributeKey.stringKey("exception.type")) != null
|| event.getAttributes().get(AttributeKey.stringKey("exception.message")) != null) {
String stacktrace = event.getAttributes().get(AttributeKey.stringKey("exception.stacktrace"));
if (stacktrace != null) {
trackException(stacktrace, span, operationId, span.getSpanId(), samplingPercentage, telemetryItems);
}
Expand Down Expand Up @@ -668,11 +667,11 @@ private void setExtraAttributes(TelemetryItem telemetry, Map<String, String> pro
return;
}
// special case mappings
if (key.equals(SemanticAttributes.ENDUSER_ID) && value instanceof String) {
if (key.getKey().equals("enduser.id") && value instanceof String) {
telemetry.getTags().put(ContextTagKeys.AI_USER_ID.toString(), (String) value);
return;
}
if (key.equals(SemanticAttributes.HTTP_USER_AGENT) && value instanceof String) {
if (key.getKey().equals("http.user_agent") && value instanceof String) {
telemetry.getTags().put("ai.user.userAgent", (String) value);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
requires transitive io.opentelemetry.sdk.trace;
requires transitive io.opentelemetry.sdk.common;
requires transitive io.opentelemetry.api;
requires transitive io.opentelemetry.semconv;

exports com.azure.monitor.opentelemetry.exporter;

Expand Down

0 comments on commit 0f616e4

Please sign in to comment.