Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* The following tags are no longer added to spans when an exception is recorded:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))
Copy link
Member

Choose a reason for hiding this comment

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

We may want to change this description. Suggestion something like:

  • Trace instrumentation will now call the Activity.SetStatus API instead of the deprecated OpenTelemetry API package extension when setting span status. For details see: Setting Status.

Why?

The way it is currently written, a user might think otel.status_code and otel.status_description will no longer be present when the data hits the backend. But that depends largely on their exporter. For example Zipkin will add those based on the final Activity.Status/StatusDescription: https://github.com/open-telemetry/opentelemetry-dotnet/blob/0c775e58fa8eb55468f321d5612b527ed80afb9f/src/OpenTelemetry.Exporter.Zipkin/Implementation/ZipkinActivityConversionExtensions.cs#L51-L62


## 1.10.0-beta.1

Released 2024-Nov-23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics;
using Amazon.Runtime.Telemetry;
using Amazon.Runtime.Telemetry.Tracing;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.AWS.Implementation.Tracing;

Expand Down Expand Up @@ -60,9 +59,7 @@ public override void RecordException(Exception exception, Attributes? attributes
var tags = attributes != null ? new TagList(attributes.AllAttributes.ToArray()) : default;

this.activity.AddException(exception, tags);
#pragma warning disable CS0618 // Type or member is obsolete
this.activity.SetStatus(Status.Error.WithDescription(exception.Message));
#pragma warning restore CS0618 // Type or member is obsolete
this.activity.SetStatus(ActivityStatusCode.Error, exception.Message);
}

public override void End()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ private static void OnException(Activity? activity, Exception exception)
if (activity.IsAllDataRequested)
{
activity.AddException(exception);
#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error.WithDescription(exception.Message));
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error, exception.Message);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.AWSLambda/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* The following tags are no longer added to spans when an exception is recorded:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 1.10.0-beta.1

