@opentelemetry/api 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -35
- package/build/esm/api/context.js +25 -5
- package/build/esm/api/context.js.map +1 -1
- package/build/esm/api/diag.d.ts +3 -11
- package/build/esm/api/diag.js +38 -7
- package/build/esm/api/diag.js.map +1 -1
- package/build/esm/api/metrics.d.ts +28 -0
- package/build/esm/api/metrics.js +60 -0
- package/build/esm/api/metrics.js.map +1 -0
- package/build/esm/api/propagation.d.ts +2 -1
- package/build/esm/api/propagation.js +2 -1
- package/build/esm/api/propagation.js.map +1 -1
- package/build/esm/baggage/context-helpers.d.ts +6 -0
- package/build/esm/baggage/context-helpers.js +9 -0
- package/build/esm/baggage/context-helpers.js.map +1 -1
- package/build/esm/baggage/internal/baggage-impl.js +41 -4
- package/build/esm/baggage/internal/baggage-impl.js.map +1 -1
- package/build/esm/common/Attributes.js.map +1 -1
- package/build/esm/context/NoopContextManager.js +25 -5
- package/build/esm/context/NoopContextManager.js.map +1 -1
- package/build/esm/context-api.d.ts +4 -0
- package/build/esm/context-api.js +21 -0
- package/build/esm/context-api.js.map +1 -0
- package/build/esm/diag/ComponentLogger.js +26 -1
- package/build/esm/diag/ComponentLogger.js.map +1 -1
- package/build/esm/diag/types.d.ts +30 -0
- package/build/esm/diag/types.js.map +1 -1
- package/build/esm/diag-api.d.ts +9 -0
- package/build/esm/diag-api.js +26 -0
- package/build/esm/diag-api.js.map +1 -0
- package/build/esm/index.d.ts +44 -48
- package/build/esm/index.js +29 -43
- package/build/esm/index.js.map +1 -1
- package/build/esm/internal/global-utils.d.ts +3 -1
- package/build/esm/internal/global-utils.js.map +1 -1
- package/build/esm/metrics/Meter.d.ts +104 -0
- package/build/esm/{diag/index.js → metrics/Meter.js} +2 -3
- package/build/esm/metrics/Meter.js.map +1 -0
- package/build/esm/metrics/MeterProvider.d.ts +17 -0
- package/build/esm/metrics/MeterProvider.js +17 -0
- package/build/esm/metrics/MeterProvider.js.map +1 -0
- package/build/esm/metrics/Metric.d.ts +93 -0
- package/build/esm/metrics/Metric.js +22 -0
- package/build/esm/metrics/Metric.js.map +1 -0
- package/build/esm/metrics/NoopMeter.d.ts +74 -0
- package/build/esm/metrics/NoopMeter.js +165 -0
- package/build/esm/metrics/NoopMeter.js.map +1 -0
- package/build/esm/metrics/NoopMeterProvider.d.ts +11 -0
- package/build/esm/metrics/NoopMeterProvider.js +31 -0
- package/build/esm/metrics/NoopMeterProvider.js.map +1 -0
- package/build/esm/metrics/ObservableResult.d.ts +31 -0
- package/build/esm/metrics/ObservableResult.js +17 -0
- package/build/esm/metrics/ObservableResult.js.map +1 -0
- package/build/esm/metrics-api.d.ts +4 -0
- package/build/esm/metrics-api.js +21 -0
- package/build/esm/metrics-api.js.map +1 -0
- package/build/esm/platform/browser/globalThis.js +10 -7
- package/build/esm/platform/browser/globalThis.js.map +1 -1
- package/build/esm/propagation-api.d.ts +4 -0
- package/build/esm/propagation-api.js +21 -0
- package/build/esm/propagation-api.js.map +1 -0
- package/build/esm/trace/NoopTracer.js +4 -3
- package/build/esm/trace/NoopTracer.js.map +1 -1
- package/build/esm/trace/ProxyTracer.js.map +1 -1
- package/build/esm/trace/internal/utils.js.map +1 -1
- package/build/esm/trace-api.d.ts +4 -0
- package/build/esm/trace-api.js +21 -0
- package/build/esm/trace-api.js.map +1 -0
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/src/api/context.js +26 -38
- package/build/src/api/context.js.map +1 -1
- package/build/src/api/diag.d.ts +3 -11
- package/build/src/api/diag.js +33 -33
- package/build/src/api/diag.js.map +1 -1
- package/build/src/api/metrics.d.ts +28 -0
- package/build/src/api/metrics.js +61 -0
- package/build/src/api/metrics.js.map +1 -0
- package/build/src/api/propagation.d.ts +2 -1
- package/build/src/api/propagation.js +29 -31
- package/build/src/api/propagation.js.map +1 -1
- package/build/src/api/trace.js +22 -23
- package/build/src/api/trace.js.map +1 -1
- package/build/src/baggage/context-helpers.d.ts +6 -0
- package/build/src/baggage/context-helpers.js +13 -3
- package/build/src/baggage/context-helpers.js.map +1 -1
- package/build/src/baggage/internal/baggage-impl.js +21 -30
- package/build/src/baggage/internal/baggage-impl.js.map +1 -1
- package/build/src/baggage/utils.js +7 -8
- package/build/src/baggage/utils.js.map +1 -1
- package/build/src/common/Attributes.js.map +1 -1
- package/build/src/context/NoopContextManager.js +14 -26
- package/build/src/context/NoopContextManager.js.map +1 -1
- package/build/src/context/context.js +9 -10
- package/build/src/context/context.js.map +1 -1
- package/build/src/context-api.d.ts +4 -0
- package/build/src/{diag/index.js → context-api.js} +7 -13
- package/build/src/context-api.js.map +1 -0
- package/build/src/diag/ComponentLogger.js +16 -37
- package/build/src/diag/ComponentLogger.js.map +1 -1
- package/build/src/diag/consoleLogger.js +7 -12
- package/build/src/diag/consoleLogger.js.map +1 -1
- package/build/src/diag/internal/logLevelLogger.js +2 -2
- package/build/src/diag/internal/logLevelLogger.js.map +1 -1
- package/build/src/diag/types.d.ts +30 -0
- package/build/src/diag/types.js.map +1 -1
- package/build/src/diag-api.d.ts +9 -0
- package/build/src/diag-api.js +29 -0
- package/build/src/diag-api.js.map +1 -0
- package/build/src/index.d.ts +44 -48
- package/build/src/index.js +49 -56
- package/build/src/index.js.map +1 -1
- package/build/src/internal/global-utils.d.ts +3 -1
- package/build/src/internal/global-utils.js +15 -16
- package/build/src/internal/global-utils.js.map +1 -1
- package/build/src/internal/semver.js +9 -9
- package/build/src/internal/semver.js.map +1 -1
- package/build/src/metrics/Meter.d.ts +104 -0
- package/build/src/metrics/Meter.js +18 -0
- package/build/src/metrics/Meter.js.map +1 -0
- package/build/src/metrics/MeterProvider.d.ts +17 -0
- package/build/src/metrics/MeterProvider.js +18 -0
- package/build/src/metrics/MeterProvider.js.map +1 -0
- package/build/src/metrics/Metric.d.ts +93 -0
- package/build/src/metrics/Metric.js +25 -0
- package/build/src/metrics/Metric.js.map +1 -0
- package/build/src/metrics/NoopMeter.d.ts +74 -0
- package/build/src/metrics/NoopMeter.js +116 -0
- package/build/src/metrics/NoopMeter.js.map +1 -0
- package/build/src/metrics/NoopMeterProvider.d.ts +11 -0
- package/build/src/metrics/NoopMeterProvider.js +31 -0
- package/build/src/metrics/NoopMeterProvider.js.map +1 -0
- package/build/src/metrics/ObservableResult.d.ts +31 -0
- package/build/src/metrics/ObservableResult.js +18 -0
- package/build/src/metrics/ObservableResult.js.map +1 -0
- package/build/src/metrics-api.d.ts +4 -0
- package/build/src/metrics-api.js +24 -0
- package/build/src/metrics-api.js.map +1 -0
- package/build/src/platform/browser/globalThis.js +10 -7
- package/build/src/platform/browser/globalThis.js.map +1 -1
- package/build/src/propagation/NoopTextMapPropagator.js +7 -10
- package/build/src/propagation/NoopTextMapPropagator.js.map +1 -1
- package/build/src/propagation/TextMapPropagator.js +3 -3
- package/build/src/propagation/TextMapPropagator.js.map +1 -1
- package/build/src/propagation-api.d.ts +4 -0
- package/build/src/propagation-api.js +24 -0
- package/build/src/propagation-api.js.map +1 -0
- package/build/src/trace/NonRecordingSpan.js +20 -22
- package/build/src/trace/NonRecordingSpan.js.map +1 -1
- package/build/src/trace/NoopTracer.js +21 -24
- package/build/src/trace/NoopTracer.js.map +1 -1
- package/build/src/trace/NoopTracerProvider.js +5 -8
- package/build/src/trace/NoopTracerProvider.js.map +1 -1
- package/build/src/trace/ProxyTracer.js +13 -14
- package/build/src/trace/ProxyTracer.js.map +1 -1
- package/build/src/trace/ProxyTracerProvider.js +13 -16
- package/build/src/trace/ProxyTracerProvider.js.map +1 -1
- package/build/src/trace/context-utils.js +4 -4
- package/build/src/trace/context-utils.js.map +1 -1
- package/build/src/trace/internal/tracestate-impl.js +33 -35
- package/build/src/trace/internal/tracestate-impl.js.map +1 -1
- package/build/src/trace/internal/tracestate-validators.js +6 -6
- package/build/src/trace/internal/tracestate-validators.js.map +1 -1
- package/build/src/trace/internal/utils.js +1 -1
- package/build/src/trace/internal/utils.js.map +1 -1
- package/build/src/trace/invalid-span-constants.js +1 -1
- package/build/src/trace/invalid-span-constants.js.map +1 -1
- package/build/src/trace/spancontext-utils.js +4 -4
- package/build/src/trace/spancontext-utils.js.map +1 -1
- package/build/src/trace-api.d.ts +4 -0
- package/build/src/trace-api.js +24 -0
- package/build/src/{diag/index.js.map → trace-api.js.map} +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +36 -35
- package/CHANGELOG.md +0 -212
- package/build/esm/diag/index.d.ts +0 -3
- package/build/esm/diag/index.js.map +0 -1
- package/build/src/diag/index.d.ts +0 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Attributes, AttributeValue } from '../common/Attributes';
|
|
2
|
+
import { Context } from '../context/types';
|
|
3
|
+
import { BatchObservableResult, ObservableResult } from './ObservableResult';
|
|
4
|
+
/**
|
|
5
|
+
* Options needed for metric creation
|
|
6
|
+
*/
|
|
7
|
+
export interface MetricOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The description of the Metric.
|
|
10
|
+
* @default ''
|
|
11
|
+
*/
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The unit of the Metric values.
|
|
15
|
+
* @default ''
|
|
16
|
+
*/
|
|
17
|
+
unit?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates the type of the recorded value.
|
|
20
|
+
* @default {@link ValueType.DOUBLE}
|
|
21
|
+
*/
|
|
22
|
+
valueType?: ValueType;
|
|
23
|
+
}
|
|
24
|
+
/** The Type of value. It describes how the data is reported. */
|
|
25
|
+
export declare enum ValueType {
|
|
26
|
+
INT = 0,
|
|
27
|
+
DOUBLE = 1
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Counter is the most common synchronous instrument. This instrument supports
|
|
31
|
+
* an `Add(increment)` function for reporting a sum, and is restricted to
|
|
32
|
+
* non-negative increments. The default aggregation is Sum, as for any additive
|
|
33
|
+
* instrument.
|
|
34
|
+
*
|
|
35
|
+
* Example uses for Counter:
|
|
36
|
+
* <ol>
|
|
37
|
+
* <li> count the number of bytes received. </li>
|
|
38
|
+
* <li> count the number of requests completed. </li>
|
|
39
|
+
* <li> count the number of accounts created. </li>
|
|
40
|
+
* <li> count the number of checkpoints run. </li>
|
|
41
|
+
* <li> count the number of 5xx errors. </li>
|
|
42
|
+
* <ol>
|
|
43
|
+
*/
|
|
44
|
+
export interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
45
|
+
/**
|
|
46
|
+
* Increment value of counter by the input. Inputs must not be negative.
|
|
47
|
+
*/
|
|
48
|
+
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
49
|
+
}
|
|
50
|
+
export interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
51
|
+
/**
|
|
52
|
+
* Increment value of counter by the input. Inputs may be negative.
|
|
53
|
+
*/
|
|
54
|
+
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
55
|
+
}
|
|
56
|
+
export interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
57
|
+
/**
|
|
58
|
+
* Records a measurement. Value of the measurement must not be negative.
|
|
59
|
+
*/
|
|
60
|
+
record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated please use {@link Attributes}
|
|
64
|
+
*/
|
|
65
|
+
export declare type MetricAttributes = Attributes;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated please use {@link AttributeValue}
|
|
68
|
+
*/
|
|
69
|
+
export declare type MetricAttributeValue = AttributeValue;
|
|
70
|
+
/**
|
|
71
|
+
* The observable callback for Observable instruments.
|
|
72
|
+
*/
|
|
73
|
+
export declare type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: ObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* The observable callback for a batch of Observable instruments.
|
|
76
|
+
*/
|
|
77
|
+
export declare type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: BatchObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
78
|
+
export interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
79
|
+
/**
|
|
80
|
+
* Sets up a function that will be called whenever a metric collection is initiated.
|
|
81
|
+
*
|
|
82
|
+
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
|
|
83
|
+
*/
|
|
84
|
+
addCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
85
|
+
/**
|
|
86
|
+
* Removes a callback previously registered with {@link Observable.addCallback}.
|
|
87
|
+
*/
|
|
88
|
+
removeCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
89
|
+
}
|
|
90
|
+
export declare type ObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
91
|
+
export declare type ObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
92
|
+
export declare type ObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
93
|
+
//# sourceMappingURL=Metric.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ValueType = void 0;
|
|
19
|
+
/** The Type of value. It describes how the data is reported. */
|
|
20
|
+
var ValueType;
|
|
21
|
+
(function (ValueType) {
|
|
22
|
+
ValueType[ValueType["INT"] = 0] = "INT";
|
|
23
|
+
ValueType[ValueType["DOUBLE"] = 1] = "DOUBLE";
|
|
24
|
+
})(ValueType = exports.ValueType || (exports.ValueType = {}));
|
|
25
|
+
//# sourceMappingURL=Metric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AA6BH,gEAAgE;AAChE,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB","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 { Attributes, AttributeValue } from '../common/Attributes';\nimport { Context } from '../context/types';\nimport { BatchObservableResult, ObservableResult } from './ObservableResult';\n\n/**\n * Options needed for metric creation\n */\nexport interface MetricOptions {\n /**\n * The description of the Metric.\n * @default ''\n */\n description?: string;\n\n /**\n * The unit of the Metric values.\n * @default ''\n */\n unit?: string;\n\n /**\n * Indicates the type of the recorded value.\n * @default {@link ValueType.DOUBLE}\n */\n valueType?: ValueType;\n}\n\n/** The Type of value. It describes how the data is reported. */\nexport enum ValueType {\n INT,\n DOUBLE,\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 */\nexport interface Counter<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Increment value of counter by the input. Inputs must not be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface UpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Increment value of counter by the input. Inputs may be negative.\n */\n add(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\nexport interface Histogram<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Records a measurement. Value of the measurement must not be negative.\n */\n record(value: number, attributes?: AttributesTypes, context?: Context): void;\n}\n\n/**\n * @deprecated please use {@link Attributes}\n */\nexport type MetricAttributes = Attributes;\n\n/**\n * @deprecated please use {@link AttributeValue}\n */\nexport type MetricAttributeValue = AttributeValue;\n\n/**\n * The observable callback for Observable instruments.\n */\nexport type ObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> = (\n observableResult: ObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\n/**\n * The observable callback for a batch of Observable instruments.\n */\nexport type BatchObservableCallback<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> = (\n observableResult: BatchObservableResult<AttributesTypes>\n) => void | Promise<void>;\n\nexport interface Observable<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Sets up a function that will be called whenever a metric collection is initiated.\n *\n * If the function is already in the list of callbacks for this Observable, the function is not added a second time.\n */\n addCallback(callback: ObservableCallback<AttributesTypes>): void;\n\n /**\n * Removes a callback previously registered with {@link Observable.addCallback}.\n */\n removeCallback(callback: ObservableCallback<AttributesTypes>): void;\n}\n\nexport type ObservableCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> = Observable<AttributesTypes>;\nexport type ObservableUpDownCounter<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> = Observable<AttributesTypes>;\nexport type ObservableGauge<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> = Observable<AttributesTypes>;\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Meter } from './Meter';
|
|
2
|
+
import { BatchObservableCallback, Counter, Histogram, MetricOptions, ObservableCallback, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, MetricAttributes, Observable } from './Metric';
|
|
3
|
+
/**
|
|
4
|
+
* NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
|
|
5
|
+
* constant NoopMetrics for all of its methods.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NoopMeter implements Meter {
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* @see {@link Meter.createHistogram}
|
|
11
|
+
*/
|
|
12
|
+
createHistogram(_name: string, _options?: MetricOptions): Histogram;
|
|
13
|
+
/**
|
|
14
|
+
* @see {@link Meter.createCounter}
|
|
15
|
+
*/
|
|
16
|
+
createCounter(_name: string, _options?: MetricOptions): Counter;
|
|
17
|
+
/**
|
|
18
|
+
* @see {@link Meter.createUpDownCounter}
|
|
19
|
+
*/
|
|
20
|
+
createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter;
|
|
21
|
+
/**
|
|
22
|
+
* @see {@link Meter.createObservableGauge}
|
|
23
|
+
*/
|
|
24
|
+
createObservableGauge(_name: string, _options?: MetricOptions): ObservableGauge;
|
|
25
|
+
/**
|
|
26
|
+
* @see {@link Meter.createObservableCounter}
|
|
27
|
+
*/
|
|
28
|
+
createObservableCounter(_name: string, _options?: MetricOptions): ObservableCounter;
|
|
29
|
+
/**
|
|
30
|
+
* @see {@link Meter.createObservableUpDownCounter}
|
|
31
|
+
*/
|
|
32
|
+
createObservableUpDownCounter(_name: string, _options?: MetricOptions): ObservableUpDownCounter;
|
|
33
|
+
/**
|
|
34
|
+
* @see {@link Meter.addBatchObservableCallback}
|
|
35
|
+
*/
|
|
36
|
+
addBatchObservableCallback(_callback: BatchObservableCallback, _observables: Observable[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* @see {@link Meter.removeBatchObservableCallback}
|
|
39
|
+
*/
|
|
40
|
+
removeBatchObservableCallback(_callback: BatchObservableCallback): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class NoopMetric {
|
|
43
|
+
}
|
|
44
|
+
export declare class NoopCounterMetric extends NoopMetric implements Counter {
|
|
45
|
+
add(_value: number, _attributes: MetricAttributes): void;
|
|
46
|
+
}
|
|
47
|
+
export declare class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter {
|
|
48
|
+
add(_value: number, _attributes: MetricAttributes): void;
|
|
49
|
+
}
|
|
50
|
+
export declare class NoopHistogramMetric extends NoopMetric implements Histogram {
|
|
51
|
+
record(_value: number, _attributes: MetricAttributes): void;
|
|
52
|
+
}
|
|
53
|
+
export declare class NoopObservableMetric {
|
|
54
|
+
addCallback(_callback: ObservableCallback): void;
|
|
55
|
+
removeCallback(_callback: ObservableCallback): void;
|
|
56
|
+
}
|
|
57
|
+
export declare class NoopObservableCounterMetric extends NoopObservableMetric implements ObservableCounter {
|
|
58
|
+
}
|
|
59
|
+
export declare class NoopObservableGaugeMetric extends NoopObservableMetric implements ObservableGauge {
|
|
60
|
+
}
|
|
61
|
+
export declare class NoopObservableUpDownCounterMetric extends NoopObservableMetric implements ObservableUpDownCounter {
|
|
62
|
+
}
|
|
63
|
+
export declare const NOOP_METER: NoopMeter;
|
|
64
|
+
export declare const NOOP_COUNTER_METRIC: NoopCounterMetric;
|
|
65
|
+
export declare const NOOP_HISTOGRAM_METRIC: NoopHistogramMetric;
|
|
66
|
+
export declare const NOOP_UP_DOWN_COUNTER_METRIC: NoopUpDownCounterMetric;
|
|
67
|
+
export declare const NOOP_OBSERVABLE_COUNTER_METRIC: NoopObservableCounterMetric;
|
|
68
|
+
export declare const NOOP_OBSERVABLE_GAUGE_METRIC: NoopObservableGaugeMetric;
|
|
69
|
+
export declare const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC: NoopObservableUpDownCounterMetric;
|
|
70
|
+
/**
|
|
71
|
+
* Create a no-op Meter
|
|
72
|
+
*/
|
|
73
|
+
export declare function createNoopMeter(): Meter;
|
|
74
|
+
//# sourceMappingURL=NoopMeter.d.ts.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.createNoopMeter = exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = exports.NOOP_OBSERVABLE_GAUGE_METRIC = exports.NOOP_OBSERVABLE_COUNTER_METRIC = exports.NOOP_UP_DOWN_COUNTER_METRIC = exports.NOOP_HISTOGRAM_METRIC = exports.NOOP_COUNTER_METRIC = exports.NOOP_METER = exports.NoopObservableUpDownCounterMetric = exports.NoopObservableGaugeMetric = exports.NoopObservableCounterMetric = exports.NoopObservableMetric = exports.NoopHistogramMetric = exports.NoopUpDownCounterMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
|
|
21
|
+
* constant NoopMetrics for all of its methods.
|
|
22
|
+
*/
|
|
23
|
+
class NoopMeter {
|
|
24
|
+
constructor() { }
|
|
25
|
+
/**
|
|
26
|
+
* @see {@link Meter.createHistogram}
|
|
27
|
+
*/
|
|
28
|
+
createHistogram(_name, _options) {
|
|
29
|
+
return exports.NOOP_HISTOGRAM_METRIC;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @see {@link Meter.createCounter}
|
|
33
|
+
*/
|
|
34
|
+
createCounter(_name, _options) {
|
|
35
|
+
return exports.NOOP_COUNTER_METRIC;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @see {@link Meter.createUpDownCounter}
|
|
39
|
+
*/
|
|
40
|
+
createUpDownCounter(_name, _options) {
|
|
41
|
+
return exports.NOOP_UP_DOWN_COUNTER_METRIC;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @see {@link Meter.createObservableGauge}
|
|
45
|
+
*/
|
|
46
|
+
createObservableGauge(_name, _options) {
|
|
47
|
+
return exports.NOOP_OBSERVABLE_GAUGE_METRIC;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @see {@link Meter.createObservableCounter}
|
|
51
|
+
*/
|
|
52
|
+
createObservableCounter(_name, _options) {
|
|
53
|
+
return exports.NOOP_OBSERVABLE_COUNTER_METRIC;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @see {@link Meter.createObservableUpDownCounter}
|
|
57
|
+
*/
|
|
58
|
+
createObservableUpDownCounter(_name, _options) {
|
|
59
|
+
return exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @see {@link Meter.addBatchObservableCallback}
|
|
63
|
+
*/
|
|
64
|
+
addBatchObservableCallback(_callback, _observables) { }
|
|
65
|
+
/**
|
|
66
|
+
* @see {@link Meter.removeBatchObservableCallback}
|
|
67
|
+
*/
|
|
68
|
+
removeBatchObservableCallback(_callback) { }
|
|
69
|
+
}
|
|
70
|
+
exports.NoopMeter = NoopMeter;
|
|
71
|
+
class NoopMetric {
|
|
72
|
+
}
|
|
73
|
+
exports.NoopMetric = NoopMetric;
|
|
74
|
+
class NoopCounterMetric extends NoopMetric {
|
|
75
|
+
add(_value, _attributes) { }
|
|
76
|
+
}
|
|
77
|
+
exports.NoopCounterMetric = NoopCounterMetric;
|
|
78
|
+
class NoopUpDownCounterMetric extends NoopMetric {
|
|
79
|
+
add(_value, _attributes) { }
|
|
80
|
+
}
|
|
81
|
+
exports.NoopUpDownCounterMetric = NoopUpDownCounterMetric;
|
|
82
|
+
class NoopHistogramMetric extends NoopMetric {
|
|
83
|
+
record(_value, _attributes) { }
|
|
84
|
+
}
|
|
85
|
+
exports.NoopHistogramMetric = NoopHistogramMetric;
|
|
86
|
+
class NoopObservableMetric {
|
|
87
|
+
addCallback(_callback) { }
|
|
88
|
+
removeCallback(_callback) { }
|
|
89
|
+
}
|
|
90
|
+
exports.NoopObservableMetric = NoopObservableMetric;
|
|
91
|
+
class NoopObservableCounterMetric extends NoopObservableMetric {
|
|
92
|
+
}
|
|
93
|
+
exports.NoopObservableCounterMetric = NoopObservableCounterMetric;
|
|
94
|
+
class NoopObservableGaugeMetric extends NoopObservableMetric {
|
|
95
|
+
}
|
|
96
|
+
exports.NoopObservableGaugeMetric = NoopObservableGaugeMetric;
|
|
97
|
+
class NoopObservableUpDownCounterMetric extends NoopObservableMetric {
|
|
98
|
+
}
|
|
99
|
+
exports.NoopObservableUpDownCounterMetric = NoopObservableUpDownCounterMetric;
|
|
100
|
+
exports.NOOP_METER = new NoopMeter();
|
|
101
|
+
// Synchronous instruments
|
|
102
|
+
exports.NOOP_COUNTER_METRIC = new NoopCounterMetric();
|
|
103
|
+
exports.NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();
|
|
104
|
+
exports.NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
|
|
105
|
+
// Asynchronous instruments
|
|
106
|
+
exports.NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
|
|
107
|
+
exports.NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
|
|
108
|
+
exports.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
|
|
109
|
+
/**
|
|
110
|
+
* Create a no-op Meter
|
|
111
|
+
*/
|
|
112
|
+
function createNoopMeter() {
|
|
113
|
+
return exports.NOOP_METER;
|
|
114
|
+
}
|
|
115
|
+
exports.createNoopMeter = createNoopMeter;
|
|
116
|
+
//# sourceMappingURL=NoopMeter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoopMeter.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAiBH;;;GAGG;AACH,MAAa,SAAS;IACpB,gBAAe,CAAC;IAEhB;;OAEG;IACH,eAAe,CAAC,KAAa,EAAE,QAAwB;QACrD,OAAO,6BAAqB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,KAAa,EAAE,QAAwB;QACnD,OAAO,2BAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAa,EAAE,QAAwB;QACzD,OAAO,mCAA2B,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,qBAAqB,CACnB,KAAa,EACb,QAAwB;QAExB,OAAO,oCAA4B,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,uBAAuB,CACrB,KAAa,EACb,QAAwB;QAExB,OAAO,sCAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,6BAA6B,CAC3B,KAAa,EACb,QAAwB;QAExB,OAAO,8CAAsC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,SAAkC,EAClC,YAA0B,IACnB,CAAC;IAEV;;OAEG;IACH,6BAA6B,CAAC,SAAkC,IAAS,CAAC;CAC3E;AAlED,8BAkEC;AAED,MAAa,UAAU;CAAG;AAA1B,gCAA0B;AAE1B,MAAa,iBAAkB,SAAQ,UAAU;IAC/C,GAAG,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC5D;AAFD,8CAEC;AAED,MAAa,uBACX,SAAQ,UAAU;IAGlB,GAAG,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC5D;AALD,0DAKC;AAED,MAAa,mBAAoB,SAAQ,UAAU;IACjD,MAAM,CAAC,MAAc,EAAE,WAA6B,IAAS,CAAC;CAC/D;AAFD,kDAEC;AAED,MAAa,oBAAoB;IAC/B,WAAW,CAAC,SAA6B,IAAG,CAAC;IAE7C,cAAc,CAAC,SAA6B,IAAG,CAAC;CACjD;AAJD,oDAIC;AAED,MAAa,2BACX,SAAQ,oBAAoB;CACG;AAFjC,kEAEiC;AAEjC,MAAa,yBACX,SAAQ,oBAAoB;CACC;AAF/B,8DAE+B;AAE/B,MAAa,iCACX,SAAQ,oBAAoB;CACS;AAFvC,8EAEuC;AAE1B,QAAA,UAAU,GAAG,IAAI,SAAS,EAAE,CAAC;AAE1C,0BAA0B;AACb,QAAA,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC9C,QAAA,qBAAqB,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAClD,QAAA,2BAA2B,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAEzE,2BAA2B;AACd,QAAA,8BAA8B,GAAG,IAAI,2BAA2B,EAAE,CAAC;AACnE,QAAA,4BAA4B,GAAG,IAAI,yBAAyB,EAAE,CAAC;AAC/D,QAAA,sCAAsC,GACjD,IAAI,iCAAiC,EAAE,CAAC;AAE1C;;GAEG;AACH,SAAgB,eAAe;IAC7B,OAAO,kBAAU,CAAC;AACpB,CAAC;AAFD,0CAEC","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 { Meter } from './Meter';\nimport {\n BatchObservableCallback,\n Counter,\n Histogram,\n MetricOptions,\n ObservableCallback,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n MetricAttributes,\n Observable,\n} from './Metric';\n\n/**\n * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses\n * constant NoopMetrics for all of its methods.\n */\nexport class NoopMeter implements Meter {\n constructor() {}\n\n /**\n * @see {@link Meter.createHistogram}\n */\n createHistogram(_name: string, _options?: MetricOptions): Histogram {\n return NOOP_HISTOGRAM_METRIC;\n }\n\n /**\n * @see {@link Meter.createCounter}\n */\n createCounter(_name: string, _options?: MetricOptions): Counter {\n return NOOP_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createUpDownCounter}\n */\n createUpDownCounter(_name: string, _options?: MetricOptions): UpDownCounter {\n return NOOP_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableGauge}\n */\n createObservableGauge(\n _name: string,\n _options?: MetricOptions\n ): ObservableGauge {\n return NOOP_OBSERVABLE_GAUGE_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableCounter}\n */\n createObservableCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableCounter {\n return NOOP_OBSERVABLE_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.createObservableUpDownCounter}\n */\n createObservableUpDownCounter(\n _name: string,\n _options?: MetricOptions\n ): ObservableUpDownCounter {\n return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;\n }\n\n /**\n * @see {@link Meter.addBatchObservableCallback}\n */\n addBatchObservableCallback(\n _callback: BatchObservableCallback,\n _observables: Observable[]\n ): void {}\n\n /**\n * @see {@link Meter.removeBatchObservableCallback}\n */\n removeBatchObservableCallback(_callback: BatchObservableCallback): void {}\n}\n\nexport class NoopMetric {}\n\nexport class NoopCounterMetric extends NoopMetric implements Counter {\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopUpDownCounterMetric\n extends NoopMetric\n implements UpDownCounter\n{\n add(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopHistogramMetric extends NoopMetric implements Histogram {\n record(_value: number, _attributes: MetricAttributes): void {}\n}\n\nexport class NoopObservableMetric {\n addCallback(_callback: ObservableCallback) {}\n\n removeCallback(_callback: ObservableCallback) {}\n}\n\nexport class NoopObservableCounterMetric\n extends NoopObservableMetric\n implements ObservableCounter {}\n\nexport class NoopObservableGaugeMetric\n extends NoopObservableMetric\n implements ObservableGauge {}\n\nexport class NoopObservableUpDownCounterMetric\n extends NoopObservableMetric\n implements ObservableUpDownCounter {}\n\nexport const NOOP_METER = new NoopMeter();\n\n// Synchronous instruments\nexport const NOOP_COUNTER_METRIC = new NoopCounterMetric();\nexport const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();\nexport const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();\n\n// Asynchronous instruments\nexport const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();\nexport const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();\nexport const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC =\n new NoopObservableUpDownCounterMetric();\n\n/**\n * Create a no-op Meter\n */\nexport function createNoopMeter(): Meter {\n return NOOP_METER;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meter, MeterOptions } from './Meter';
|
|
2
|
+
import { MeterProvider } from './MeterProvider';
|
|
3
|
+
/**
|
|
4
|
+
* An implementation of the {@link MeterProvider} which returns an impotent Meter
|
|
5
|
+
* for all calls to `getMeter`
|
|
6
|
+
*/
|
|
7
|
+
export declare class NoopMeterProvider implements MeterProvider {
|
|
8
|
+
getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter;
|
|
9
|
+
}
|
|
10
|
+
export declare const NOOP_METER_PROVIDER: NoopMeterProvider;
|
|
11
|
+
//# sourceMappingURL=NoopMeterProvider.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0;
|
|
19
|
+
const NoopMeter_1 = require("./NoopMeter");
|
|
20
|
+
/**
|
|
21
|
+
* An implementation of the {@link MeterProvider} which returns an impotent Meter
|
|
22
|
+
* for all calls to `getMeter`
|
|
23
|
+
*/
|
|
24
|
+
class NoopMeterProvider {
|
|
25
|
+
getMeter(_name, _version, _options) {
|
|
26
|
+
return NoopMeter_1.NOOP_METER;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.NoopMeterProvider = NoopMeterProvider;
|
|
30
|
+
exports.NOOP_METER_PROVIDER = new NoopMeterProvider();
|
|
31
|
+
//# sourceMappingURL=NoopMeterProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoopMeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeterProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,2CAAyC;AAEzC;;;GAGG;AACH,MAAa,iBAAiB;IAC5B,QAAQ,CAAC,KAAa,EAAE,QAAiB,EAAE,QAAuB;QAChE,OAAO,sBAAU,CAAC;IACpB,CAAC;CACF;AAJD,8CAIC;AAEY,QAAA,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC","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 { Meter, MeterOptions } from './Meter';\nimport { MeterProvider } from './MeterProvider';\nimport { NOOP_METER } from './NoopMeter';\n\n/**\n * An implementation of the {@link MeterProvider} which returns an impotent Meter\n * for all calls to `getMeter`\n */\nexport class NoopMeterProvider implements MeterProvider {\n getMeter(_name: string, _version?: string, _options?: MeterOptions): Meter {\n return NOOP_METER;\n }\n}\n\nexport const NOOP_METER_PROVIDER = new NoopMeterProvider();\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MetricAttributes, Observable } from './Metric';
|
|
2
|
+
/**
|
|
3
|
+
* Interface that is being used in callback function for Observable Metric.
|
|
4
|
+
*/
|
|
5
|
+
export interface ObservableResult<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
6
|
+
/**
|
|
7
|
+
* Observe a measurement of the value associated with the given attributes.
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to be observed.
|
|
10
|
+
* @param attributes The attributes associated with the value. If more than
|
|
11
|
+
* one values associated with the same attributes values, SDK may pick the
|
|
12
|
+
* last one or simply drop the entire observable result.
|
|
13
|
+
*/
|
|
14
|
+
observe(this: ObservableResult<AttributesTypes>, value: number, attributes?: AttributesTypes): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface that is being used in batch observable callback function.
|
|
18
|
+
*/
|
|
19
|
+
export interface BatchObservableResult<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
20
|
+
/**
|
|
21
|
+
* Observe a measurement of the value associated with the given attributes.
|
|
22
|
+
*
|
|
23
|
+
* @param metric The observable metric to be observed.
|
|
24
|
+
* @param value The value to be observed.
|
|
25
|
+
* @param attributes The attributes associated with the value. If more than
|
|
26
|
+
* one values associated with the same attributes values, SDK may pick the
|
|
27
|
+
* last one or simply drop the entire observable result.
|
|
28
|
+
*/
|
|
29
|
+
observe(this: BatchObservableResult<AttributesTypes>, metric: Observable<AttributesTypes>, value: number, attributes?: AttributesTypes): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ObservableResult.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=ObservableResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservableResult.js","sourceRoot":"","sources":["../../../src/metrics/ObservableResult.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","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 { MetricAttributes, Observable } from './Metric';\n\n/**\n * Interface that is being used in callback function for Observable Metric.\n */\nexport interface ObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one values associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: ObservableResult<AttributesTypes>,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n\n/**\n * Interface that is being used in batch observable callback function.\n */\nexport interface BatchObservableResult<\n AttributesTypes extends MetricAttributes = MetricAttributes\n> {\n /**\n * Observe a measurement of the value associated with the given attributes.\n *\n * @param metric The observable metric to be observed.\n * @param value The value to be observed.\n * @param attributes The attributes associated with the value. If more than\n * one values associated with the same attributes values, SDK may pick the\n * last one or simply drop the entire observable result.\n */\n observe(\n this: BatchObservableResult<AttributesTypes>,\n metric: Observable<AttributesTypes>,\n value: number,\n attributes?: AttributesTypes\n ): void;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.metrics = void 0;
|
|
19
|
+
// Split module-level variable definition into separate files to allow
|
|
20
|
+
// tree-shaking on each api instance.
|
|
21
|
+
const metrics_1 = require("./api/metrics");
|
|
22
|
+
/** Entrypoint for metrics API */
|
|
23
|
+
exports.metrics = metrics_1.MetricsAPI.getInstance();
|
|
24
|
+
//# sourceMappingURL=metrics-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-api.js","sourceRoot":"","sources":["../../src/metrics-api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,2CAA2C;AAC3C,iCAAiC;AACpB,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC","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\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { MetricsAPI } from './api/metrics';\n/** Entrypoint for metrics API */\nexport const metrics = MetricsAPI.getInstance();\n"]}
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports._globalThis = void 0;
|
|
19
|
-
// Updates to this file should also be replicated to @opentelemetry/
|
|
20
|
-
// @opentelemetry/core too.
|
|
19
|
+
// Updates to this file should also be replicated to @opentelemetry/core too.
|
|
21
20
|
/**
|
|
22
21
|
* - globalThis (New standard)
|
|
23
22
|
* - self (Will return the current window instance for supported browsers)
|
|
@@ -27,9 +26,13 @@ exports._globalThis = void 0;
|
|
|
27
26
|
*/
|
|
28
27
|
/** only globals that common to node and browsers are allowed */
|
|
29
28
|
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
|
|
30
|
-
exports._globalThis = typeof globalThis === 'object'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
exports._globalThis = typeof globalThis === 'object'
|
|
30
|
+
? globalThis
|
|
31
|
+
: typeof self === 'object'
|
|
32
|
+
? self
|
|
33
|
+
: typeof window === 'object'
|
|
34
|
+
? window
|
|
35
|
+
: typeof global === 'object'
|
|
36
|
+
? global
|
|
37
|
+
: {};
|
|
35
38
|
//# sourceMappingURL=globalThis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6EAA6E;AAE7E;;;;;;GAMG;AAEH,gEAAgE;AAChE,8EAA8E;AACjE,QAAA,WAAW,GACtB,OAAO,UAAU,KAAK,QAAQ;IAC5B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;QAC1B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;YAC5B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBAC5B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAE,EAAwB,CAAC","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\n// Updates to this file should also be replicated to @opentelemetry/core too.\n\n/**\n * - globalThis (New standard)\n * - self (Will return the current window instance for supported browsers)\n * - window (fallback for older browser implementations)\n * - global (NodeJS implementation)\n * - <object> (When all else fails)\n */\n\n/** only globals that common to node and browsers are allowed */\n// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef\nexport const _globalThis: typeof globalThis =\n typeof globalThis === 'object'\n ? globalThis\n : typeof self === 'object'\n ? self\n : typeof window === 'object'\n ? window\n : typeof global === 'object'\n ? global\n : ({} as typeof globalThis);\n"]}
|
|
@@ -19,19 +19,16 @@ exports.NoopTextMapPropagator = void 0;
|
|
|
19
19
|
/**
|
|
20
20
|
* No-op implementations of {@link TextMapPropagator}.
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
function NoopTextMapPropagator() {
|
|
24
|
-
}
|
|
22
|
+
class NoopTextMapPropagator {
|
|
25
23
|
/** Noop inject function does nothing */
|
|
26
|
-
|
|
24
|
+
inject(_context, _carrier) { }
|
|
27
25
|
/** Noop extract function does nothing and returns the input context */
|
|
28
|
-
|
|
26
|
+
extract(context, _carrier) {
|
|
29
27
|
return context;
|
|
30
|
-
}
|
|
31
|
-
|
|
28
|
+
}
|
|
29
|
+
fields() {
|
|
32
30
|
return [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
36
33
|
exports.NoopTextMapPropagator = NoopTextMapPropagator;
|
|
37
34
|
//# sourceMappingURL=NoopTextMapPropagator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH;;GAEG;AACH,MAAa,qBAAqB;IAChC,wCAAwC;IACxC,MAAM,CAAC,QAAiB,EAAE,QAAiB,IAAS,CAAC;IACrD,uEAAuE;IACvE,OAAO,CAAC,OAAgB,EAAE,QAAiB;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM;QACJ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAVD,sDAUC","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 { Context } from '../context/types';\nimport { TextMapPropagator } from './TextMapPropagator';\n\n/**\n * No-op implementations of {@link TextMapPropagator}.\n */\nexport class NoopTextMapPropagator implements TextMapPropagator {\n /** Noop inject function does nothing */\n inject(_context: Context, _carrier: unknown): void {}\n /** Noop extract function does nothing and returns the input context */\n extract(context: Context, _carrier: unknown): Context {\n return context;\n }\n fields(): string[] {\n return [];\n }\n}\n"]}
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.defaultTextMapSetter = exports.defaultTextMapGetter = void 0;
|
|
19
19
|
exports.defaultTextMapGetter = {
|
|
20
|
-
get
|
|
20
|
+
get(carrier, key) {
|
|
21
21
|
if (carrier == null) {
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
24
|
return carrier[key];
|
|
25
25
|
},
|
|
26
|
-
keys
|
|
26
|
+
keys(carrier) {
|
|
27
27
|
if (carrier == null) {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ exports.defaultTextMapGetter = {
|
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
33
|
exports.defaultTextMapSetter = {
|
|
34
|
-
set
|
|
34
|
+
set(carrier, key, value) {
|
|
35
35
|
if (carrier == null) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/TextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAkGU,QAAA,oBAAoB,GAAkB;IACjD,GAAG,
|
|
1
|
+
{"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../src/propagation/TextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAkGU,QAAA,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG;QACd,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAO;QACV,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC;AAEW,QAAA,oBAAoB,GAAkB;IACjD,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK;QACrB,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO;SACR;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACvB,CAAC;CACF,CAAC","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 { Context } from '../context/types';\n\n/**\n * Injects `Context` into and extracts it from carriers that travel\n * in-band across process boundaries. Encoding is expected to conform to the\n * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request\n * headers.\n *\n * The carrier of propagated data on both the client (injector) and server\n * (extractor) side is usually an object such as http headers. Propagation is\n * usually implemented via library-specific request interceptors, where the\n * client-side injects values and the server-side extracts them.\n */\nexport interface TextMapPropagator<Carrier = any> {\n /**\n * Injects values from a given `Context` into a carrier.\n *\n * OpenTelemetry defines a common set of format values (TextMapPropagator),\n * and each has an expected `carrier` type.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param setter an optional {@link TextMapSetter}. If undefined, values will be\n * set by direct object assignment.\n */\n inject(\n context: Context,\n carrier: Carrier,\n setter: TextMapSetter<Carrier>\n ): void;\n\n /**\n * Given a `Context` and a carrier, extract context values from a\n * carrier and return a new context, created from the old context, with the\n * extracted values.\n *\n * @param context the Context from which to extract values to transmit over\n * the wire.\n * @param carrier the carrier of propagation fields, such as http request\n * headers.\n * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all\n * own properties, and keys will be accessed by direct object access.\n */\n extract(\n context: Context,\n carrier: Carrier,\n getter: TextMapGetter<Carrier>\n ): Context;\n\n /**\n * Return a list of all fields which may be used by the propagator.\n */\n fields(): string[];\n}\n\n/**\n * A setter is specified by the caller to define a specific method\n * to set key/value pairs on the carrier within a propagator.\n */\nexport interface TextMapSetter<Carrier = any> {\n /**\n * Callback used to set a key/value pair on an object.\n *\n * Should be called by the propagator each time a key/value pair\n * should be set, and should set that key/value pair on the propagator.\n *\n * @param carrier object or class which carries key/value pairs\n * @param key string key to modify\n * @param value value to be set to the key on the carrier\n */\n set(carrier: Carrier, key: string, value: string): void;\n}\n\n/**\n * A getter is specified by the caller to define a specific method\n * to get the value of a key from a carrier.\n */\nexport interface TextMapGetter<Carrier = any> {\n /**\n * Get a list of all keys available on the carrier.\n *\n * @param carrier\n */\n keys(carrier: Carrier): string[];\n\n /**\n * Get the value of a specific key from the carrier.\n *\n * @param carrier\n * @param key\n */\n get(carrier: Carrier, key: string): undefined | string | string[];\n}\n\nexport const defaultTextMapGetter: TextMapGetter = {\n get(carrier, key) {\n if (carrier == null) {\n return undefined;\n }\n return carrier[key];\n },\n\n keys(carrier) {\n if (carrier == null) {\n return [];\n }\n return Object.keys(carrier);\n },\n};\n\nexport const defaultTextMapSetter: TextMapSetter = {\n set(carrier, key, value) {\n if (carrier == null) {\n return;\n }\n\n carrier[key] = value;\n },\n};\n"]}
|