import { AggregationTemporality } from "./AggregationTemporality.cjs"; import { ExponentialHistogram, Histogram } from "../aggregator/types.cjs"; import { Attributes, HrTime, ValueType } from "@opentelemetry/api"; import { InstrumentationScope } from "@opentelemetry/core"; import { Resource } from "@opentelemetry/resources"; //#region src/export/MetricData.d.ts /** * Supported types of metric instruments. */ declare enum InstrumentType { COUNTER = "COUNTER", GAUGE = "GAUGE", HISTOGRAM = "HISTOGRAM", UP_DOWN_COUNTER = "UP_DOWN_COUNTER", OBSERVABLE_COUNTER = "OBSERVABLE_COUNTER", OBSERVABLE_GAUGE = "OBSERVABLE_GAUGE", OBSERVABLE_UP_DOWN_COUNTER = "OBSERVABLE_UP_DOWN_COUNTER" } interface MetricDescriptor { readonly name: string; readonly description: string; readonly unit: string; readonly valueType: ValueType; } /** * Basic metric data fields. */ interface BaseMetricData { readonly descriptor: MetricDescriptor; readonly aggregationTemporality: AggregationTemporality; /** * DataPointType of the metric instrument. */ readonly dataPointType: DataPointType; } /** * Represents a metric data aggregated by either a LastValueAggregation or * SumAggregation. */ interface SumMetricData extends BaseMetricData { readonly dataPointType: DataPointType.SUM; readonly dataPoints: DataPoint[]; readonly isMonotonic: boolean; } interface GaugeMetricData extends BaseMetricData { readonly dataPointType: DataPointType.GAUGE; readonly dataPoints: DataPoint[]; } /** * Represents a metric data aggregated by a HistogramAggregation. */ interface HistogramMetricData extends BaseMetricData { readonly dataPointType: DataPointType.HISTOGRAM; readonly dataPoints: DataPoint[]; } /** * Represents a metric data aggregated by a ExponentialHistogramAggregation. */ interface ExponentialHistogramMetricData extends BaseMetricData { readonly dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM; readonly dataPoints: DataPoint[]; } /** * Represents an aggregated metric data. */ type MetricData = SumMetricData | GaugeMetricData | HistogramMetricData | ExponentialHistogramMetricData; interface ScopeMetrics { scope: InstrumentationScope; metrics: MetricData[]; } interface ResourceMetrics { resource: Resource; scopeMetrics: ScopeMetrics[]; } /** * Represents the collection result of the metrics. If there are any * non-critical errors in the collection, like throwing in a single observable * callback, these errors are aggregated in the {@link CollectionResult.errors} * array and other successfully collected metrics are returned. */ interface CollectionResult { /** * Collected metrics. */ resourceMetrics: ResourceMetrics; /** * Arbitrary JavaScript exception values. */ errors: unknown[]; } /** * The aggregated point data type. */ declare enum DataPointType { /** * A histogram data point contains a histogram statistics of collected * values with a list of explicit bucket boundaries and statistics such * as min, max, count, and sum of all collected values. */ HISTOGRAM = 0, /** * An exponential histogram data point contains a histogram statistics of * collected values where bucket boundaries are automatically calculated * using an exponential function, and statistics such as min, max, count, * and sum of all collected values. */ EXPONENTIAL_HISTOGRAM = 1, /** * A gauge metric data point has only a single numeric value. */ GAUGE = 2, /** * A sum metric data point has a single numeric value and a * monotonicity-indicator. */ SUM = 3 } /** * Represents an aggregated point data with start time, end time and their * associated attributes and points. */ interface DataPoint { /** * The start epoch timestamp of the DataPoint, usually the time when * the metric was created when the preferred AggregationTemporality is * CUMULATIVE, or last collection time otherwise. */ readonly startTime: HrTime; /** * The end epoch timestamp when data were collected, usually it represents * the moment when `MetricReader.collect` was called. */ readonly endTime: HrTime; /** * The attributes associated with this DataPoint. */ readonly attributes: Attributes; /** * The value for this DataPoint. The type of the value is indicated by the * {@link DataPointType}. */ readonly value: T; } //#endregion export { CollectionResult, DataPoint, DataPointType, ExponentialHistogramMetricData, GaugeMetricData, HistogramMetricData, InstrumentType, MetricData, MetricDescriptor, ResourceMetrics, ScopeMetrics, SumMetricData }; //# sourceMappingURL=MetricData.d.cts.map