@@ -6,12 +6,9 @@ package aws.sdk.kotlin.benchmarks.service.telemetry
66
77import aws.smithy.kotlin.runtime.ExperimentalApi
88import aws.smithy.kotlin.runtime.collections.Attributes
9- import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
9+ import aws.smithy.kotlin.runtime.telemetry.AbstractTelemetryProvider
1010import aws.smithy.kotlin.runtime.telemetry.context.Context
11- import aws.smithy.kotlin.runtime.telemetry.context.ContextManager
12- import aws.smithy.kotlin.runtime.telemetry.logging.LoggerProvider
1311import aws.smithy.kotlin.runtime.telemetry.metrics.*
14- import aws.smithy.kotlin.runtime.telemetry.trace.TracerProvider
1512
1613private val capturedMetrics = mapOf (
1714 " smithy.client.call.attempt_overhead_duration" to " Overhead" ,
@@ -23,45 +20,11 @@ private val capturedMetrics = mapOf(
2320)
2421
2522@ExperimentalApi
26- class BenchmarkTelemetryProvider (private val metricAggregator : MetricAggregator ) : TelemetryProvider {
27- override val contextManager = ContextManager .None
28- override val loggerProvider = LoggerProvider .None
29- override val tracerProvider = TracerProvider .None
30-
31- override val meterProvider = object : MeterProvider {
32- override fun getOrCreateMeter (scope : String ) = object : Meter {
33- override fun createUpDownCounter (name : String , units : String? , description : String? ) =
34- NoOpUpDownCounter
35-
36- override fun createAsyncUpDownCounter (
37- name : String ,
38- callback : LongUpDownCounterCallback ,
39- units : String? ,
40- description : String? ,
41- ) = NoOpAsyncMeasurementHandle
42-
43- override fun createMonotonicCounter (name : String , units : String? , description : String? ) =
44- NoOpMonotonicCounter
45-
46- override fun createLongHistogram (name : String , units : String? , description : String? ) =
47- NoOpLongHistogram
48-
23+ class BenchmarkTelemetryProvider (private val metricAggregator : MetricAggregator ) : AbstractTelemetryProvider() {
24+ override val meterProvider = object : AbstractMeterProvider () {
25+ override fun getOrCreateMeter (scope : String ) = object : AbstractMeter () {
4926 override fun createDoubleHistogram (name : String , units : String? , description : String? ) =
50- capturedMetrics[name]?.let { BenchmarkDoubleHistogram (it, units) } ? : NoOpDoubleHistogram
51-
52- override fun createLongGauge (
53- name : String ,
54- callback : LongGaugeCallback ,
55- units : String? ,
56- description : String? ,
57- ) = NoOpAsyncMeasurementHandle
58-
59- override fun createDoubleGauge (
60- name : String ,
61- callback : DoubleGaugeCallback ,
62- units : String? ,
63- description : String? ,
64- ) = NoOpAsyncMeasurementHandle
27+ capturedMetrics[name]?.let { BenchmarkDoubleHistogram (it, units) } ? : Histogram .DoubleNone
6528 }
6629 }
6730
@@ -92,23 +55,3 @@ class BenchmarkTelemetryProvider(private val metricAggregator: MetricAggregator)
9255 }
9356 }
9457}
95-
96- private object NoOpAsyncMeasurementHandle : AsyncMeasurementHandle {
97- override fun stop () { }
98- }
99-
100- private object NoOpDoubleHistogram : DoubleHistogram {
101- override fun record (value : Double , attributes : Attributes , context : Context ? ) { }
102- }
103-
104- private object NoOpLongHistogram : LongHistogram {
105- override fun record (value : Long , attributes : Attributes , context : Context ? ) { }
106- }
107-
108- private object NoOpMonotonicCounter : MonotonicCounter {
109- override fun add (value : Long , attributes : Attributes , context : Context ? ) { }
110- }
111-
112- private object NoOpUpDownCounter : UpDownCounter {
113- override fun add (value : Long , attributes : Attributes , context : Context ? ) { }
114- }
0 commit comments