@@ -48,8 +48,9 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName,
48
48
DiagnosticScope scope = LazyOperationScopeFactory . Value . CreateScope ( name : operationName ,
49
49
kind : clientContext . ClientOptions . ConnectionMode == ConnectionMode . Gateway ? DiagnosticScope . ActivityKind . Internal : DiagnosticScope . ActivityKind . Client ) ;
50
50
51
- // The scope here checks for listeners at Operation Level .
51
+ // Need a parent activity id associated with the operation which is logged in diagnostics and used for tracing purpose .
52
52
// If there are listeners at operation level then scope is enabled and it tries to create activity.
53
+ // However, if available listeners are not subscribed to operation level event then it will lead to scope being enabled but no activity is created.
53
54
if ( scope . IsEnabled )
54
55
{
55
56
scope . SetDisplayName ( $ "{ operationName } { containerName } ") ;
@@ -64,9 +65,9 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName,
64
65
config : requestOptions ? . CosmosThresholdOptions ?? clientContext . ClientOptions ? . CosmosClientTelemetryOptions . CosmosThresholdOptions ) ;
65
66
}
66
67
#if ! INTERNAL
67
- // The scope here checks for listeners at Network Level .
68
+ // Need a parent activity which groups all network activities under it and is logged in diagnostics and used for tracing purpose .
68
69
// If there are listeners at network level then scope is enabled and it tries to create activity.
69
- // Need a parent activity at root level so as to group all network activities under it .
70
+ // However, if available listeners are not subscribed to network event then it will lead to scope being enabled but no activity is created .
70
71
else
71
72
{
72
73
DiagnosticScope requestScope = LazyNetworkScopeFactory . Value . CreateScope ( name : operationName ) ;
@@ -75,6 +76,7 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName,
75
76
76
77
// If there are no listeners at operation level and network level and no parent activity created.
77
78
// Then create a dummy activity as there should be a parent level activity always when Distributed tracing is on.
79
+ // The parent activity id is logged in diagnostics and used for tracing purpose.
78
80
if ( Activity . Current is null )
79
81
{
80
82
openTelemetryRecorder = OpenTelemetryCoreRecorder . CreateParentActivity ( operationName ) ;
0 commit comments