Skip to content

Commit f0006d9

Browse files
authored
mark telemetry api experimental (#885)
1 parent 54bb894 commit f0006d9

File tree

9 files changed

+24
-3
lines changed

9 files changed

+24
-3
lines changed

runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/TelemetryProvider.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package aws.smithy.kotlin.runtime.telemetry
77

8+
import aws.smithy.kotlin.runtime.ExperimentalApi
89
import aws.smithy.kotlin.runtime.telemetry.context.Context
910
import aws.smithy.kotlin.runtime.telemetry.context.ContextManager
1011
import aws.smithy.kotlin.runtime.telemetry.logging.LoggerProvider
@@ -25,24 +26,29 @@ public interface TelemetryProvider {
2526
/**
2627
* Get the [TracerProvider] used to create new [aws.smithy.kotlin.runtime.telemetry.trace.Tracer] instances
2728
*/
29+
@ExperimentalApi
2830
public val tracerProvider: TracerProvider
2931

3032
/**
3133
* Get the [MeterProvider] used to create new [aws.smithy.kotlin.runtime.telemetry.metrics.Meter] instances
3234
*/
35+
@ExperimentalApi
3336
public val meterProvider: MeterProvider
3437

3538
/**
3639
* Get the [LoggerProvider] used to create new [aws.smithy.kotlin.runtime.telemetry.logging.Logger] instances
3740
*/
41+
@ExperimentalApi
3842
public val loggerProvider: LoggerProvider
3943

4044
/**
4145
* Get the [ContextManager] used to get the current [Context]
4246
*/
47+
@ExperimentalApi
4348
public val contextManager: ContextManager
4449
}
4550

51+
@OptIn(ExperimentalApi::class)
4652
private object NoOpTelemetryProvider : TelemetryProvider {
4753
override val meterProvider: MeterProvider = MeterProvider.None
4854
override val tracerProvider: TracerProvider = TracerProvider.None

runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/CoroutineContextLogExt.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package aws.smithy.kotlin.runtime.telemetry.logging
77

8+
import aws.smithy.kotlin.runtime.ExperimentalApi
89
import aws.smithy.kotlin.runtime.InternalApi
910
import aws.smithy.kotlin.runtime.telemetry.context.Context
1011
import aws.smithy.kotlin.runtime.telemetry.context.telemetryContext
@@ -61,6 +62,7 @@ public suspend inline fun<R> withLogCtx(
6162
* @param content A lambda which provides the content of the message. This content does not need to include any data
6263
* from the exception (if any), which may be concatenated later based on probe behavior.
6364
*/
65+
@OptIn(ExperimentalApi::class)
6466
@InternalApi
6567
public fun CoroutineContext.log(
6668
level: LogLevel,
@@ -213,6 +215,7 @@ public inline fun <reified T> CoroutineContext.trace(ex: Throwable? = null, noin
213215
* Get a [Logger] instance using the current [LoggerProvider] configured in this [CoroutineContext]
214216
* @param sourceComponent The name of the component to create a logger for
215217
*/
218+
@OptIn(ExperimentalApi::class)
216219
@InternalApi
217220
public fun CoroutineContext.logger(sourceComponent: String): Logger {
218221
val logger = this.telemetryProvider.loggerProvider.getOrCreateLogger(sourceComponent)

runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/CoroutineContextTraceExt.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package aws.smithy.kotlin.runtime.telemetry.trace
77

8+
import aws.smithy.kotlin.runtime.ExperimentalApi
89
import aws.smithy.kotlin.runtime.InternalApi
910
import aws.smithy.kotlin.runtime.telemetry.TelemetryProviderContext
1011
import aws.smithy.kotlin.runtime.telemetry.context.TelemetryContextElement
@@ -59,6 +60,7 @@ public suspend inline fun <R> Tracer.withSpan(
5960
* Executes [block] within the scope of [TraceSpan]. The [block] of code is executed
6061
* with a new coroutine context that contains the [span] set in the context.
6162
*/
63+
@OptIn(ExperimentalApi::class)
6264
@InternalApi
6365
public suspend inline fun <R> withSpan(
6466
span: TraceSpan,
@@ -107,6 +109,7 @@ public suspend inline fun <reified T, R> withSpan(
107109
* within the scope of the new span. The [block] of code is executed with a new coroutine
108110
* context that contains the newly created span set.
109111
*/
112+
@OptIn(ExperimentalApi::class)
110113
@InternalApi
111114
public suspend inline fun <R> withSpan(
112115
sourceComponent: String,

runtime/observability/telemetry-defaults/common/src/aws/smithy/kotlin/runtime/telemetry/DefaultTelemetryProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package aws.smithy.kotlin.runtime.telemetry
77

8+
import aws.smithy.kotlin.runtime.ExperimentalApi
89
import aws.smithy.kotlin.runtime.telemetry.context.ContextManager
910
import aws.smithy.kotlin.runtime.telemetry.logging.DefaultLoggerProvider
1011
import aws.smithy.kotlin.runtime.telemetry.logging.LoggerProvider
@@ -15,6 +16,7 @@ import aws.smithy.kotlin.runtime.telemetry.trace.TracerProvider
1516
* A telemetry provider that uses the default logger for a platform if one exists (e.g. SLF4J on JVM) and
1617
* is a no-op for other telemetry signals.
1718
*/
19+
@OptIn(ExperimentalApi::class)
1820
public object DefaultTelemetryProvider : TelemetryProvider {
1921
override val loggerProvider: LoggerProvider = DefaultLoggerProvider
2022
override val tracerProvider: TracerProvider = TracerProvider.None

runtime/protocol/http-client-engines/http-client-engine-okhttp/jvm/src/aws/smithy/kotlin/runtime/http/engine/okhttp/HttpEngineEventListener.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.engine.okhttp
66

7+
import aws.smithy.kotlin.runtime.ExperimentalApi
78
import aws.smithy.kotlin.runtime.http.engine.internal.HttpClientMetrics
89
import aws.smithy.kotlin.runtime.net.HostResolver
910
import aws.smithy.kotlin.runtime.net.toHostAddress
@@ -29,7 +30,7 @@ import kotlin.time.TimeSource
2930
internal const val TELEMETRY_SCOPE = "aws.smithy.kotlin.runtime.http.engine.okhttp"
3031

3132
// see https://square.github.io/okhttp/features/events/#eventlistener for example callback flow
32-
@OptIn(ExperimentalTime::class)
33+
@OptIn(ExperimentalTime::class, ExperimentalApi::class)
3334
internal class HttpEngineEventListener(
3435
private val pool: ConnectionPool,
3536
private val hr: HostResolver,

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/engine/internal/HttpClientMetrics.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.engine.internal
66

7+
import aws.smithy.kotlin.runtime.ExperimentalApi
78
import aws.smithy.kotlin.runtime.InternalApi
89
import aws.smithy.kotlin.runtime.io.Closeable
910
import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
@@ -33,6 +34,7 @@ public object HttpClientMetricAttributes {
3334
* @param scope the instrumentation scope
3435
* @param provider the telemetry provider to instrument with
3536
*/
37+
@OptIn(ExperimentalApi::class)
3638
@InternalApi
3739
public class HttpClientMetrics(
3840
scope: String,

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/OperationTelemetryInterceptor.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.interceptors
66

7+
import aws.smithy.kotlin.runtime.ExperimentalApi
78
import aws.smithy.kotlin.runtime.client.ProtocolRequestInterceptorContext
89
import aws.smithy.kotlin.runtime.client.ProtocolResponseInterceptorContext
910
import aws.smithy.kotlin.runtime.client.RequestInterceptorContext
@@ -27,7 +28,7 @@ import kotlin.time.TimeSource
2728
* @param operation the name of the operation
2829
* @param timeSource the time source to use for measuring elapsed time
2930
*/
30-
@OptIn(ExperimentalTime::class)
31+
@OptIn(ExperimentalTime::class, ExperimentalApi::class)
3132
internal class OperationTelemetryInterceptor(
3233
private val metrics: OperationMetrics,
3334
private val service: String,

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationMetrics.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package aws.smithy.kotlin.runtime.http.operation
66

7+
import aws.smithy.kotlin.runtime.ExperimentalApi
78
import aws.smithy.kotlin.runtime.InternalApi
89
import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
910
import aws.smithy.kotlin.runtime.telemetry.metrics.DoubleHistogram
@@ -16,6 +17,7 @@ import aws.smithy.kotlin.runtime.telemetry.metrics.MonotonicCounter
1617
* @param scope the instrumentation scope
1718
* @param provider the telemetry provider to instrument with
1819
*/
20+
@OptIn(ExperimentalApi::class)
1921
@InternalApi
2022
public class OperationMetrics(
2123
scope: String,

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationTelemetry.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package aws.smithy.kotlin.runtime.http.operation
77

8+
import aws.smithy.kotlin.runtime.ExperimentalApi
89
import aws.smithy.kotlin.runtime.InternalApi
910
import aws.smithy.kotlin.runtime.client.*
1011
import aws.smithy.kotlin.runtime.http.interceptors.OperationTelemetryInterceptor
@@ -51,7 +52,7 @@ public inline fun<I, O> SdkHttpOperationBuilder<I, O>.telemetry(block: SdkOperat
5152
* @return the span for the operation and the additional coroutine context to execute the operation with containing
5253
* telemetry elements.
5354
*/
54-
@OptIn(ExperimentalTime::class)
55+
@OptIn(ExperimentalTime::class, ExperimentalApi::class)
5556
internal fun<I, O> SdkHttpOperation<I, O>.instrument(): Pair<TraceSpan, CoroutineContext> {
5657
val serviceName = checkNotNull(context.serviceName)
5758
val opName = checkNotNull(context.operationName)

0 commit comments

Comments
 (0)