Released 2024-Nov-23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* Updated OpenTelemetry core component version(s) to `1.10.0`.
([#2317](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2317))

* FThe following tags are no longer added to spans when an exception is handled:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 0.1.0-alpha.2

Released 2024-Sep-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public static bool TryExtractPropagationContext<TKey, TValue>(
}
catch (Exception ex)
{
#pragma warning disable CS0618 // Type or member is obsolete
processActivity?.SetStatus(Status.Error);
#pragma warning restore CS0618 // Type or member is obsolete
processActivity?.SetStatus(ActivityStatusCode.Error);
processActivity?.SetTag(SemanticConventions.AttributeErrorType, ex.GetType().FullName);
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* Updated OpenTelemetry core component version(s) to `1.10.0`.
([#2317](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2317))

* The following tags are no longer added to spans when an exception is handled:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 1.0.0-beta.12

Released 2024-Jun-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Diagnostics;
using System.Reflection;
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.EntityFrameworkCore.Implementation;

Expand Down Expand Up @@ -297,9 +296,7 @@ public override void OnEventWritten(string name, object? payload)
{
if (this.exceptionFetcher.Fetch(payload) is Exception exception)
{
#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error.WithDescription(exception.Message));
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error, exception.Message);
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Owin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* Updated OpenTelemetry core component version(s) to `1.10.0`.
([#2317](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2317))

* The following tags are no longer added to spans when an exception is handled:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 1.0.0-rc.6

Released 2024-Apr-19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ private static void RequestEnd(IOwinContext owinContext, Exception? exception, l

if (exception != null)
{
#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error);
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error);

if (OwinInstrumentationActivitySource.Options?.RecordException == true)
{
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Quartz/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* Updated OpenTelemetry core component version(s) to `1.10.0`.
([#2317](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2317))

* The following tags are no longer added to spans when an exception is recorded:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 1.0.0-beta.3

Released 2024-Jun-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics;
using System.Reflection;
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.Quartz.Implementation;

Expand Down Expand Up @@ -140,9 +139,7 @@ private void OnException(Activity activity, object? payload)
activity.AddException(exc);
}

#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error.WithDescription(exc.Message));
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error, exc.Message);

try
{
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Wcf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
recorded (defaults to `false`). This is only supported by client instrumentation.
([#2271](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2271))

* The following tags are no longer added to spans when a request is faulted:
`otel.status_code` and `otel.status_description`. Both values are handled natively.
([#2358](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2358))

## 1.0.0-rc.18

Released 2024-Oct-28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.ServiceModel.Channels;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.Wcf.Implementation;

Expand Down Expand Up @@ -92,9 +91,7 @@ public static void AfterRequestCompleted(Message? reply, RequestTelemetryState?
{
if (reply == null || reply.IsFault)
{
#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error);
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error);

if (WcfInstrumentationActivitySource.Options!.RecordException && exception != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.ServiceModel.Dispatcher;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.Wcf.Implementation;

Expand Down Expand Up @@ -123,9 +122,7 @@ public void BeforeSendReply(ref Message reply, object? correlationState)
{
if (reply.IsFault)
{
#pragma warning disable CS0618 // Type or member is obsolete
activity.SetStatus(Status.Error);
#pragma warning restore CS0618 // Type or member is obsolete
activity.SetStatus(ActivityStatusCode.Error);
}

activity.SetTag(WcfInstrumentationConstants.SoapReplyActionTag, reply.Headers.Action);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ private void AssertSpanAttributes(Activity activity)

private void AssertSpanException(Activity activity)
{
Assert.Equal("ERROR", activity.GetTagValue(SpanAttributeConstants.StatusCodeKey));
Assert.NotNull(activity.GetTagValue(SpanAttributeConstants.StatusDescriptionKey));
Assert.Equal(ActivityStatusCode.Error, activity.Status);
Assert.Equal("TestException", activity.StatusDescription);
var exception = Assert.Single(activity.Events);
Assert.Equal("exception", exception.Name);
Assert.Equal("TestException", exception.Tags.SingleOrDefault(t => t.Key.Equals("exception.message")).Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ private static void VerifyActivityData(Activity activity, bool isError = false,
{
Assert.Equal(ActivityStatusCode.Error, activity.Status);
Assert.Equal("SQLite Error 1: 'no such table: no_table'.", activity.StatusDescription);
Assert.Contains(activity.Tags, t => t.Key == SpanAttributeConstants.StatusDescriptionKey);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ public async Task Should_Record_Exception_When_Record_Exception_Enabled()
Assert.Single(exportedItems);
var activity = exportedItems[0];

Assert.Equal("exception", activity.Events.First().Name);
Assert.Equal("ERROR", activity.Tags.SingleOrDefault(t => t.Key.Equals(SpanAttributeConstants.StatusCodeKey)).Value);
Assert.Equal("Catch me if you can!", activity.Tags.SingleOrDefault(t => t.Key.Equals(SpanAttributeConstants.StatusDescriptionKey)).Value);
Assert.Equal(ActivityStatusCode.Error, activity.Status);
var exception = Assert.Single(activity.Events);
Assert.Equal("exception", exception.Name);
Assert.Equal("Catch me if you can!", exception.Tags.SingleOrDefault(t => t.Key.Equals("exception.message")).Value);
}

[Fact]
Expand Down Expand Up @@ -253,8 +254,10 @@ public async Task Should_Enrich_Exception_When_Record_Exception_Enabled_And_Enri
Assert.Single(exportedItems);
var activity = exportedItems[0];

Assert.Equal("ERROR", activity.Tags.SingleOrDefault(t => t.Key.Equals(SpanAttributeConstants.StatusCodeKey)).Value);
Assert.Equal("Catch me if you can!", activity.Tags.SingleOrDefault(t => t.Key.Equals(SpanAttributeConstants.StatusDescriptionKey)).Value);
Assert.Equal(ActivityStatusCode.Error, activity.Status);
var exception = Assert.Single(activity.Events);
Assert.Equal("exception", exception.Name);
Assert.Equal("Catch me if you can!", exception.Tags.SingleOrDefault(t => t.Key.Equals("exception.message")).Value);
Assert.Equal(testId, activity.Tags.SingleOrDefault(t => t.Key.Equals("test.id")).Value);
}

Expand Down
Loading