Source/Serilog.Enrichers.Span/ActivityExtensions.cs
/// <summary>
/// Gets the span unique identifier regardless of the activity identifier format.
/// </summary>
/// <param name="activity">The activity.</param>
/// <returns>The span unique identifier.</returns>
Gets the span unique identifier regardless of the activity identifier format.
Gets the span unique identifier regardless of the activity identifier format .
public static string GetSpanId(this Activity activity)
        {
            var spanId = activity.IdFormat switch
            {
                ActivityIdFormat.Hierarchical => activity.Id,
                ActivityIdFormat.W3C => activity.SpanId.ToHexString(),
                ActivityIdFormat.Unknown => null,
                _ => null,
            };
            return spanId ?? string.Empty;
        }
public static string GetSpanId ( this Activity activity ) { var spanId = activity . IdFormat switch { ActivityIdFormat . Hierarchical => activity . Id , ActivityIdFormat . W3C => activity . SpanId . ToHexString ( ) , ActivityIdFormat . Unknown => null , _ => null , } ; return spanId ?? string . Empty ; }
Gets the span unique identifier regardless of the activity identifier format.
Gets the span unique identifier regardless of the activity identifier format .
The span unique identifier.
The span unique identifier .
Activity
this
activity
None