Package-level declarations

Types

Link copied to clipboard

Aggregation temporality for sum metrics.

Link copied to clipboard
@Serializable
data class OtlpAnyValue(val stringValue: String? = null, val boolValue: Boolean? = null, val intValue: Long? = null, val doubleValue: Double? = null)

Polymorphic OTLP attribute value.

Link copied to clipboard
@Serializable
data class OtlpGauge(val dataPoints: List<OtlpNumberDataPoint>)

Gauge metric data points.

Link copied to clipboard
@Serializable
data class OtlpInstrumentationScope(val name: String, val version: String? = null, val attributes: List<OtlpKeyValue> = emptyList())

Describes the instrumentation scope (library) that produced the metrics.

Link copied to clipboard
@Serializable
data class OtlpKeyValue(val key: String, val value: OtlpAnyValue)

Key/value attribute as defined by OTLP.

Link copied to clipboard
@Serializable
data class OtlpMetric(val name: String, val description: String? = null, val unit: String? = null, val gauge: OtlpGauge? = null, val sum: OtlpSum? = null)

OTLP metric definition containing one data type (gauge or sum).

Link copied to clipboard
@Serializable
data class OtlpMetricsPayload(val resourceMetrics: List<OtlpResourceMetrics>)

Root OTLP metrics payload following the OpenTelemetry proto JSON mapping.

Link copied to clipboard
@Serializable
data class OtlpNumberDataPoint(val attributes: List<OtlpKeyValue> = emptyList(), val startTimeUnixNano: Long = 0, val timeUnixNano: Long = 0, val asDouble: Double? = null, val asInt: Long? = null)

Numeric data point used by gauge and sum types.

Link copied to clipboard
@Serializable
data class OtlpResource(val attributes: List<OtlpKeyValue> = emptyList())

OTLP resource description.

Link copied to clipboard
@Serializable
data class OtlpResourceMetrics(val resource: OtlpResource? = null, val scopeMetrics: List<OtlpScopeMetrics>)

Metrics attached to a single resource with their instrumentation scopes.

Link copied to clipboard
@Serializable
data class OtlpScopeMetrics(val scope: OtlpInstrumentationScope? = null, val metrics: List<OtlpMetric>)

Metrics produced by a single instrumentation scope.

Link copied to clipboard
@Serializable
data class OtlpSum(val dataPoints: List<OtlpNumberDataPoint>, val aggregationTemporality: AggregationTemporality, val isMonotonic: Boolean)

Sum metric payload.

Functions

Link copied to clipboard
fun OtlpJsonMetricsSink(delegate: Sink<String>, namespace: String = DEFAULT_NAMESPACE, scopeName: String = DEFAULT_SCOPE, resourceAttributes: Map<String, String> = emptyMap(), resourceAttributesProvider: (Meta) -> Map<String, String> = { resourceAttributes }, temporality: AggregationTemporality = AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE, fixedTimestamp: Instant? = null, surfaceVersion: MetricsSchemaVersion? = null, json: Json = DefaultJson): MetricsSink

Builds a sink that emits OTLP JSON (metrics) strings.

Link copied to clipboard
fun MetricsSnapshot.toOtlpPayload(namespace: String = DEFAULT_NAMESPACE, resourceAttributes: Map<String, String> = emptyMap(), resourceAttributesProvider: (Meta) -> Map<String, String> = { resourceAttributes }, scopeName: String = DEFAULT_SCOPE, temporality: AggregationTemporality = AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE, fixedTimestamp: Instant? = null, surfaceVersion: MetricsSchemaVersion? = null): OtlpMetricsPayload

Maps a MetricsSnapshot to an OTLP JSON payload ready for serialization.