From 49c6a3e182f35a9c46017f00e5ec46ef84e4a853 Mon Sep 17 00:00:00 2001 From: Mike Goldsmth Date: Thu, 25 Apr 2024 14:49:15 +0100 Subject: [PATCH] maint: Replace HNY baggage span procesor with published BaggageActivityProcessor --- .../BaggageSpanProcessor.cs | 21 ------------------- .../Honeycomb.OpenTelemetry.csproj | 1 + .../HoneycombOptions.cs | 2 +- .../TracerProviderBuilderExtensions.cs | 4 ++-- 4 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 src/Honeycomb.OpenTelemetry/BaggageSpanProcessor.cs diff --git a/src/Honeycomb.OpenTelemetry/BaggageSpanProcessor.cs b/src/Honeycomb.OpenTelemetry/BaggageSpanProcessor.cs deleted file mode 100644 index 3c520a0..0000000 --- a/src/Honeycomb.OpenTelemetry/BaggageSpanProcessor.cs +++ /dev/null @@ -1,21 +0,0 @@ -using OpenTelemetry; -using System.Collections.Generic; -using System.Diagnostics; - -namespace Honeycomb.OpenTelemetry -{ - /// - /// Span processor that adds fields to every new span - /// - public class BaggageSpanProcessor : BaseProcessor - { - /// - public override void OnStart(Activity activity) - { - foreach (var entry in Baggage.Current) - { - activity.SetTag(entry.Key, entry.Value); - } - } - } -} \ No newline at end of file diff --git a/src/Honeycomb.OpenTelemetry/Honeycomb.OpenTelemetry.csproj b/src/Honeycomb.OpenTelemetry/Honeycomb.OpenTelemetry.csproj index 5e6136b..1282078 100644 --- a/src/Honeycomb.OpenTelemetry/Honeycomb.OpenTelemetry.csproj +++ b/src/Honeycomb.OpenTelemetry/Honeycomb.OpenTelemetry.csproj @@ -32,6 +32,7 @@ + diff --git a/src/Honeycomb.OpenTelemetry/HoneycombOptions.cs b/src/Honeycomb.OpenTelemetry/HoneycombOptions.cs index da94ddc..b48fb9a 100644 --- a/src/Honeycomb.OpenTelemetry/HoneycombOptions.cs +++ b/src/Honeycomb.OpenTelemetry/HoneycombOptions.cs @@ -152,7 +152,7 @@ internal static bool IsClassicKey(string apikey) public ResourceBuilder ResourceBuilder { get; set; } = ResourceBuilder.CreateDefault(); /// - /// Determines whether the is added when configuring a . + /// Determines whether the is added when configuring a . /// public bool AddBaggageSpanProcessor { get; set; } = true; diff --git a/src/Honeycomb.OpenTelemetry/TracerProviderBuilderExtensions.cs b/src/Honeycomb.OpenTelemetry/TracerProviderBuilderExtensions.cs index 64e37bf..88db3f3 100644 --- a/src/Honeycomb.OpenTelemetry/TracerProviderBuilderExtensions.cs +++ b/src/Honeycomb.OpenTelemetry/TracerProviderBuilderExtensions.cs @@ -121,11 +121,11 @@ public static TracerProviderBuilder AddHoneycomb(this TracerProviderBuilder buil } /// - /// Configures the to add the span processor. + /// Configures the to add the span processor. /// public static TracerProviderBuilder AddBaggageSpanProcessor(this TracerProviderBuilder builder) { - return builder.AddProcessor(new BaggageSpanProcessor()); + return builder.AddProcessor(new BaggageActivityProcessor()); } ///