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

WIP [AzureMonitor] update vendored OTel libraries #48608

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Mar 6, 2025

Follow up to #48574

This PR updates the vendored OTel libraries.

Steps followed to Sync Vendored code

  1. Create a New Branch in azure-sdk-for-net repo. This is where changes will be committed.
  2. Sync OpenTelemetry.Instrumentation.SqlClient
    2a. Clone the OpenTelemetry.NET Repository
    git clone https://github.com/open-telemetry/opentelemetry-dotnet.git
    2b. Fetch the tags and checkout the most recent release
    git fetch --tags
    git checkout tags/Instrumentation.SqlClient-1.11.0-beta.2
    2c. Copy the following folders into Azure.Monitor.OpenTelemetry.AspNetCore's Vendoring directory:
    • OpenTelemetry.Instrumentation.SqlClient
      • Remove the following files:
        • *.csproj
        • README.md
        • CHANGELOG.MD
        • AssemblyInfo.cs
    • Shared
  3. Sync OpenTelemetry.ResourceDetectors.Azure
    3a. Clone the OpenTelemetry.NET Contrib Repository
    git clone https://github.com/open-telemetry/opentelemetry-dotnet-contrib.git
    3b. Fetch the tags and checkout the most recent release
    git fetch --tags
    git checkout tags/Resources.Azure-1.11.0-beta.2
    3c. Copy the following folders into the Azure.Monitor.OpenTelemetry.AspNetCore's Vendoring directory:
    • OpenTelemetry.ResourceDetectors.Azure
      • Remove the following files:
        • *.csproj
        • README.md
        • CHANGELOG.MD
        • AssemblyInfo.cs
    • Shared
      • Must do a file comparison to confirm there are no missing changes or conflicts between the two repos.
  4. Additional Changes
    • Modified all instrumentation public APIs to internal.
    • Added #nullable enable to OpenTelemetry.ResourceDetoctors.Azure files. Our Azure.Monitor.OpenTelemetry.AspNetCore project does not yet support nullables.
    • Added #pragma warning disable AZC0102 and AZC0104 to Azure.VmMetaDataRequestor.cs. These are code standards that only exist in this Azure SDK reop.

@github-actions github-actions bot added the Monitor - Distro Monitor OpenTelemetry Distro label Mar 6, 2025
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if NETSTANDARD2_0 // HACK; FIX FOR AMBIGUITY
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hack to fix compile

@@ -174,7 +174,7 @@ public void SqlClientCallsAreCollectedSuccessfully(
serviceCollection.Configure<SqlClientTraceInstrumentationOptions>(options =>
{
options.SetDbStatementForText = captureTextCommandContent;
options.SetDbStatementForStoredProcedure = captureStoredProcedureCommandName;
//options.SetDbStatementForStoredProcedure = captureStoredProcedureCommandName; // TODO: THIS WAS REMOVED: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2284
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: need to clean up

@@ -99,7 +99,7 @@ public void VerifySqlClientDependency(
.AddSqlClientInstrumentation(options =>
{
options.SetDbStatementForText = true;
options.SetDbStatementForStoredProcedure = true;
//options.SetDbStatementForStoredProcedure = true; // TODO: THIS WAS REMOVED: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2284
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: need to clean up

@@ -170,7 +170,7 @@ public void VerifySqlClientDependencyWithException(
.AddSqlClientInstrumentation(options =>
{
options.SetDbStatementForText = true;
options.SetDbStatementForStoredProcedure = true;
//options.SetDbStatementForStoredProcedure = true; // TODO: THIS WAS REMOVED: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2284
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: need to clean up

/// </summary>
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
public static IConfigurationBuilder AddEnvironmentVariablesVENDORED(this IConfigurationBuilder configurationBuilder)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

HACK renamed to fix compile

Base automatically changed from tilee/202503_upgrade_otel1.11 to main March 7, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor - Distro Monitor OpenTelemetry Distro
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant