diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs index 62110466bd4..6ec0710b17d 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/ActivityExtensions.cs @@ -360,14 +360,13 @@ public bool ForEach(KeyValuePair activityTag) { PooledList.Add(ref this.Tags, attribute); - switch (attribute.Value.ValueCase) + if (attribute.Value.ValueCase == OtlpCommon.AnyValue.ValueOneofCase.StringValue) { - case OtlpCommon.AnyValue.ValueOneofCase.StringValue: - PeerServiceResolver.InspectTag(ref this, key, attribute.Value.StringValue); - break; - case OtlpCommon.AnyValue.ValueOneofCase.IntValue: - PeerServiceResolver.InspectTag(ref this, key, attribute.Value.IntValue); - break; + PeerServiceResolver.InspectTag(ref this, key, attribute.Value.StringValue); + } + else if (attribute.Value.ValueCase == OtlpCommon.AnyValue.ValueOneofCase.IntValue) + { + PeerServiceResolver.InspectTag(ref this, key, attribute.Value.IntValue); } }