27 instantiations of Activity
Microsoft.AspNetCore.Diagnostics (1)
src\Shared\Diagnostics\ActivityCreator.cs (1)
70activity = new Activity(activityName);
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
src\Shared\Diagnostics\ActivityCreator.cs (1)
70activity = new Activity(activityName);
Microsoft.AspNetCore.Hosting (1)
src\Shared\Diagnostics\ActivityCreator.cs (1)
70activity = new Activity(activityName);
Microsoft.AspNetCore.Http.Connections.Tests (1)
HttpConnectionDispatcherTests.cs (1)
3123var activityFeature = new TestActivityFeature(new Activity("name"));
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ActivityReplacer.cs (1)
14_activity = new Activity("Test");
Microsoft.AspNetCore.SignalR.Client.Core (1)
HubConnection.cs (1)
1107activity = new Activity(ActivityName);
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (3)
HubConnectionTests.Tracing.cs (3)
77clientParentActivity1 = new Activity("ClientActivity1"); 99clientParentActivity2 = new Activity("ClientActivity2"); 260clientParentActivity = new Activity("ClientActivity");
Microsoft.AspNetCore.SignalR.Core (1)
src\Shared\Diagnostics\ActivityCreator.cs (1)
70activity = new Activity(activityName);
Microsoft.AspNetCore.SignalR.Tests (8)
HubConnectionHandlerTests.Activity.cs (8)
44var mockHttpRequestActivity = new Activity("HttpRequest"); 119var mockHttpRequestActivity = new Activity("HttpRequest"); 188var mockHttpRequestActivity = new Activity("HttpRequest"); 247var mockHttpRequestActivity = new Activity("HttpRequest"); 320var mockHttpRequestActivity = new Activity("HttpRequest"); 367var mockHttpRequestActivity = new Activity("HttpRequest"); 419var mockHttpRequestActivity = new Activity("HttpRequest"); 470var mockHttpRequestActivity = new Activity("HttpRequest");
Microsoft.Extensions.Telemetry.Tests (7)
Logging\ExtendedLoggerFactoryTests.cs (7)
205using Activity activity = new Activity("ScopeActivity"); 215using Activity b = new Activity("ScopeActivity"); 255using Activity activity = new Activity("ScopeActivity"); 288using Activity activity = new Activity("ScopeActivity"); 317using Activity activity = new Activity("ScopeActivity"); 345using Activity activity = new Activity("ScopeActivity"); 419using Activity activity = new Activity("ScopeActivity");
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Activity.cs (1)
1182Activity activity = new Activity(name);
System.Net.Http (1)
System\Net\Http\DiagnosticsHandler.cs (1)
68activity = new Activity(DiagnosticsHandlerLoggingStrings.RequestActivityName).Start();
522 references to Activity
Aspire.Components.Common.Tests (11)
ActivityNotifier.cs (9)
14public sealed class ActivityNotifier : BaseProcessor<Activity> 16private readonly Channel<Activity> _activityChannel = Channel.CreateUnbounded<Activity>(); 18public async Task<List<Activity>> TakeAsync(int count, TimeSpan timeout) 20var activityList = new List<Activity>(); 22await foreach (var activity in WaitAsync(cts.Token)) 34public override void OnEnd(Activity data) 39private async IAsyncEnumerable<Activity> WaitAsync([EnumeratorCancellation] CancellationToken cancellationToken) 41await foreach (var activity in _activityChannel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
ConformanceTests.cs (2)
69/// Do anything that is going to trigger the <see cref="Activity"/> and <see cref="ILogger"/> creation. Example: try to create a DB. 429List<Activity> exportedActivities = new();
Aspire.Dashboard (1)
Components\Pages\Error.razor.cs (1)
18RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
Aspire.Elastic.Clients.Elasticsearch.Tests (1)
AspireElasticClientExtensionsTest.cs (1)
163var activity = activityList[0];
Aspire.Microsoft.Data.SqlClient (9)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Implementation\SqlClientDiagnosticListener.cs (2)
49var activity = Activity.Current;
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\DiagnosticSourceListener.cs (1)
35if (!this.handler.SupportsNullActivity && Activity.Current == null)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\ListenerHandler.cs (1)
28/// Gets a value indicating whether the <see cref="ListenerHandler"/> supports NULL <see cref="Activity"/>.
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (5)
120/// Gets or sets an action to enrich an <see cref="Activity"/> with the 128/// <item>The <see cref="Activity"/> being enriched.</item> 133/// cref="Activity"/>.</item> 136public Action<Activity, string, object> Enrich { get; set; } 257internal void AddConnectionLevelDetailsToActivity(string dataSource, Activity sqlActivity)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (9)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Implementation\SqlClientDiagnosticListener.cs (2)
49var activity = Activity.Current;
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\DiagnosticSourceListener.cs (1)
35if (!this.handler.SupportsNullActivity && Activity.Current == null)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\ListenerHandler.cs (1)
28/// Gets a value indicating whether the <see cref="ListenerHandler"/> supports NULL <see cref="Activity"/>.
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (5)
120/// Gets or sets an action to enrich an <see cref="Activity"/> with the 128/// <item>The <see cref="Activity"/> being enriched.</item> 133/// cref="Activity"/>.</item> 136public Action<Activity, string, object> Enrich { get; set; } 257internal void AddConnectionLevelDetailsToActivity(string dataSource, Activity sqlActivity)
Aspire.NATS.Net.Tests (1)
AspireNatsClientExtensionsTests.cs (1)
229var activity = activityList[0];
Aspire.Oracle.EntityFrameworkCore.Tests (1)
ConformanceTests.cs (1)
151List<Activity> exportedActivities = new();
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
210private static void AddRabbitMQTags(Activity? activity, Uri address, string? operation = null)
Aspire.StackExchange.Redis (11)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Implementation\RedisProfilerEntryToActivityConverter.cs (4)
76public static Activity? ProfilerCommandToActivity(Activity? parentActivity, IProfiledCommand command, StackExchangeRedisInstrumentationOptions options) 84var activity = StackExchangeRedisConnectionInstrumentation.ActivitySource.StartActivity( 182public static void DrainSession(Activity? parentActivity, IEnumerable<IProfiledCommand> sessionCommands, StackExchangeRedisInstrumentationOptions options)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\StackExchangeRedisConnectionInstrumentation.cs (4)
30internal readonly ConcurrentDictionary<(ActivityTraceId TraceId, ActivitySpanId SpanId), (Activity Activity, ProfilingSession Session)> Cache 77var parent = Activity.Current; 114var parent = entry.Value.Activity;
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\StackExchangeRedisInstrumentationOptions.cs (3)
16/// Gets or sets the maximum time that should elapse between flushing the internal buffer of Redis profiling sessions and creating <see cref="Activity"/> objects. Default value: 00:00:10. 29/// <para><see cref="Activity"/>: the activity being enriched.</para> 32public Action<Activity, IProfiledCommand>? Enrich { get; set; }
Aspire.StackExchange.Redis.Tests (1)
AspireRedisExtensionsTests.cs (1)
293var activity = activityList[0];
ClaimsTransformation (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
Cookies (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
DynamicSchemes (1)
Pages\Error.cshtml.cs (1)
21RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
HostedBlazorWebassemblyApp.Server (1)
Pages\Error.cshtml.cs (1)
32RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Identity.DefaultUI.WebSite (1)
Pages\Error.cshtml.cs (1)
19RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Identity.ExternalClaims (1)
Pages\Error.cshtml.cs (1)
21RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Microsoft.AspNetCore.Diagnostics (2)
src\Shared\Diagnostics\ActivityCreator.cs (2)
13public static Activity? CreateFromRemote( 24Activity? activity = null;
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (2)
src\Shared\Diagnostics\ActivityCreator.cs (2)
13public static Activity? CreateFromRemote( 24Activity? activity = null;
Microsoft.AspNetCore.Hosting (12)
Internal\HostingApplication.cs (1)
125public Activity? Activity
Internal\HostingApplicationDiagnostics.cs (7)
213var activity = context.Activity; 388private Activity? StartActivity(HttpContext httpContext, bool loggingEnabled, bool diagnosticListenerActivityCreationEnabled, out bool hasDiagnosticListener) 393var activity = ActivityCreator.CreateFromRemote( 429private void StopActivity(HttpContext httpContext, Activity activity, bool hasDiagnosticListener) 457private Activity StartActivity(Activity activity, HttpContext httpContext) 471private void StopActivity(Activity activity, HttpContext httpContext)
Internal\HttpActivityFeature.cs (2)
14internal HttpActivityFeature(Activity activity) 20public Activity Activity { get; set; }
src\Shared\Diagnostics\ActivityCreator.cs (2)
13public static Activity? CreateFromRemote( 24Activity? activity = null;
Microsoft.AspNetCore.Hosting.Tests (54)
HostingApplicationDiagnosticsTests.cs (47)
172Activity measurementActivity = null; 201measurementActivity = Activity.Current; 487Assert.Null(Activity.Current); 527Assert.Null(Activity.Current); 558Assert.Null(Activity.Current); 595Assert.NotNull(Activity.Current); 615Assert.NotNull(Activity.Current); 616Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 622Assert.NotNull(Activity.Current); 639Assert.NotNull(Activity.Current); 640Assert.True(Activity.Current.Duration > TimeSpan.Zero); 641Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 663Assert.NotNull(Activity.Current); 664Assert.True(Activity.Current.Duration > TimeSpan.Zero); 665Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 687Assert.NotNull(Activity.Current); 688Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 715Assert.NotNull(Activity.Current); 716Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 744Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 745Assert.Equal("ParentId1", Activity.Current.ParentId); 746Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 747Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 774Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 775Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 776Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 804Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 805Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 806Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 835Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 836Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value3"); 837Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value4"); 865Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 874Assert.Equal(expectedBaggage, Activity.Current.Baggage.ToArray()); 902Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 903Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1/1"); 932Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); 933Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat); 934Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString()); 935Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString()); 936Assert.Equal("TraceState1", Activity.Current.TraceStateString); 938Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); 939Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); 999Assert.Null(Activity.Current); 1010Assert.NotNull(Activity.Current); 1011Assert.True(Activity.Current.Recorded); 1026parentSpanId = Activity.Current.ParentSpanId.ToHexString();
HostingApplicationTests.cs (7)
113var initialActivity = Activity.Current; 116using var dummyActivity = dummySource.StartActivity("DummyActivity"); 118Assert.Equal(Activity.Current, dummyActivity); 122Assert.Equal(activityFeature.Activity.Id, Activity.Current.ParentId); 123Assert.NotEqual(Activity.Current, activityFeature.Activity); 131public Activity Activity { get; set; }
Microsoft.AspNetCore.Http (1)
Features\IHttpActivityFeature.cs (1)
16Activity Activity { get; set; }
Microsoft.AspNetCore.Http.Connections.Tests (3)
HttpConnectionDispatcherTests.cs (3)
3095public TestActivityFeature(Activity activity) 3100public Activity Activity { get; set; } 3129Assert.Equal("true", Activity.Current.GetTagItem("http.long_running"));
Microsoft.AspNetCore.Http.Extensions (1)
DefaultProblemDetailsWriter.cs (1)
58var traceId = Activity.Current?.Id ?? httpContext.TraceIdentifier;
Microsoft.AspNetCore.Http.Extensions.Tests (14)
ProblemDetailsDefaultWriterTest.cs (14)
29var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 66var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 98var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 132var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 174var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 214var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 251var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 294var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 337var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 380var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 423var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 464var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 511var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier; 552var expectedTraceId = Activity.Current?.Id ?? context.TraceIdentifier;
Microsoft.AspNetCore.Identity.UI (2)
Areas\Identity\Pages\V4\Error.cshtml.cs (1)
37RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Areas\Identity\Pages\V5\Error.cshtml.cs (1)
37RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
Microsoft.AspNetCore.Mvc.Core (1)
Infrastructure\DefaultProblemDetailsFactory.cs (1)
105var traceId = Activity.Current?.Id ?? httpContext?.TraceIdentifier;
Microsoft.AspNetCore.Mvc.Core.Test (2)
DependencyInjection\ApiBehaviorOptionsSetupTest.cs (1)
110Assert.Equal(Activity.Current.Id, problemDetails.Extensions["traceId"]);
Infrastructure\ProblemDetalsClientErrorFactoryTest.cs (1)
91Assert.Equal(Activity.Current.Id, problemDetails.Extensions["traceId"]);
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
ActivityReplacer.cs (2)
10private readonly Activity _activity; 20Debug.Assert(Activity.Current == _activity);
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
XmlSerializerFormattersWrappingTest.cs (1)
211$"<traceId>{Activity.Current.Id}</traceId>" +
Microsoft.AspNetCore.SignalR.Client.Core (13)
HubConnection.cs (7)
1015private async Task<(ConnectionState, Activity?)> WaitForActiveConnectionWithActivityAsync(string sendingMethodName, string invokedMethodName, CancellationToken token) 1019var activity = CreateActivity(invokedMethodName); 1063static void SetServerTags(Activity? activity, Uri? uri) 1102private Activity? CreateActivity(string methodName) 1104var activity = _activitySource.CreateActivity(ActivityName, ActivityKind.Client); 1105if (activity is null && Activity.Current is not null && _logger.IsEnabled(LogLevel.Critical)) 1189private static void InjectHeaders(Activity currentActivity, HubInvocationMessage invocationMessage)
Internal\InvocationRequest.cs (6)
26public Activity? Activity { get; } 28protected InvocationRequest(CancellationToken cancellationToken, Type resultType, string invocationId, ILogger logger, HubConnection hubConnection, Activity? activity) 48public static InvocationRequest Invoke(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity, out Task<object?> result) 56ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity, out ChannelReader<object?> result) 83public Streaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity) 171public NonStreaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (26)
HubConnectionTests.Tracing.cs (26)
35var serverChannel = Channel.CreateUnbounded<Activity>(); 36var clientChannel = Channel.CreateUnbounded<Activity>(); 66Activity clientParentActivity1 = null; 67Activity clientActivity1 = null; 68Activity clientParentActivity2 = null; 69Activity clientActivity2 = null; 86Assert.Equal(clientParentActivity1, Activity.Current); 108Assert.Equal(clientParentActivity2, Activity.Current); 229var serverChannel = Channel.CreateUnbounded<Activity>(); 230var clientActivityTcs = new TaskCompletionSource<Activity>(); 231Activity clientActivity = null; 255Activity clientParentActivity = null; 280Assert.Equal(clientParentActivity, Activity.Current); 374var serverChannel = Channel.CreateUnbounded<Activity>(); 375var clientActivityTcs = new TaskCompletionSource<Activity>(); 440var clientActivity = await clientActivityTcs.Task.DefaultTimeout(); 477var serverChannel = Channel.CreateUnbounded<Activity>(); 478var clientActivityTcs = new TaskCompletionSource<Activity>(); 537var clientActivity = await clientActivityTcs.Task.DefaultTimeout(); 573var serverChannel = Channel.CreateUnbounded<Activity>(); 574var clientActivityTcs = new TaskCompletionSource<Activity>(); 632var clientActivity = await clientActivityTcs.Task.DefaultTimeout(); 663var serverChannel = Channel.CreateUnbounded<Activity>(); 664var clientActivityTcs = new TaskCompletionSource<Activity>(); 704Assert.Null(Activity.Current); 731var clientActivity = await clientActivityTcs.Task.DefaultTimeout();
Microsoft.AspNetCore.SignalR.Client.Tests (6)
HubConnectionTests.Tracing.cs (6)
25Activity clientActivity = null; 62Activity clientActivity = null; 100Activity clientActivity = null; 134Activity clientActivity = null; 172var clientActivityTcs = new TaskCompletionSource<Activity>(TaskCreationOptions.RunContinuationsAsynchronously); ; 196var clientActivity = await clientActivityTcs.Task.DefaultTimeout();
Microsoft.AspNetCore.SignalR.Core (22)
HubConnectionContext.cs (1)
62internal Activity? OriginalActivity { get; set; }
HubConnectionHandler.cs (1)
136OriginalActivity = Activity.Current,
Internal\DefaultHubDispatcher.cs (18)
89Activity? activity = null; 125Activity? activity = null; 399var previousActivity = Activity.Current; 402Activity.Current = null; 407var activity = StartActivity(SignalRServerActivitySource.InvocationIn, ActivityKind.Server, connection.OriginalActivity, scope.ServiceProvider, hubMethodInvocationMessage.Target, hubMethodInvocationMessage.Headers, logger); 428if (Activity.Current != previousActivity) 430Activity.Current = previousActivity; 519var previousActivity = Activity.Current; 522Activity.Current = null; 525var activity = StartActivity(SignalRServerActivitySource.InvocationIn, ActivityKind.Server, connection.OriginalActivity, scope.ServiceProvider, hubMethodInvocationMessage.Target, hubMethodInvocationMessage.Headers, _logger); 592if (Activity.Current != previousActivity) 594Activity.Current = previousActivity; 834private static Activity? StartActivity(string operationName, ActivityKind kind, Activity? linkedActivity, IServiceProvider serviceProvider, string methodName, IDictionary<string, string>? headers, ILogger logger) 859Activity? activity; 894private static void SetActivityError(Activity? activity, Exception ex)
src\Shared\Diagnostics\ActivityCreator.cs (2)
13public static Activity? CreateFromRemote( 24Activity? activity = null;
Microsoft.AspNetCore.SignalR.Tests (48)
HubConnectionHandlerTests.Activity.cs (47)
22var serverChannel = Channel.CreateUnbounded<Activity>(); 44var mockHttpRequestActivity = new Activity("HttpRequest"); 46Activity.Current = mockHttpRequestActivity; 54var connectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 63var invocation1Activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 69var invocation2Activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 75var invocation3Activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 78var userCodeActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 87var disconnectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 97var serverChannel = Channel.CreateUnbounded<Activity>(); 119var mockHttpRequestActivity = new Activity("HttpRequest"); 121Activity.Current = mockHttpRequestActivity; 129var connectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 145var invocationActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 159var disconnectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 169var serverChannel = Channel.CreateUnbounded<Activity>(); 188var mockHttpRequestActivity = new Activity("HttpRequest"); 190Activity.Current = mockHttpRequestActivity; 200var connectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 205var invocation1Activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 210var invocation2Activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 218var disconnectedActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 228var serverChannel = Channel.CreateUnbounded<Activity>(); 247var mockHttpRequestActivity = new Activity("HttpRequest"); 249Activity.Current = mockHttpRequestActivity; 259var connectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 271var invocationActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 285var disconnectActivity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 301var serverChannel = Channel.CreateUnbounded<Activity>(); 320var mockHttpRequestActivity = new Activity("HttpRequest"); 322Activity.Current = mockHttpRequestActivity; 330var activity = await serverChannel.Reader.ReadAsync().DefaultTimeout(); 348var serverChannel = Channel.CreateUnbounded<Activity>(); 367var mockHttpRequestActivity = new Activity("HttpRequest"); 369Activity.Current = mockHttpRequestActivity; 383var activity = activities[1]; 400var serverChannel = Channel.CreateUnbounded<Activity>(); 419var mockHttpRequestActivity = new Activity("HttpRequest"); 421Activity.Current = mockHttpRequestActivity; 433var activity = activities[1]; 451var serverChannel = Channel.CreateUnbounded<Activity>(); 470var mockHttpRequestActivity = new Activity("HttpRequest"); 472Activity.Current = mockHttpRequestActivity; 484var activity = activities[1]; 491private static void AssertHubMethodActivity<THub>(Activity activity, Activity parent, string methodName, Activity linkedActivity, Type exceptionType = null, string activityName = null)
HubConnectionHandlerTestUtils\Hubs.cs (1)
376var activity = testActivitySource.ActivitySource.StartActivity("inner", ActivityKind.Server);
Microsoft.Extensions.Logging (7)
LoggerFactoryScopeProvider.cs (7)
37Activity? activity = Activity.Current; 78private static ActivityBaggageLogScopeWrapper GetOrCreateActivityBaggageLogScopeWrapper(Activity activity, IEnumerable<KeyValuePair<string, string?>> items) 137public ActivityLogScope(Activity activity, ActivityTrackingOptions activityTrackingOption) 291public static string GetSpanId(this Activity activity) 301public static string GetTraceId(this Activity activity) 311public static string GetParentId(this Activity activity)
Microsoft.Extensions.Logging.EventSource (2)
EventSourceLogger.cs (2)
75Activity? activity = Activity.Current;
Microsoft.Extensions.Telemetry (7)
Logging\Import\LoggerFactoryScopeProvider.cs (7)
56Activity? activity = Activity.Current; 97private static ActivityBaggageLogScopeWrapper GetOrCreateActivityBaggageLogScopeWrapper(Activity activity, IEnumerable<KeyValuePair<string, string?>> items) 156public ActivityLogScope(Activity activity, ActivityTrackingOptions activityTrackingOption) 293public static string GetSpanId(this Activity activity) 303public static string GetTraceId(this Activity activity) 313public static string GetParentId(this Activity activity)
Microsoft.Extensions.Telemetry.Tests (12)
Logging\ExtendedLoggerFactoryTests.cs (12)
128Activity activity = Activity.Current!; 205using Activity activity = new Activity("ScopeActivity"); 215using Activity b = new Activity("ScopeActivity"); 255using Activity activity = new Activity("ScopeActivity"); 288using Activity activity = new Activity("ScopeActivity"); 317using Activity activity = new Activity("ScopeActivity"); 345using Activity activity = new Activity("ScopeActivity"); 419using Activity activity = new Activity("ScopeActivity"); 643public static string GetSpanId(this Activity activity) 655public static string GetTraceId(this Activity activity) 667public static string GetParentId(this Activity activity)
MvcFormSample (1)
Controllers\HomeController.cs (1)
48return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
OrderProcessor (2)
OrderProcessingWorker.cs (2)
67Activity.Current?.AddTag("order-id", order.Id); 68Activity.Current?.AddTag("product-count", order.Items.Count);
PathSchemeSelection (1)
Controllers\HomeController.cs (1)
26return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
Seq.ApiService (1)
Program.cs (1)
23using var activity = source.StartActivity("Chose {Number}");
StaticFilesAuth (1)
Controllers\HomeController.cs (1)
24return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
Stress.ApiService (25)
ProducerConsumer.cs (4)
28using var appActivity = s_activitySource.StartActivity("ConsumerApp", ActivityKind.Internal); 38using var activity = s_activitySource.StartActivity($"Consume {item.Id}", ActivityKind.Consumer, parentId: null, links: links); 44using var appActivity = s_activitySource.StartActivity("ProducerApp", ActivityKind.Internal); 51using (var activity = s_activitySource.StartActivity($"Produce {id}", ActivityKind.Producer))
Program.cs (10)
74var current = Activity.Current; 75Activity.Current = null; 83Activity.Current = current; 240var span1 = traceCreator.CreateActivity("Test 1", "0485b1947fe788bb"); 243var span2 = traceCreator.CreateActivity("Test 2", "0485b1947fe788bb"); 253var current = Activity.Current; 254Activity.Current = null; 261Activity.Current = current;
TraceCreator.cs (11)
17private readonly List<Activity> _allActivities = new List<Activity>(); 19public Activity? CreateActivity(string name, string? spandId) 21var activity = s_activitySource.StartActivity(name, ActivityKind.Client); 27typeof(Activity).GetField("_spanId", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(activity, spandId); 28typeof(Activity).GetField("_traceId", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(activity, activity.TraceId.ToString()); 37var activityStack = new Stack<Activity>(); 47using var activity = s_activitySource.StartActivity(rootName ?? name, ActivityKind.Client); 75using var activity = s_activitySource.StartActivity(ActivityKind.Client, name: name, links: links.DistinctBy(l => l.Context.SpanId)); 93private static void AddEvents(Activity activity) 128var a = _allActivities[Random.Shared.Next(0, _allActivities.Count)];
System.Diagnostics.DiagnosticSource (145)
System\Diagnostics\Activity.cs (43)
18/// Carries the <see cref="Activity.Current"/> changed event data. 22internal ActivityChangedEventArgs(Activity? previous, Activity? current) 29/// Gets <see cref="Activity"/> object before the event. 31public Activity? Previous { get; init; } 34/// Gets <see cref="Activity"/> object after the event. 36public Activity? Current { get; init; } 65private static readonly AsyncLocal<Activity?> s_current = new AsyncLocal<Activity?>(); 79/// Event occur when the <see cref="Activity.Current"/> value changes. 117private Activity? _previousActiveActivity; 138public static Activity? Current 160public Activity SetStatus(ActivityStatusCode code, string? description = null) 203public Activity? Parent { get; private set; } 380for (Activity? activity = this; activity != null; activity = activity.Parent) 390static IEnumerable<KeyValuePair<string, string?>> Iterate(Activity? activity) 476public Activity AddTag(string key, string? value) => AddTag(key, (object?)value); 486public Activity AddTag(string key, object? value) 510public Activity SetTag(string key, object? value) 527public Activity AddEvent(ActivityEvent e) 552public Activity AddException(Exception exception, in TagList tags = default, DateTimeOffset timestamp = default) 615public Activity AddLink(ActivityLink link) 634public Activity AddBaggage(string key, string? value) 658public Activity SetBaggage(string key, string? value) 679public Activity SetParentId(string parentId) 709public Activity SetParentId(ActivityTraceId traceId, ActivitySpanId spanId, ActivityTraceFlags activityTraceFlags = ActivityTraceFlags.None) 739public Activity SetStartTime(DateTime startTimeUtc) 759public Activity SetEndTime(DateTime endTimeUtc) 788/// Use <see cref="DiagnosticSource.StartActivity(Activity, object)"/> to start activity and write start event. 790/// <seealso cref="DiagnosticSource.StartActivity(Activity, object)"/> 792public Activity Start() 844/// Use <see cref="DiagnosticSource.StopActivity(Activity, object)"/> to stop activity and write stop event. 846/// <seealso cref="DiagnosticSource.StopActivity(Activity, object)"/> 889for (Activity? activity = this; activity != null; activity = activity.Parent) 1049public Activity SetIdFormat(ActivityIdFormat format) 1178internal static Activity Create(ActivitySource source, string name, ActivityKind kind, string? parentId, ActivityContext parentContext, 1182Activity activity = new Activity(name); 1261private static void SetCurrent(Activity? activity) 1270Activity? previous = s_current.Value; 1410private static bool ValidateSetCurrent(Activity? activity) 1473/// Indicates whether this <see cref="Activity"/> object is stopped 1476/// When subscribing to <see cref="Activity"/> stop event using <see cref="ActivityListener.ActivityStopped"/>, the received <see cref="Activity"/> object in the event callback will have <see cref="IsStopped"/> as true.
System\Diagnostics\ActivityContext.cs (2)
78return Activity.TryConvertIdToContext(traceParent, traceState, isRemote, out context); 104if (!Activity.TryConvertIdToContext(traceParent, traceState, isRemote: false, out ActivityContext context))
System\Diagnostics\ActivityCreationOptions.cs (6)
38if (IdFormat == ActivityIdFormat.Unknown && Activity.ForceDefaultIdFormat) 40IdFormat = Activity.DefaultIdFormat; 80IdFormat = Activity.Current != null ? Activity.Current.IdFormat : Activity.DefaultIdFormat; 135Func<ActivityTraceId>? traceIdGenerator = Activity.TraceIdGenerator;
System\Diagnostics\ActivityEvent.cs (5)
15private readonly Activity.TagsLinkedList? _tags; 40_tags = tagsCount > 0 ? new Activity.TagsLinkedList(tags!) : null; 61/// <returns><see cref="Activity.Enumerator{T}"/>.</returns> 62public Activity.Enumerator<KeyValuePair<string, object?>> EnumerateTagObjects() => new Activity.Enumerator<KeyValuePair<string, object?>>(_tags?.First);
System\Diagnostics\ActivityLink.cs (5)
17private readonly Activity.TagsLinkedList? _tags; 28_tags = tags?.Count > 0 ? new Activity.TagsLinkedList(tags) : null; 50/// <returns><see cref="Activity.Enumerator{T}"/>.</returns> 51public Activity.Enumerator<KeyValuePair<string, object?>> EnumerateTagObjects() => new Activity.Enumerator<KeyValuePair<string, object?>>(_tags?.First);
System\Diagnostics\ActivityListener.cs (12)
14/// Define the callback to be used in <see cref="ActivityListener"/> to receive notifications when exceptions are added to the <see cref="Activity"/>. 16public delegate void ExceptionRecorder(Activity activity, Exception exception, ref TagList tags); 24/// Construct a new <see cref="ActivityListener"/> object to start listening to the <see cref="Activity"/> events. 31/// Set or get the callback used to listen to the <see cref="Activity"/> start event. 33public Action<Activity>? ActivityStarted { get; set; } 36/// Set or get the callback used to listen to the <see cref="Activity"/> stop event. 38public Action<Activity>? ActivityStopped { get; set; } 41/// Set or get the callback used to listen to <see cref="Activity"/> events when exceptions are added. 46/// Set or get the callback used to decide if want to listen to <see cref="Activity"/> objects events which created using <see cref="ActivitySource"/> object. 51/// Set or get the callback used to decide allowing creating <see cref="Activity"/> objects with specific data state. 56/// Set or get the callback used to decide allowing creating <see cref="Activity"/> objects with specific data state. 61/// Dispose will unregister this <see cref="ActivityListener"/> object from listening to <see cref="Activity"/> events.
System\Diagnostics\ActivitySource.cs (38)
100/// Creates a new <see cref="Activity"/> object if there is any listener to the Activity, returns null otherwise. 104/// <returns>The created <see cref="Activity"/> object or null if there is no any event listener.</returns> 106/// If the Activity object is created, it will not start automatically. Callers need to call <see cref="Activity.Start()"/> to start it. 108public Activity? CreateActivity(string name, ActivityKind kind) 112/// Creates a new <see cref="Activity"/> object if there is any listener to the Activity, returns null otherwise. 113/// If the Activity object is created, it will not automatically start. Callers will need to call <see cref="Activity.Start()"/> to start it. 121/// <returns>The created <see cref="Activity"/> object or null if there is no any listener.</returns> 123/// If the Activity object is created, it will not start automatically. Callers need to call <see cref="Activity.Start()"/> to start it. 125public Activity? CreateActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, ActivityIdFormat idFormat = ActivityIdFormat.Unknown) 129/// Creates a new <see cref="Activity"/> object if there is any listener to the Activity, returns null otherwise. 137/// <returns>The created <see cref="Activity"/> object or null if there is no any listener.</returns> 139/// If the Activity object is created, it will not start automatically. Callers need to call <see cref="Activity.Start()"/> to start it. 141public Activity? CreateActivity(string name, ActivityKind kind, string? parentId, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, ActivityIdFormat idFormat = ActivityIdFormat.Unknown) 145/// Creates and starts a new <see cref="Activity"/> object if there is any listener to the Activity, returns null otherwise. 149/// <returns>The created <see cref="Activity"/> object or null if there is no any event listener.</returns> 150public Activity? StartActivity([CallerMemberName] string name = "", ActivityKind kind = ActivityKind.Internal) 154/// Creates and starts a new <see cref="Activity"/> object if there is any listener to the Activity events, returns null otherwise. 162/// <returns>The created <see cref="Activity"/> object or null if there is no any listener.</returns> 163public Activity? StartActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default) 167/// Creates and starts a new <see cref="Activity"/> object if there is any listener to the Activity events, returns null otherwise. 175/// <returns>The created <see cref="Activity"/> object or null if there is no any listener.</returns> 176public Activity? StartActivity(string name, ActivityKind kind, string? parentId, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default) 180/// Creates and starts a new <see cref="Activity"/> object if there is any listener to the Activity events, returns null otherwise. 188/// <returns>The created <see cref="Activity"/> object or null if there is no any listener.</returns> 189public Activity? StartActivity(ActivityKind kind, ActivityContext parentContext = default, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default, [CallerMemberName] string name = "") 192private Activity? CreateActivity(string name, ActivityKind kind, ActivityContext context, string? parentId, IEnumerable<KeyValuePair<string, object?>>? tags, 202Activity? activity = null; 288bool useCurrentActivityContext = context == default && Activity.Current != null; 289var aco = new ActivityCreationOptions<ActivityContext>(this, name, useCurrentActivityContext ? Activity.Current!.Context : context, kind, tags, links, idFormat); 317activity = Activity.Create(this, name, kind, parentId, context, tags, links, startTime, samplerTags, samplingResult, startIt, idFormat, traceState); 333/// Add a listener to the <see cref="Activity"/> starting and stopping events. 335/// <param name="listener"> The <see cref="ActivityListener"/> object to use for listening to the <see cref="Activity"/> events.</param> 373internal void NotifyActivityStart(Activity activity) 381listeners.EnumWithAction((listener, obj) => listener.ActivityStarted?.Invoke((Activity)obj), activity); 385internal void NotifyActivityStop(Activity activity) 393listeners.EnumWithAction((listener, obj) => listener.ActivityStopped?.Invoke((Activity)obj), activity); 397internal void NotifyActivityAddException(Activity activity, Exception exception, ref TagList tags) 502public void EnumWithExceptionNotification(Activity activity, Exception exception, ref TagList tags)
System\Diagnostics\DiagnosticListener.cs (4)
280internal Action<Activity, object?>? OnActivityImport; 281internal Action<Activity, object?>? OnActivityExport; 431Action<Activity, object?>? onActivityImport, Action<Activity, object?>? onActivityExport)
System\Diagnostics\DiagnosticSourceActivity.cs (17)
19/// was started. Consumers could access <see cref="Activity.Current"/> 27/// <seealso cref="Activity"/> 29public Activity StartActivity(Activity activity, object? args) 39public Activity StartActivity<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(Activity activity, T args) 44/// that Activity was stopped. Consumers could access <see cref="Activity.Current"/> 51/// <seealso cref="Activity"/> 53public void StopActivity(Activity activity, object? args) 58activity.SetEndTime(Activity.GetUtcNow()); 66public void StopActivity<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(Activity activity, T args) 93public virtual void OnActivityImport(Activity activity, object? payload) { } 119public virtual void OnActivityExport(Activity activity, object? payload) { } 124public override void OnActivityImport(Activity activity, object? payload) 130public override void OnActivityExport(Activity activity, object? payload) 144Action<Activity, object?>? onActivityImport = null, Action<Activity, object?>? onActivityExport = null)
System\Diagnostics\DistributedContextPropagator.cs (2)
45/// Injects the trace values stored in the <see cref="Activity"/> object into a carrier. For example, into the headers of an HTTP request. 50public abstract void Inject(Activity? activity, object? carrier, PropagatorSetterCallback? setter);
System\Diagnostics\DsesActivitySourceListener.cs (3)
164[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(Activity))] 172private void OnActivityStarted(Activity activity) 183private void OnActivityStopped(Activity activity)
System\Diagnostics\DsesFilterAndTransform.cs (1)
929return Activity.Current;
System\Diagnostics\LegacyPropagator.cs (1)
16public override void Inject(Activity? activity, object? carrier, PropagatorSetterCallback? setter)
System\Diagnostics\NoOutputPropagator.cs (1)
14public override void Inject(Activity? activity, object? carrier, PropagatorSetterCallback? setter)
System\Diagnostics\PassThroughPropagator.cs (5)
14public override void Inject(Activity? activity, object? carrier, PropagatorSetterCallback? setter) 46Activity? activity = Activity.Current; 48while (activity?.Parent is Activity parent) 55isW3c = parentId is not null ? Activity.TryConvertIdToContext(parentId, traceState, isRemote: false, out _) : false;
System.Net.Http (34)
System\Net\Http\DiagnosticsHandler.cs (6)
51return Activity.Current != null || 56private static Activity? StartActivity(HttpRequestMessage request) 58Activity? activity = null; 65(Activity.Current is not null || 111Activity? activity = StartActivity(request); 346private void InjectHeaders(Activity currentActivity, HttpRequestMessage request)
System\Net\Http\SocketsHttpHandler\ConnectionPool\ConnectionSetupDistributedTracing.cs (10)
15public static Activity? StartConnectionSetupActivity(bool isSecure, HttpAuthority authority) 17Activity? activity = null; 22Activity.Current = null; 40public static void StopConnectionSetupActivity(Activity activity, Exception? exception, IPEndPoint? remoteEndPoint) 58public static void ReportError(Activity? activity, Exception exception) 72public static Activity? StartWaitForConnectionActivity(HttpAuthority authority) 74Activity? activity = s_connectionsActivitySource.StartActivity(DiagnosticsHandlerLoggingStrings.WaitForConnectionActivityName); 83public static void AddConnectionLinkToRequestActivity(Activity connectionSetupActivity) 90Activity? requestActivity = Activity.Current;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (2)
568private async ValueTask<(Stream, TransportContext?, Activity?, IPEndPoint?)> ConnectAsync(HttpRequestMessage request, bool async, CancellationToken cancellationToken) 575Activity? activity = ConnectionSetupDistributedTracing.StartConnectionSetupActivity(IsSecure, OriginAuthority);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (2)
296(Stream stream, TransportContext? transportContext, Activity? activity, IPEndPoint? remoteEndPoint) = await ConnectAsync(request, async, cancellationToken).ConfigureAwait(false); 300private async ValueTask<HttpConnection> ConstructHttp11ConnectionAsync(bool async, Stream stream, TransportContext? transportContext, HttpRequestMessage request, Activity? activity, IPEndPoint? remoteEndPoint, CancellationToken cancellationToken)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (3)
187(Stream stream, TransportContext? transportContext, Activity? activity, IPEndPoint? remoteEndPoint) = await ConnectAsync(queueItem.Request, true, cts.Token).ConfigureAwait(false); 246private async ValueTask<Http2Connection> ConstructHttp2ConnectionAsync(Stream stream, HttpRequestMessage request, Activity? activity, IPEndPoint? remoteEndPoint, CancellationToken cancellationToken) 289private async Task HandleHttp11Downgrade(HttpRequestMessage request, Stream stream, TransportContext? transportContext, Activity? activity, IPEndPoint? remoteEndPoint, CancellationToken cancellationToken)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (2)
91Activity? waitForConnectionActivity = ConnectionSetupDistributedTracing.StartWaitForConnectionActivity(authority); 265Activity? connectionSetupActivity = null;
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionWaiter.cs (2)
22return HttpTelemetry.Log.IsEnabled() || pool.Settings._metrics!.RequestsQueueDuration.Enabled || Activity.Current?.Source == DiagnosticsHandler.s_activitySource 33using Activity? waitForConnectionActivity = ConnectionSetupDistributedTracing.StartWaitForConnectionActivity(pool.OriginAuthority);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (1)
133public Http2Connection(HttpConnectionPool pool, Stream stream, Activity? connectionSetupActivity, IPEndPoint? remoteEndPoint)
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (2)
92public void InitQuicConnection(QuicConnection connection, Activity? connectionSetupActivity) 244public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, long queueStartingTimestamp, Activity? waitForConnectionActivity, CancellationToken cancellationToken)
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
76Activity? connectionSetupActivity,
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (3)
41public Activity? ConnectionSetupActivity { get; private set; } 50public HttpConnectionBase(HttpConnectionPool pool, Activity? connectionSetupActivity, IPEndPoint? remoteEndPoint) 56protected void MarkConnectionAsEstablished(Activity? connectionSetupActivity, IPEndPoint? remoteEndPoint)
System.Net.NameResolution (4)
System\Net\Dns.cs (3)
680Activity? activityToRestore = tracingEnabled ? Activity.Current : null; 685Activity.Current = activityToRestore;
System\Net\NameResolutionTelemetry.cs (1)
167private readonly Activity? _activity;
System.Net.Security (4)
System\Net\Security\NetSecurityTelemetry.cs (3)
316public static Activity? StartActivity(SslStream stream) 318using Activity? activity = s_activitySource.StartActivity(ActivityName); 331public static void StopActivity(Activity? activity, Exception? exception, SslStream stream)
System\Net\Security\SslStream.IO.cs (1)
138Activity? activity = NetSecurityTelemetry.StartActivity(this);
System.Net.Sockets (12)
System\Net\Sockets\Socket.cs (1)
3353Activity? activity = SocketsTelemetry.Log.ConnectStart(socketAddress, _protocolType, endPointSnapshot, keepActivityCurrent: false);
System\Net\Sockets\SocketAsyncEventArgs.cs (4)
75private static ConditionalWeakTable<SocketAsyncEventArgs, Activity>? s_connectActivityTable; 310internal Activity? ConnectActivity 315get => s_connectActivityTable?.TryGetValue(this, out Activity? result) == true ? result : null; 320LazyInitializer.EnsureInitialized(ref s_connectActivityTable, () => new ConditionalWeakTable<SocketAsyncEventArgs, Activity>());
System\Net\Sockets\SocketsTelemetry.cs (7)
84public Activity? ConnectStart(SocketAddress address, ProtocolType protocolType, EndPoint endPoint, bool keepActivityCurrent) 93Activity? activity = null; 96Activity? activityToReset = keepActivityCurrent ? Activity.Current : null; 101Activity.Current = activityToReset; 139static void SetNetworkTransport(Activity activity, string transportType) => activity.SetTag("network.transport", transportType); 145public void AfterConnect(SocketError error, Activity? activity, string? exceptionMessage = null)