11using JetBrains . Annotations ;
2+ using JetBrains . ReSharper . Feature . Services . Html ;
23using JetBrains . ReSharper . Psi ;
34using JetBrains . ReSharper . Psi . CSharp . Tree ;
45using JetBrains . ReSharper . Psi . Resolve ;
@@ -10,6 +11,7 @@ namespace Digma.Rider.Discovery
1011
1112 public class SpanDiscovery
1213 {
14+ private readonly string _methodName ;
1315 private const string ActivitySourceClassName = "System.Diagnostics.ActivitySource" ;
1416 private const string StartActivityMethodName = "StartActivity" ;
1517
@@ -19,8 +21,9 @@ public class SpanDiscovery
1921 public bool HasReferenceResolvingErrors { get ; private set ; } = false ;
2022
2123
22- public SpanDiscovery ( [ NotNull ] ILocalVariableDeclaration localVariableDeclaration )
24+ public SpanDiscovery ( [ NotNull ] ILocalVariableDeclaration localVariableDeclaration , string methodName )
2325 {
26+ _methodName = methodName ;
2427 var expressionInitializer = localVariableDeclaration . Children < IExpressionInitializer > ( ) . FirstNotNull ( ) ;
2528 var value = expressionInitializer ? . Value ;
2629 if ( value is IInvocationExpression expression )
@@ -48,15 +51,18 @@ private void DiscoverFromInvocationExpression([NotNull] IInvocationExpression in
4851 }
4952 }
5053
51- //the arguments to Activity.StartActivity("the argument")
54+ /*
55+ * the arguments to Activity.StartActivity("the argument")
56+ * or Activity.StartActivity()
57+ */
5258 private string DiscoverSpanNameFromInvocationArguments ( [ NotNull ] IArgumentList invocationExpressionArgumentList )
5359 {
5460 if ( invocationExpressionArgumentList . Arguments . Count is 1 or 2 )
5561 {
5662 return GetTextFromArgument ( invocationExpressionArgumentList . Arguments [ 0 ] ) ;
5763 }
5864
59- return null ;
65+ return invocationExpressionArgumentList . Arguments . Count == 0 ? _methodName : null ;
6066 }
6167
6268 private string DiscoverInstrumentationLibraryFromInvokedExpression (
0 commit comments