From b723ca0be535b75e833f78e49c6383ab3d427041 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Wed, 11 Oct 2023 23:09:20 +1300 Subject: [PATCH] Made most of the SpanContext constructor parameters optional --- src/Sentry.OpenTelemetry/SentrySpanProcessor.cs | 2 +- src/Sentry/SpanContext.cs | 12 ++++++------ src/Sentry/TransactionContext.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs index 9d5b23115d..fe2c747a41 100644 --- a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs +++ b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs @@ -66,10 +66,10 @@ public override void OnStart(Activity data) { // We can find the parent span - start a child span. var context = new SpanContext( + data.OperationName, data.SpanId.AsSentrySpanId(), data.ParentSpanId.AsSentrySpanId(), data.TraceId.AsSentryId(), - data.OperationName, data.DisplayName, null, null) diff --git a/src/Sentry/SpanContext.cs b/src/Sentry/SpanContext.cs index c8a88f6e5e..6d8df0324a 100644 --- a/src/Sentry/SpanContext.cs +++ b/src/Sentry/SpanContext.cs @@ -37,13 +37,13 @@ public class SpanContext : ITraceContext /// Initializes an instance of . /// public SpanContext( - SpanId? spanId, - SpanId? parentSpanId, - SentryId? traceId, string operation, - string? description, - SpanStatus? status, - bool? isSampled) + SpanId? spanId = null, + SpanId? parentSpanId = null, + SentryId? traceId = null, + string? description = null, + SpanStatus? status = null, + bool? isSampled = null) { SpanId = spanId ?? SpanId.Create(); ParentSpanId = parentSpanId; diff --git a/src/Sentry/TransactionContext.cs b/src/Sentry/TransactionContext.cs index 06dd48d3b3..67675666e1 100644 --- a/src/Sentry/TransactionContext.cs +++ b/src/Sentry/TransactionContext.cs @@ -31,7 +31,7 @@ public class TransactionContext : SpanContext, ITransactionContext bool? isParentSampled = null, TransactionNameSource nameSource = TransactionNameSource.Custom ) - : base(spanId, parentSpanId, traceId, operation, description, status, isSampled) + : base(operation, spanId, parentSpanId, traceId, description, status, isSampled) { Name = name; IsParentSampled = isParentSampled;