{"version":3,"sources":["../../../src/metrics/Metric.ts"],"names":["ValueType"],"mappings":"8CAuEO,IAAKA,CAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,QAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA","file":"Metric.cjs","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Attributes, AttributeValue } from '../common/Attributes';\nimport type { Context } from '../context/types';\nimport type { BatchObservableResult, ObservableResult } from './ObservableResult';\n\n/**\n * Advisory options influencing aggregation configuration parameters.\n *\n * @since 1.7.0\n * @experimental\n */\nexport interface MetricAdvice {\n\t/**\n\t * Hint the explicit bucket boundaries for SDK if the metric is been\n\t * aggregated with a HistogramAggregator.\n\t */\n\texplicitBucketBoundaries?: number[];\n}\n\n/**\n * Options needed for metric creation\n *\n * @since 1.3.0\n */\nexport interface MetricOptions {\n\t/**\n\t * The description of the Metric.\n\t * @default ''\n\t */\n\tdescription?: string;\n\n\t/**\n\t * The unit of the Metric values.\n\t * @default ''\n\t */\n\tunit?: string;\n\n\t/**\n\t * Indicates the type of the recorded value.\n\t * @default {@link ValueType.DOUBLE}\n\t */\n\tvalueType?: ValueType;\n\n\t/**\n\t * The advice influencing aggregation configuration parameters.\n\t * @experimental\n\t * @since 1.7.0\n\t */\n\tadvice?: MetricAdvice;\n}\n\n/**\n * The Type of value. It describes how the data is reported.\n *\n * @since 1.3.0\n */\nexport enum ValueType {\n\tINT,\n\tDOUBLE,\n}\n\n/**\n * Counter is the most common synchronous instrument. This instrument supports\n * an `Add(increment)` function for reporting a sum, and is restricted to\n * non-negative increments. The default aggregation is Sum, as for any additive\n * instrument.\n *\n * Example uses for Counter:\n * <ol>\n *   <li> count the number of bytes received. </li>\n *   <li> count the number of requests completed. </li>\n *   <li> count the number of accounts created. </li>\n *   <li> count the number of checkpoints run. </li>\n *   <li> count the number of 5xx errors. </li>\n * <ol>\n *\n * @since 1.3.0\n */\nexport interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {\n\t/**\n\t * Increment value of counter by the input. Inputs must not be negative.\n\t */\n\tadd(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {\n\t/**\n\t * Increment value of counter by the input. Inputs may be negative.\n\t */\n\tadd(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.9.0\n */\nexport interface Gauge<AttributesTypes extends MetricAttributes = MetricAttributes> {\n\t/**\n\t * Records a measurement.\n\t */\n\trecord(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {\n\t/**\n\t * Records a measurement. Value of the measurement must not be negative.\n\t */\n\trecord(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n * @since 1.3.0\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n * @since 1.3.0\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * The observable callback for Observable instruments.\n *\n * @since 1.3.0\n */\nexport type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (\n\tobservableResult: ObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\n/**\n * The observable callback for a batch of Observable instruments.\n *\n * @since 1.3.0\n */\nexport type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (\n\tobservableResult: BatchObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\n/**\n * @since 1.3.0\n */\nexport interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {\n\t/**\n\t * Sets up a function that will be called whenever a metric collection is initiated.\n\t *\n\t * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n\t */\n\taddCallback(callback: ObservableCallback<AttributesTypes>): void;\n\n\t/**\n\t * Removes a callback previously registered with {@link Observable.addCallback}.\n\t */\n\tremoveCallback(callback: ObservableCallback<AttributesTypes>): void;\n}\n\n/**\n * @since 1.3.0\n */\nexport type ObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes> =\n\tObservable<AttributesTypes>;\n/**\n * @since 1.3.0\n */\nexport type ObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> =\n\tObservable<AttributesTypes>;\n/**\n * @since 1.3.0\n */\nexport type ObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;\n"]}