Skip to content

Commit 1025830

Browse files
brantburnettemilienbev
authored andcommitted
NCBC-3849: Track orphaned metrics regardless of tracing
Motivation ---------- The current code for tracking orphaned operations checks to see if the span CanWrite before tracking. However, tracking to metrics is also affected by this. The result is that if distributed tracing is disabled (due to overall tracing being disabled or the specific request not being sampled) the metric is never incremented. Modifications ------------- Track to metrics even if the span is not writable. Results ------- Orphaned metrics are now tracked in all cases where the operation is sent over the wire. Change-Id: Id4d136b023ad87261d54f08258e2840c909fefba Reviewed-on: https://review.couchbase.org/c/couchbase-net-client/+/215126 Tested-by: Build Bot <[email protected]> Reviewed-by: Emilien Bevierre <[email protected]>
1 parent 3061be7 commit 1025830

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Couchbase/Core/IO/Operations/OperationBase.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,15 @@ protected void TryReadMutationToken(ReadOnlySpan<byte> buffer)
419419
/// </summary>
420420
public void LogOrphaned()
421421
{
422-
if (Span.CanWrite && IsSent && !_isOrphaned)
422+
if (IsSent && !_isOrphaned)
423423
{
424424
_isOrphaned = true;//only create attribute once
425-
Span.SetAttribute("orphaned", "true");
426425
MetricTracker.KeyValue.TrackOrphaned();
426+
427+
if (Span.CanWrite)
428+
{
429+
Span.SetAttribute("orphaned", "true");
430+
}
427431
}
428432
}
429433

0 commit comments

Comments
 (0)