File tree Expand file tree Collapse file tree 4 files changed +16
-37
lines changed
OpenTelemetry.Tests.Stress.Logs
OpenTelemetry.Tests.Stress.Metrics
OpenTelemetry.Tests.Stress.Traces
OpenTelemetry.Tests.Stress Expand file tree Collapse file tree 4 files changed +16
-37
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ public LogsStressTest(StressTestOptions options)
32
32
this . logger = this . loggerFactory . CreateLogger < LogsStressTest > ( ) ;
33
33
}
34
34
35
+ public override void Dispose ( )
36
+ {
37
+ this . loggerFactory . Dispose ( ) ;
38
+ base . Dispose ( ) ;
39
+ }
40
+
35
41
protected override void RunWorkItemInParallel ( )
36
42
{
37
43
this . logger . FoodRecallNotice (
@@ -41,15 +47,5 @@ protected override void RunWorkItemInParallel()
41
47
recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
42
48
companyName : "Contoso Fresh Vegetables, Inc." ) ;
43
49
}
44
-
45
- protected override void Dispose ( bool isDisposing )
46
- {
47
- if ( isDisposing )
48
- {
49
- this . loggerFactory . Dispose ( ) ;
50
- }
51
-
52
- base . Dispose ( isDisposing ) ;
53
- }
54
50
}
55
51
}
Original file line number Diff line number Diff line change @@ -77,6 +77,12 @@ public MetricsStressTest(MetricsStressTestOptions options)
77
77
this . meterProvider = builder . Build ( ) ;
78
78
}
79
79
80
+ public override void Dispose ( )
81
+ {
82
+ this . meterProvider . Dispose ( ) ;
83
+ base . Dispose ( ) ;
84
+ }
85
+
80
86
protected override void WriteRunInformationToConsole ( )
81
87
{
82
88
if ( this . Options . PrometheusTestMetricsPort != 0 )
@@ -105,16 +111,6 @@ protected override void RunWorkItemInParallel()
105
111
new ( "DimName3" , DimensionValues [ random . Next ( 0 , ArraySize ) ] ) ) ;
106
112
}
107
113
}
108
-
109
- protected override void Dispose ( bool isDisposing )
110
- {
111
- if ( isDisposing )
112
- {
113
- this . meterProvider . Dispose ( ) ;
114
- }
115
-
116
- base . Dispose ( isDisposing ) ;
117
- }
118
114
}
119
115
120
116
private sealed class MetricsStressTestOptions : StressTestOptions
Original file line number Diff line number Diff line change @@ -26,21 +26,14 @@ public TracesStressTest(StressTestOptions options)
26
26
. Build ( ) ;
27
27
}
28
28
29
+ public override void Dispose ( ) =>
30
+ this . tracerProvider . Dispose ( ) ;
31
+
29
32
protected override void RunWorkItemInParallel ( )
30
33
{
31
34
using var activity = ActivitySource . StartActivity ( "test" ) ;
32
35
33
36
activity ? . SetTag ( "foo" , "value" ) ;
34
37
}
35
-
36
- protected override void Dispose ( bool isDisposing )
37
- {
38
- if ( isDisposing )
39
- {
40
- this . tracerProvider . Dispose ( ) ;
41
- }
42
-
43
- base . Dispose ( isDisposing ) ;
44
- }
45
38
}
46
39
}
Original file line number Diff line number Diff line change @@ -22,10 +22,8 @@ protected StressTest(T options)
22
22
23
23
public T Options { get ; }
24
24
25
- public void Dispose ( )
25
+ public virtual void Dispose ( )
26
26
{
27
- this . Dispose ( true ) ;
28
- GC . SuppressFinalize ( this ) ;
29
27
}
30
28
31
29
public void RunSynchronously ( )
@@ -203,10 +201,6 @@ protected virtual void WriteRunInformationToConsole()
203
201
204
202
protected abstract void RunWorkItemInParallel ( ) ;
205
203
206
- protected virtual void Dispose ( bool isDisposing )
207
- {
208
- }
209
-
210
204
// Padding to avoid false sharing.
211
205
// For most systems, the cache line size should be less than or equal to 128 bytes.
212
206
private struct MeasurementData
You can’t perform that action at this time.
0 commit comments