Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike: Transactions are just spans without parents #3213

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/Sentry/ISpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ internal static ISpan StartChild(this ISpan span, SpanContext context)
public static ITransactionTracer GetTransaction(this ISpan span) =>
span switch
{
SpanTracer tracer => tracer.RootSpan,
ITransactionTracer transaction => transaction,
SpanTracer tracer => tracer.Transaction,
_ => throw new ArgumentOutOfRangeException(nameof(span), span, null)
};

Expand Down
11 changes: 3 additions & 8 deletions src/Sentry/MetricAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,9 @@ private void Emit(
RecordCodeLocation(type, key, unit.Value, stackLevel + 1, timestamp.Value);
}

switch (span)
{
case TransactionTracer transactionTracer:
transactionTracer.MetricsSummary.Add(type, key, value, unit, tags);
break;
case SpanTracer spanTracer:
spanTracer.MetricsSummary.Add(type, key, value, unit, tags);
break;
if (span is SpanTracer tracer)
{
tracer.MetricsSummary.Add(type, key, value, unit, tags);
}
}

Expand Down
16 changes: 4 additions & 12 deletions src/Sentry/SentrySpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,12 @@ public SentrySpan(ISpan tracer)
Status = tracer.Status;
IsSampled = tracer.IsSampled;
_extra = tracer.Extra.ToDict();
_measurements = tracer.Measurements.ToDict();
_tags = tracer.Tags.ToDict();

if (tracer is SpanTracer spanTracer)
if (tracer is SpanTracer { HasMetrics: true } transactionTracer)
{
_measurements = spanTracer.InternalMeasurements?.ToDict();
_tags = spanTracer.InternalTags?.ToDict();
if (spanTracer.HasMetrics)
{
_metricsSummary = new MetricsSummary(spanTracer.MetricsSummary);
}
}
else
{
_measurements = tracer.Measurements.ToDict();
_tags = tracer.Tags.ToDict();
_metricsSummary = new MetricsSummary(transactionTracer.MetricsSummary);
}
}

Expand Down
Loading
Loading