From 45b320c95abe6db33881efcccf39120a75d36b87 Mon Sep 17 00:00:00 2001 From: qinyouzeng Date: Tue, 18 Aug 2026 14:24:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4dotnet6/7=E4=B8=8B=201?= =?UTF-8?q?.15.3=E5=8C=85=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceExtensions.cs | 6 ++++-- ...Contrib.StackSdks.Tsc.OpenTelemetry.csproj | 21 +++++++++++++++++-- .../OpenTelemetryInstrumentationOptions.cs | 4 +++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Extensions/ServiceExtensions.cs b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Extensions/ServiceExtensions.cs index bf2eafd..028faa6 100644 --- a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Extensions/ServiceExtensions.cs +++ b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Extensions/ServiceExtensions.cs @@ -45,8 +45,10 @@ public static IServiceCollection AddObservable(this IServiceCollection services, IEnumerable? activitySources = default, IEnumerable? blazorRouteAssemblies = default, Action? traceInstrumentConfig = default, - Action? metricInstrumentConfig = default, - Action? logInstrumentConfig = default + Action? metricInstrumentConfig = default +#if !OTEL_LEGACY + , Action? logInstrumentConfig = default +#endif ) { ArgumentNullException.ThrowIfNull(option); diff --git a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Masa.Contrib.StackSdks.Tsc.OpenTelemetry.csproj b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Masa.Contrib.StackSdks.Tsc.OpenTelemetry.csproj index b6d3005..78e41ac 100644 --- a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Masa.Contrib.StackSdks.Tsc.OpenTelemetry.csproj +++ b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Masa.Contrib.StackSdks.Tsc.OpenTelemetry.csproj @@ -6,7 +6,25 @@ false - + + + $(DefineConstants);OTEL_LEGACY + + + + + + + + + + + + + + + @@ -26,4 +44,3 @@ - diff --git a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Traceing/OpenTelemetryInstrumentationOptions.cs b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Traceing/OpenTelemetryInstrumentationOptions.cs index 30fdbef..8e692cc 100644 --- a/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Traceing/OpenTelemetryInstrumentationOptions.cs +++ b/src/Contrib/Masa.Contrib.StackSdks.Tsc.OpenTelemetry/Traceing/OpenTelemetryInstrumentationOptions.cs @@ -61,7 +61,9 @@ private static void InitializeHeaders(IConfiguration? configuration) /// public Action EntityFrameworkInstrumentationOptions { get; set; } = options => { - +#if OTEL_LEGACY + options.SetDbStatementForText = true; +#endif }; public Action ElasticsearchClientInstrumentationOptions { get; set; } = options =>