CloudWatchMetricExporter

A MetricExporter that publishes metrics to CloudWatch. Requires the cloudwatch:PutMetricData permission.

CloudWatch bills per request and per custom metric, where a metric is a distinct name and dimension-value combination. Builder.maxCallsPerUpload bounds requests per cycle; the dimension allowlist and cardinality limit on AggregatingTelemetryProvider bound distinct metrics.

Construct one per provider. This exporter owns its CloudWatch client and closes it in shutdown, so a shared instance stops publishing for every provider but the first to close.

Types

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

Functions

Link copied to clipboard
open suspend override fun export(metrics: List<MetricData>)

Converts, batches, and publishes one collection cycle. Publish failures are logged, not thrown.

Link copied to clipboard
open suspend override fun shutdown()

Closes the client. Idempotent. Called by the reader after its final flush.