Skip to content

Added ability to test distributed tracing functionality. #2896

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

Merged
merged 10 commits into from
Aug 13, 2025

Conversation

LarryOsterman
Copy link
Member

@LarryOsterman LarryOsterman commented Aug 11, 2025

Fixes #2769 - Adds ability to easily test distributed tracing.

Also adds a test example for KeyVault Secrets APIs.

This PR introduces a new azure_core_test API named assert_instrumentation_information whose purpose is to ensure that the distributed tracing information is correctly generated for a given service client implementation.

The API takes three pieces of information: A capture which creates a service client with a provided distributed tracing TracerProvider, a capture which actually performs the test and an InstrumentationInformation structure which describes the service calling the API and the particular service client APIs which are expected to have been called during the test.

It then analyzes the actual traces generated during the test and verifies that the expected service client calls were made and that the expected distributed tracing attributes have been generated.

@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 22:03
@LarryOsterman LarryOsterman requested review from heaths, a team and RickWinter as code owners August 11, 2025 22:03
@github-actions github-actions bot added Azure.Core The azure_core crate KeyVault Key Vault labels Aug 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive distributed tracing testing functionality to the Azure SDK for Rust, allowing developers to easily verify that their client libraries generate correct telemetry data. The implementation includes a new test framework for instrumentation validation and demonstrates its usage with KeyVault Secrets APIs.

  • Introduces test_instrumentation_for_api function for automated tracing verification
  • Adds structured data types for defining expected instrumentation behavior
  • Provides test examples across multiple Azure service clients

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/core/azure_core_test/src/tracing.rs Core implementation of the tracing test framework with helper types and validation logic
sdk/keyvault/azure_security_keyvault_secrets/tests/secret_client.rs Example test demonstrating distributed tracing verification for KeyVault operations
sdk/core/azure_core_opentelemetry/tests/telemetry_service_macros.rs Additional test examples for HTTP and function-level tracing scenarios
sdk/core/azure_core/src/http/pipeline.rs Comment relocation for better code organization
sdk/keyvault/assets.json Test asset version update
sdk/core/azure_core_opentelemetry/assets.json Test asset version update

Copy link
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think taking a capture that passes the InstrumentationInformation would be much easier to use for test authors. Happy to debate it further, though.

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure SDK for Key Vault Aug 11, 2025
@heaths heaths merged commit abf685b into Azure:main Aug 13, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure SDK for Key Vault Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core The azure_core crate KeyVault Key Vault
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement a mechanism to easily validate distributed tracing functionality for Azure Service clients.
3 participants