AggregatingTelemetryProvider

A TelemetryProvider that aggregates metrics in process and exports them periodically.

TelemetryProvider has no lifecycle member, so this type is additively Closeable.

Ownership follows creation, per the SDK-wide managed-resource convention: a provider the caller constructs is the caller's to close, which is what makes one provider safe to share across clients. A provider the SDK builds on the caller's behalf is wrapped for reference counting and closed by the last client using it.

Metrics only. tracerProvider and contextManager are None; claiming to provide tracing would silently discard spans. Other backends plug in at MetricExporter, or at MetricReader to also control when collection happens.

See also

manage
AggregatingTelemetryProvider {
exporter = CloudWatchMetricExporter { namespace = "MyApp" }
}.use { telemetry ->
S3Client { telemetryProvider = telemetry }.use { s3 -> /* ... */}
}

Types

Link copied to clipboard
class Builder
Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val contextManager: ContextManager
Link copied to clipboard
open override val loggerProvider: LoggerProvider
Link copied to clipboard
open override val meterProvider: MeterProvider
Link copied to clipboard
open override val tracerProvider: TracerProvider

Functions

Link copied to clipboard
open override fun close()

Final flush, then release. Idempotent; recording after close is a no-op rather than a throw.

Link copied to clipboard
suspend fun flush()

Collect and export now. Call this at the end of each AWS Lambda invocation - under FlushMode.OnDemand nothing is published until it is. Harmless in periodic mode.