@@ -38,65 +38,67 @@ internal static void MapToOperationName(Span span)
3838 internal static string GetOperationName ( OpenTelemetryTags tags )
3939 {
4040 var httpRequestMethod = tags . GetTag ( "http.request.method" ) ;
41- if ( tags . SpanKind == SpanKinds . Server && ! string . IsNullOrEmpty ( httpRequestMethod ) )
41+ if ( ! string . IsNullOrEmpty ( httpRequestMethod ) )
4242 {
43- // IsHttpServer
44- return "http.server.request" ;
43+ if ( tags . SpanKind == SpanKinds . Server )
44+ {
45+ // IsHttpServer
46+ return "http.server.request" ;
47+ }
48+
49+ if ( tags . SpanKind == SpanKinds . Client )
50+ {
51+ // IsHttpClient
52+ return "http.client.request" ;
53+ }
4554 }
4655
47- if ( tags . SpanKind == SpanKinds . Client && ! string . IsNullOrEmpty ( httpRequestMethod ) )
48- {
49- // IsHttpClient
50- return "http.client.request" ;
51- }
52-
53- var dbSystem = tags . GetTag ( "db.system" ) ;
54- if ( tags . SpanKind == SpanKinds . Client && ! StringUtil . IsNullOrEmpty ( dbSystem ) )
56+ if ( tags . SpanKind == SpanKinds . Client && tags . GetTag ( "db.system" ) is { Length : > 0 } dbSystem )
5557 {
5658 // IsDatabase
5759 return $ "{ dbSystem . ToLowerInvariant ( ) } .query";
5860 }
5961
60- var messagingSystem = tags . GetTag ( Tags . MessagingSystem ) ;
61- var messagingOperation = tags . GetTag ( Tags . MessagingOperation ) ;
6262 if ( tags . SpanKind is SpanKinds . Client or SpanKinds . Server or SpanKinds . Producer or SpanKinds . Consumer
63- && ! StringUtil . IsNullOrEmpty ( messagingSystem ) &&
64- ! StringUtil . IsNullOrEmpty ( messagingOperation ) )
63+ && tags . GetTag ( Tags . MessagingSystem ) is { Length : > 0 } messagingSystem
64+ && tags . GetTag ( Tags . MessagingOperation ) is { Length : > 0 } messagingOperation )
6565 {
6666 // IsMessaging
6767 return $ "{ messagingSystem } .{ messagingOperation } ". ToLowerInvariant ( ) ;
6868 }
6969
7070 var rpcSystem = tags . GetTag ( Tags . RpcSystem ) ;
71- if ( tags . SpanKind == SpanKinds . Client && string . Equals ( rpcSystem , "aws-api" , StringComparison . OrdinalIgnoreCase ) )
72- {
73- // IsAwsClient
74- var service = tags . GetTag ( Tags . RpcService ) ? . ToLowerInvariant ( ) ;
75- return ! StringUtil . IsNullOrEmpty ( service ) ? $ "aws.{ service } .request" : "aws.client.request" ;
76- }
77-
78- if ( tags . SpanKind == SpanKinds . Client && ! StringUtil . IsNullOrEmpty ( rpcSystem ) )
79- {
80- // IsRpcClient
81- return $ "{ rpcSystem . ToLowerInvariant ( ) } .client.request";
82- }
83-
84- if ( tags . SpanKind == SpanKinds . Server && ! StringUtil . IsNullOrEmpty ( rpcSystem ) )
71+ if ( ! StringUtil . IsNullOrEmpty ( rpcSystem ) )
8572 {
86- // IsRpcServer
87- return $ "{ rpcSystem . ToLowerInvariant ( ) } .server.request";
73+ if ( tags . SpanKind == SpanKinds . Client && string . Equals ( rpcSystem , "aws-api" , StringComparison . OrdinalIgnoreCase ) )
74+ {
75+ // IsAwsClient
76+ var service = tags . GetTag ( Tags . RpcService ) ? . ToLowerInvariant ( ) ;
77+ return ! StringUtil . IsNullOrEmpty ( service ) ? $ "aws.{ service } .request" : "aws.client.request" ;
78+ }
79+
80+ if ( tags . SpanKind == SpanKinds . Client )
81+ {
82+ // IsRpcClient
83+ return $ "{ rpcSystem . ToLowerInvariant ( ) } .client.request";
84+ }
85+
86+ if ( tags . SpanKind == SpanKinds . Server )
87+ {
88+ // IsRpcServer
89+ return $ "{ rpcSystem . ToLowerInvariant ( ) } .server.request";
90+ }
8891 }
8992
90- var faasTrigger = tags . GetTag ( "faas.trigger" ) ;
91- if ( tags . SpanKind == SpanKinds . Server && ! StringUtil . IsNullOrEmpty ( faasTrigger ) )
93+ if ( tags . SpanKind == SpanKinds . Server && tags . GetTag ( "faas.trigger" ) is { Length : > 0 } faasTrigger )
9294 {
9395 // IsFaasServer
9496 return $ "{ faasTrigger . ToLowerInvariant ( ) } .invoke";
9597 }
9698
97- var faasInvokedProvider = tags . GetTag ( "faas.invoked_provider" ) ;
98- var faasInvokedName = tags . GetTag ( "faas.invoked_name" ) ;
99- if ( tags . SpanKind == SpanKinds . Client && ! StringUtil . IsNullOrEmpty ( faasInvokedProvider ) && ! StringUtil . IsNullOrEmpty ( faasInvokedName ) )
99+ if ( tags . SpanKind == SpanKinds . Client
100+ && tags . GetTag ( "faas.invoked_provider" ) is { Length : > 0 } faasInvokedProvider
101+ && tags . GetTag ( "faas.invoked_name" ) is { Length : > 0 } faasInvokedName )
100102 {
101103 // IsFaasClient
102104 return $ "{ faasInvokedProvider } .{ faasInvokedName } .invoke". ToLowerInvariant ( ) ;
0 commit comments