From 03965298bea1cf6ecda68efcfc4c4f5041bf3e01 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Thu, 2 Feb 2023 09:56:44 -0800 Subject: [PATCH] Prepare OpenTelemetry for beta release (#4320) * Prepare OpenTelemetry for beta release * Update sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> * Removed core changelog changes * Removed core changelog changes 2 * Updated core dependency to 1.8.0 --------- Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> --- doc/DistributedTracing.md | 27 ++++++++----------- .../CHANGELOG.md | 8 +++--- .../vcpkg/Config.cmake.in | 2 +- .../vcpkg/vcpkg.json | 2 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/doc/DistributedTracing.md b/doc/DistributedTracing.md index 9bec54b8f..e99f17d5f 100644 --- a/doc/DistributedTracing.md +++ b/doc/DistributedTracing.md @@ -82,19 +82,9 @@ std::shared_ptr traceProvider = Azure::Core::Tracing::OpenTelemetry::OpenTelemetryProvider::Create(CreateOpenTelemetryProvider()); ``` -To finish the integration with Azure clients, there are two mechanisms to integrate OpenTelemetry into a client application: +To finish the integration with Azure clients, you need to associate the OpenTelemetry provider with each service client created via +the `ClientOptions` structure. -1) `Azure::Core::Context` integration. -1) Service Client Options integration. - -### Integrate an OpenTelemetryProvider via the ApplicationContext - -To integrate OpenTelemetry for all Azure Clients in the application, the customer can call `Azure::Core::Context::ApplicationContext.SetTracerProvider` to establish the -tracer provider for the application. - -```c++ - Azure::Core::Context::ApplicationContext.SetTracerProvider(provider); -``` ### Integrate an OpenTelemetryProvider via Service ClientOptions @@ -128,16 +118,19 @@ To add a new `DiagnosticTracingFactory` to the client, simply add the class as a ```c++ Azure::Core::Tracing::_internal::TracingContextFactory m_tracingFactory; - ``` And construct the new tracing factory in the service constructor: ```c++ explicit ServiceClient(ServiceClientOptions const& clientOptions = ServiceClientOptions{}) - : m_tracingFactory(clientOptions, "Azure.Core.OpenTelemetry.Test.Service", PackageVersion::ToString()) + : m_tracingFactory(clientOptions, "Azure.Core.OpenTelemetry.Test.Service", + "azure-core-opentelemetry-test-service-cpp", PackageVersion::ToString()) ``` + Note that the `TracingContextFactory` constructor requires both the service name AND the package name. The package name is used when + creating an opentelemetry Tracer, and the service name is used as the "az.namespace" attribute in newly created spans. + ### Update Each Service Method There are three methods of interest when updating the service method: @@ -240,5 +233,7 @@ Generated traces have the following attributes: | `http.url`| URL being retrieved (sanitized)| HTTP Spans. | `http.status_code` | HTTP status code returned by the service | HTTP Spans. | `http.user_agent` | The value of the `User-Agent` HTTP header sent to the service | HTTP Spans. -| `requestId` | The value of the `x-ms-client-request-id` header sent by the client | HTTP Spans. -| `serviceRequestId` | The value of the `x-ms-request-id` sent by the server | HTTP Spans. +| `net.peer.id` | The fully qualified Azure service endpoint (host name component) | HTTP Spans. +| `net.peer.port` | The TCP Port of the Azure service endpoint if not 80 or 443| HTTP Spans. +| `az.client_request_id` | The value of the `x-ms-client-request-id` header sent by the client | HTTP Spans. +| `az.service_request_id` | The value of the `x-ms-request-id` sent by the server | HTTP Spans. diff --git a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md index abb1f7646..66d9c5e05 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md +++ b/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md @@ -1,14 +1,14 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.4 (2023-02-02) ### Features Added -### Breaking Changes - -### Bugs Fixed +- Aligned OpenTelemetry tracing infrastructure with OpenTelemetry 1.17.0 conventions for use with Azure Monitor. ### Other Changes +- Updated test collateral to reflect Azure Core tracing changes. +- Suppress several warnings from opentelemetry-cpp package. ## 1.0.0-beta.3 (2022-08-04) diff --git a/sdk/core/azure-core-tracing-opentelemetry/vcpkg/Config.cmake.in b/sdk/core/azure-core-tracing-opentelemetry/vcpkg/Config.cmake.in index c83cddc61..bddaaf1a4 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/vcpkg/Config.cmake.in +++ b/sdk/core/azure-core-tracing-opentelemetry/vcpkg/Config.cmake.in @@ -4,7 +4,7 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) -find_dependency(azure-core-cpp "1.7.0-beta.1") +find_dependency(azure-core-cpp "1.8.0") find_dependency(Threads) find_dependency(opentelemetry-cpp) diff --git a/sdk/core/azure-core-tracing-opentelemetry/vcpkg/vcpkg.json b/sdk/core/azure-core-tracing-opentelemetry/vcpkg/vcpkg.json index 62f64c191..34f11766a 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/vcpkg/vcpkg.json +++ b/sdk/core/azure-core-tracing-opentelemetry/vcpkg/vcpkg.json @@ -15,7 +15,7 @@ { "name": "azure-core-cpp", "default-features": false, - "version>=": "1.7.0-beta.1" + "version>=": "1.8.0" }, { "name": "opentelemetry-cpp",