File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
tests/SharpCoreDB.Tests/Graph/Metrics Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,22 @@ namespace SharpCoreDB.Tests.Graph.Metrics;
1515/// </summary>
1616public class OpenTelemetryIntegrationTests
1717{
18+ /// <summary>
19+ /// Static constructor to register ActivityListener for test execution.
20+ /// Required for ActivitySource.StartActivity() to return non-null activities.
21+ /// </summary>
22+ static OpenTelemetryIntegrationTests ( )
23+ {
24+ // Register ActivityListener to enable activity creation during tests
25+ ActivitySource . AddActivityListener ( new ActivityListener
26+ {
27+ ShouldListenTo = source => source . Name == OpenTelemetryIntegration . ActivitySourceName ,
28+ Sample = ( ref ActivityCreationOptions < ActivityContext > options ) => ActivitySamplingResult . AllDataAndRecorded ,
29+ ActivityStarted = activity => { } ,
30+ ActivityStopped = activity => { }
31+ } ) ;
32+ }
33+
1834 [ Fact ]
1935 public void OpenTelemetryIntegration_ActivitySourceCreated ( )
2036 {
You can’t perform that action at this time.
0 commit comments