@opentelemetry/api 1.2.0 → 1.3.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 +4 -4
- 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/baggage/internal/baggage-impl.js +41 -4
- package/build/esm/baggage/internal/baggage-impl.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 +97 -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 +1 -2
- 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 +3 -3
- package/build/esm/trace/NoopTracer.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.js +28 -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.js +2 -2
- 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/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 +97 -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 +1 -2
- 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 +34 -34
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+CH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","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\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/diag/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+CH;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAwBX;AAxBD,WAAY,YAAY;IACtB,uFAAuF;IACvF,+CAAQ,CAAA;IAER,mCAAmC;IACnC,kDAAU,CAAA;IAEV,oCAAoC;IACpC,gDAAS,CAAA;IAET,wCAAwC;IACxC,gDAAS,CAAA;IAET,gCAAgC;IAChC,kDAAU,CAAA;IAEV;;;OAGG;IACH,sDAAY,CAAA;IAEZ,2DAA2D;IAC3D,gDAAU,CAAA;AACZ,CAAC,EAxBW,YAAY,KAAZ,YAAY,QAwBvB","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\nexport type DiagLogFunction = (message: string, ...args: unknown[]) => void;\n\n/**\n * Defines an internal diagnostic logger interface which is used to log internal diagnostic\n * messages, you can set the default diagnostic logger via the {@link DiagAPI} setLogger function.\n * API provided implementations include :-\n * - a No-Op {@link createNoopDiagLogger}\n * - a {@link DiagLogLevel} filtering wrapper {@link createLogLevelDiagLogger}\n * - a general Console {@link DiagConsoleLogger} version.\n */\nexport interface DiagLogger {\n /** Log an error scenario that was not expected and caused the requested operation to fail. */\n error: DiagLogFunction;\n\n /**\n * Log a warning scenario to inform the developer of an issues that should be investigated.\n * The requested operation may or may not have succeeded or completed.\n */\n warn: DiagLogFunction;\n\n /**\n * Log a general informational message, this should not affect functionality.\n * This is also the default logging level so this should NOT be used for logging\n * debugging level information.\n */\n info: DiagLogFunction;\n\n /**\n * Log a general debug message that can be useful for identifying a failure.\n * Information logged at this level may include diagnostic details that would\n * help identify a failure scenario.\n * For example: Logging the order of execution of async operations.\n */\n debug: DiagLogFunction;\n\n /**\n * Log a detailed (verbose) trace level logging that can be used to identify failures\n * where debug level logging would be insufficient, this level of tracing can include\n * input and output parameters and as such may include PII information passing through\n * the API. As such it is recommended that this level of tracing should not be enabled\n * in a production environment.\n */\n verbose: DiagLogFunction;\n}\n\n/**\n * Defines the available internal logging levels for the diagnostic logger, the numeric values\n * of the levels are defined to match the original values from the initial LogLevel to avoid\n * compatibility/migration issues for any implementation that assume the numeric ordering.\n */\nexport enum DiagLogLevel {\n /** Diagnostic Logging level setting to disable all logging (except and forced logs) */\n NONE = 0,\n\n /** Identifies an error scenario */\n ERROR = 30,\n\n /** Identifies a warning scenario */\n WARN = 50,\n\n /** General informational log message */\n INFO = 60,\n\n /** General debug log message */\n DEBUG = 70,\n\n /**\n * Detailed trace level logging should only be used for development, should only be set\n * in a development environment.\n */\n VERBOSE = 80,\n\n /** Used to set the logging level to include all logging */\n ALL = 9999,\n}\n\n/**\n * Defines options for ComponentLogger\n */\nexport interface ComponentLoggerOptions {\n namespace: string;\n}\n\nexport interface LoggerOptions {\n /**\n * The {@link DiagLogLevel} used to filter logs sent to the logger.\n *\n * @defaultValue DiagLogLevel.INFO\n */\n logLevel?: DiagLogLevel;\n\n /**\n * Setting this value to `true` will suppress the warning message normally emitted when registering a logger when another logger is already registered.\n */\n suppressOverrideMessage?: boolean;\n}\n\nexport interface DiagLoggerApi {\n /**\n * Set the global DiagLogger and DiagLogLevel.\n * If a global diag logger is already set, this will override it.\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param options - A {@link LoggerOptions} object. If not provided, default values will be set.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, options?: LoggerOptions): boolean;\n\n /**\n *\n * @param logger - The {@link DiagLogger} instance to set as the default logger.\n * @param logLevel - The {@link DiagLogLevel} used to filter logs sent to the logger. If not provided it will default to {@link DiagLogLevel.INFO}.\n * @returns `true` if the logger was successfully registered, else `false`\n */\n setLogger(logger: DiagLogger, logLevel?: DiagLogLevel): boolean;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DiagAPI } from './api/diag';
|
|
2
|
+
/**
|
|
3
|
+
* Entrypoint for Diag API.
|
|
4
|
+
* Defines Diagnostic handler used for internal diagnostic logging operations.
|
|
5
|
+
* The default provides a Noop DiagLogger implementation which may be changed via the
|
|
6
|
+
* diag.setLogger(logger: DiagLogger) function.
|
|
7
|
+
*/
|
|
8
|
+
export declare const diag: DiagAPI;
|
|
9
|
+
//# sourceMappingURL=diag-api.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
// Split module-level variable definition into separate files to allow
|
|
17
|
+
// tree-shaking on each api instance.
|
|
18
|
+
import { DiagAPI } from './api/diag';
|
|
19
|
+
/**
|
|
20
|
+
* Entrypoint for Diag API.
|
|
21
|
+
* Defines Diagnostic handler used for internal diagnostic logging operations.
|
|
22
|
+
* The default provides a Noop DiagLogger implementation which may be changed via the
|
|
23
|
+
* diag.setLogger(logger: DiagLogger) function.
|
|
24
|
+
*/
|
|
25
|
+
export var diag = DiagAPI.instance();
|
|
26
|
+
//# sourceMappingURL=diag-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diag-api.js","sourceRoot":"","sources":["../../src/diag-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC;;;;;GAKG;AACH,MAAM,CAAC,IAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,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 { DiagAPI } from './api/diag';\n/**\n * Entrypoint for Diag API.\n * Defines Diagnostic handler used for internal diagnostic logging operations.\n * The default provides a Noop DiagLogger implementation which may be changed via the\n * diag.setLogger(logger: DiagLogger) function.\n */\nexport const diag = DiagAPI.instance();\n"]}
|
package/build/esm/index.d.ts
CHANGED
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { BaggageEntry, BaggageEntryMetadata, Baggage, } from './baggage/types';
|
|
2
2
|
export { baggageEntryMetadataFromString } from './baggage/utils';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
3
|
+
export { Exception } from './common/Exception';
|
|
4
|
+
export { HrTime, TimeInput } from './common/Time';
|
|
5
|
+
export { Attributes, AttributeValue } from './common/Attributes';
|
|
6
|
+
export { createContextKey, ROOT_CONTEXT, } from './context/context';
|
|
7
|
+
export { Context, ContextManager, } from './context/types';
|
|
8
|
+
export type { ContextAPI } from './api/context';
|
|
9
|
+
export { DiagConsoleLogger } from './diag/consoleLogger';
|
|
10
|
+
export { DiagLogFunction, DiagLogger, DiagLogLevel, ComponentLoggerOptions, } from './diag/types';
|
|
11
|
+
export type { DiagAPI } from './api/diag';
|
|
12
|
+
export { createNoopMeter, } from './metrics/NoopMeter';
|
|
13
|
+
export { MeterOptions, Meter, } from './metrics/Meter';
|
|
14
|
+
export { MeterProvider, } from './metrics/MeterProvider';
|
|
15
|
+
export { ValueType, Counter, Histogram, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, MetricAttributes, MetricAttributeValue, ObservableCallback, } from './metrics/Metric';
|
|
16
|
+
export { BatchObservableResult, ObservableResult, } from './metrics/ObservableResult';
|
|
17
|
+
export { TextMapPropagator, TextMapSetter, TextMapGetter, defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
|
|
18
|
+
export type { PropagationAPI } from './api/propagation';
|
|
19
|
+
export { SpanAttributes, SpanAttributeValue, } from './trace/attributes';
|
|
20
|
+
export { Link } from './trace/link';
|
|
21
|
+
export { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';
|
|
22
|
+
export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
|
|
23
|
+
export { Sampler } from './trace/Sampler';
|
|
24
|
+
export { SamplingDecision, SamplingResult } from './trace/SamplingResult';
|
|
25
|
+
export { SpanContext } from './trace/span_context';
|
|
26
|
+
export { SpanKind } from './trace/span_kind';
|
|
27
|
+
export { Span } from './trace/span';
|
|
28
|
+
export { SpanOptions } from './trace/SpanOptions';
|
|
29
|
+
export { SpanStatus, SpanStatusCode } from './trace/status';
|
|
30
|
+
export { TraceFlags } from './trace/trace_flags';
|
|
31
|
+
export { TraceState } from './trace/trace_state';
|
|
21
32
|
export { createTraceState } from './trace/internal/utils';
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
33
|
+
export { TracerProvider } from './trace/tracer_provider';
|
|
34
|
+
export { Tracer } from './trace/tracer';
|
|
35
|
+
export { TracerOptions } from './trace/tracer_options';
|
|
25
36
|
export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils';
|
|
26
37
|
export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants';
|
|
27
|
-
export * from './context/context';
|
|
28
|
-
export * from './context/types';
|
|
29
|
-
import { ContextAPI } from './api/context';
|
|
30
|
-
export type { ContextAPI } from './api/context';
|
|
31
|
-
/** Entrypoint for context API */
|
|
32
|
-
export declare const context: ContextAPI;
|
|
33
|
-
import { TraceAPI } from './api/trace';
|
|
34
38
|
export type { TraceAPI } from './api/trace';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
import { DiagAPI } from './api/diag';
|
|
42
|
-
export type { DiagAPI } from './api/diag';
|
|
43
|
-
/**
|
|
44
|
-
* Entrypoint for Diag API.
|
|
45
|
-
* Defines Diagnostic handler used for internal diagnostic logging operations.
|
|
46
|
-
* The default provides a Noop DiagLogger implementation which may be changed via the
|
|
47
|
-
* diag.setLogger(logger: DiagLogger) function.
|
|
48
|
-
*/
|
|
49
|
-
export declare const diag: DiagAPI;
|
|
39
|
+
import { context } from './context-api';
|
|
40
|
+
import { diag } from './diag-api';
|
|
41
|
+
import { metrics } from './metrics-api';
|
|
42
|
+
import { propagation } from './propagation-api';
|
|
43
|
+
import { trace } from './trace-api';
|
|
44
|
+
export { context, diag, metrics, propagation, trace, };
|
|
50
45
|
declare const _default: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
context: import("./api/context").ContextAPI;
|
|
47
|
+
diag: import("./api/diag").DiagAPI;
|
|
48
|
+
metrics: import("./api/metrics").MetricsAPI;
|
|
49
|
+
propagation: import("./api/propagation").PropagationAPI;
|
|
50
|
+
trace: import("./api/trace").TraceAPI;
|
|
55
51
|
};
|
|
56
52
|
export default _default;
|
|
57
53
|
//# sourceMappingURL=index.d.ts.map
|
package/build/esm/index.js
CHANGED
|
@@ -13,55 +13,41 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export * from './baggage/types';
|
|
17
16
|
export { baggageEntryMetadataFromString } from './baggage/utils';
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export * from './trace/trace_flags';
|
|
35
|
-
export * from './trace/trace_state';
|
|
17
|
+
// Context APIs
|
|
18
|
+
export { createContextKey, ROOT_CONTEXT, } from './context/context';
|
|
19
|
+
// Diag APIs
|
|
20
|
+
export { DiagConsoleLogger } from './diag/consoleLogger';
|
|
21
|
+
export { DiagLogLevel, } from './diag/types';
|
|
22
|
+
// Metrics APIs
|
|
23
|
+
export { createNoopMeter, } from './metrics/NoopMeter';
|
|
24
|
+
export { ValueType, } from './metrics/Metric';
|
|
25
|
+
// Propagation APIs
|
|
26
|
+
export { defaultTextMapGetter, defaultTextMapSetter, } from './propagation/TextMapPropagator';
|
|
27
|
+
export { ProxyTracer } from './trace/ProxyTracer';
|
|
28
|
+
export { ProxyTracerProvider } from './trace/ProxyTracerProvider';
|
|
29
|
+
export { SamplingDecision } from './trace/SamplingResult';
|
|
30
|
+
export { SpanKind } from './trace/span_kind';
|
|
31
|
+
export { SpanStatusCode } from './trace/status';
|
|
32
|
+
export { TraceFlags } from './trace/trace_flags';
|
|
36
33
|
export { createTraceState } from './trace/internal/utils';
|
|
37
|
-
export * from './trace/tracer_provider';
|
|
38
|
-
export * from './trace/tracer';
|
|
39
|
-
export * from './trace/tracer_options';
|
|
40
34
|
export { isSpanContextValid, isValidTraceId, isValidSpanId, } from './trace/spancontext-utils';
|
|
41
35
|
export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/invalid-span-constants';
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
import {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export var propagation = PropagationAPI.getInstance();
|
|
53
|
-
import { DiagAPI } from './api/diag';
|
|
54
|
-
/**
|
|
55
|
-
* Entrypoint for Diag API.
|
|
56
|
-
* Defines Diagnostic handler used for internal diagnostic logging operations.
|
|
57
|
-
* The default provides a Noop DiagLogger implementation which may be changed via the
|
|
58
|
-
* diag.setLogger(logger: DiagLogger) function.
|
|
59
|
-
*/
|
|
60
|
-
export var diag = DiagAPI.instance();
|
|
36
|
+
// Split module-level variable definition into separate files to allow
|
|
37
|
+
// tree-shaking on each api instance.
|
|
38
|
+
import { context } from './context-api';
|
|
39
|
+
import { diag } from './diag-api';
|
|
40
|
+
import { metrics } from './metrics-api';
|
|
41
|
+
import { propagation } from './propagation-api';
|
|
42
|
+
import { trace } from './trace-api';
|
|
43
|
+
// Named export.
|
|
44
|
+
export { context, diag, metrics, propagation, trace, };
|
|
45
|
+
// Default export.
|
|
61
46
|
export default {
|
|
62
|
-
trace: trace,
|
|
63
47
|
context: context,
|
|
64
|
-
propagation: propagation,
|
|
65
48
|
diag: diag,
|
|
49
|
+
metrics: metrics,
|
|
50
|
+
propagation: propagation,
|
|
51
|
+
trace: trace,
|
|
66
52
|
};
|
|
67
53
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAKjE,eAAe;AACf,OAAO,EACL,gBAAgB,EAChB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAO3B,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAGL,YAAY,GAEb,MAAM,cAAc,CAAC;AAGtB,eAAe;AACf,OAAO,EACL,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EACL,SAAS,GAaV,MAAM,kBAAkB,CAAC;AAM1B,mBAAmB;AACnB,OAAO,EAIL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AASzC,OAAO,EAAE,WAAW,EAAmB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAc,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAGxC,sEAAsE;AACtE,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,WAAW,EACX,KAAK,GACN,CAAC;AACF,kBAAkB;AAClB,eAAe;IACb,OAAO,SAAA;IACP,IAAI,MAAA;IACJ,OAAO,SAAA;IACP,WAAW,aAAA;IACX,KAAK,OAAA;CACN,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\nexport {\n BaggageEntry,\n BaggageEntryMetadata,\n Baggage,\n} from './baggage/types';\nexport { baggageEntryMetadataFromString } from './baggage/utils';\nexport { Exception } from './common/Exception';\nexport { HrTime, TimeInput } from './common/Time';\nexport { Attributes, AttributeValue } from './common/Attributes';\n\n// Context APIs\nexport {\n createContextKey,\n ROOT_CONTEXT,\n} from './context/context';\nexport {\n Context,\n ContextManager,\n} from './context/types';\nexport type { ContextAPI } from './api/context';\n\n// Diag APIs\nexport { DiagConsoleLogger } from './diag/consoleLogger';\nexport {\n DiagLogFunction,\n DiagLogger,\n DiagLogLevel,\n ComponentLoggerOptions,\n} from './diag/types';\nexport type { DiagAPI } from './api/diag';\n\n// Metrics APIs\nexport {\n createNoopMeter,\n} from './metrics/NoopMeter';\nexport {\n MeterOptions,\n Meter,\n} from './metrics/Meter';\nexport {\n MeterProvider,\n} from './metrics/MeterProvider';\nexport {\n ValueType,\n Counter,\n Histogram,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n BatchObservableCallback,\n MetricAttributes,\n MetricAttributeValue,\n ObservableCallback,\n} from './metrics/Metric';\nexport {\n BatchObservableResult,\n ObservableResult,\n} from './metrics/ObservableResult';\n\n// Propagation APIs\nexport {\n TextMapPropagator,\n TextMapSetter,\n TextMapGetter,\n defaultTextMapGetter,\n defaultTextMapSetter,\n} from './propagation/TextMapPropagator';\nexport type { PropagationAPI } from './api/propagation';\n\n// Trace APIs\nexport {\n SpanAttributes,\n SpanAttributeValue,\n} from './trace/attributes';\nexport { Link } from './trace/link';\nexport { ProxyTracer, TracerDelegator } from './trace/ProxyTracer';\nexport { ProxyTracerProvider } from './trace/ProxyTracerProvider';\nexport { Sampler } from './trace/Sampler';\nexport { SamplingDecision, SamplingResult } from './trace/SamplingResult';\nexport { SpanContext } from './trace/span_context';\nexport { SpanKind } from './trace/span_kind';\nexport { Span } from './trace/span';\nexport { SpanOptions } from './trace/SpanOptions';\nexport { SpanStatus, SpanStatusCode } from './trace/status';\nexport { TraceFlags } from './trace/trace_flags';\nexport { TraceState } from './trace/trace_state';\nexport { createTraceState } from './trace/internal/utils';\nexport { TracerProvider } from './trace/tracer_provider';\nexport { Tracer } from './trace/tracer';\nexport { TracerOptions } from './trace/tracer_options';\nexport {\n isSpanContextValid,\n isValidTraceId,\n isValidSpanId,\n} from './trace/spancontext-utils';\nexport {\n INVALID_SPANID,\n INVALID_TRACEID,\n INVALID_SPAN_CONTEXT,\n} from './trace/invalid-span-constants';\nexport type { TraceAPI } from './api/trace';\n\n// Split module-level variable definition into separate files to allow\n// tree-shaking on each api instance.\nimport { context } from './context-api';\nimport { diag } from './diag-api';\nimport { metrics } from './metrics-api';\nimport { propagation } from './propagation-api';\nimport { trace } from './trace-api';\n\n// Named export.\nexport {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n// Default export.\nexport default {\n context,\n diag,\n metrics,\n propagation,\n trace,\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { MeterProvider } from '../metrics/MeterProvider';
|
|
1
2
|
import { ContextManager } from '../context/types';
|
|
2
|
-
import { DiagLogger } from '../diag';
|
|
3
|
+
import { DiagLogger } from '../diag/types';
|
|
3
4
|
import { TextMapPropagator } from '../propagation/TextMapPropagator';
|
|
4
5
|
import type { TracerProvider } from '../trace/tracer_provider';
|
|
5
6
|
export declare function registerGlobal<Type extends keyof OTelGlobalAPI>(type: Type, instance: OTelGlobalAPI[Type], diag: DiagLogger, allowOverride?: boolean): boolean;
|
|
@@ -10,6 +11,7 @@ declare type OTelGlobalAPI = {
|
|
|
10
11
|
diag?: DiagLogger;
|
|
11
12
|
trace?: TracerProvider;
|
|
12
13
|
context?: ContextManager;
|
|
14
|
+
metrics?: MeterProvider;
|
|
13
15
|
propagation?: TextMapPropagator;
|
|
14
16
|
};
|
|
15
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"global-utils.js","sourceRoot":"","sources":["../../../src/internal/global-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,IAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAC7C,0BAAwB,KAAO,CAChC,CAAC;AAEF,IAAM,OAAO,GAAG,WAAyB,CAAC;AAE1C,MAAM,UAAU,cAAc,CAC5B,IAAU,EACV,QAA6B,EAC7B,IAAgB,EAChB,aAAqB;;IAArB,8BAAA,EAAA,qBAAqB;IAErB,IAAM,GAAG,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAA,OAAO,CAC1D,4BAA4B,CAC7B,mCAAI;QACH,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;QAC/B,yCAAyC;QACzC,IAAM,GAAG,GAAG,IAAI,KAAK,CACnB,kEAAgE,IAAM,CACvE,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE;QAC3B,0DAA0D;QAC1D,IAAM,GAAG,GAAG,IAAI,KAAK,CACnB,8DAA8D,CAC/D,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACrB,IAAI,CAAC,KAAK,CACR,iDAA+C,IAAI,UAAK,OAAO,MAAG,CACnE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,IAAU;;IAEV,IAAM,aAAa,GAAG,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAE,OAAO,CAAC;IACrE,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QAClD,OAAO;KACR;IACD,OAAO,MAAA,OAAO,CAAC,4BAA4B,CAAC,0CAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAyB,EAAE,IAAgB;IAC1E,IAAI,CAAC,KAAK,CACR,oDAAkD,IAAI,UAAK,OAAO,MAAG,CACtE,CAAC;IACF,IAAM,GAAG,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAElD,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;KAClB;AACH,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 { MeterProvider } from '../metrics/MeterProvider';\nimport { ContextManager } from '../context/types';\nimport { DiagLogger } from '../diag/types';\nimport { _globalThis } from '../platform';\nimport { TextMapPropagator } from '../propagation/TextMapPropagator';\nimport type { TracerProvider } from '../trace/tracer_provider';\nimport { VERSION } from '../version';\nimport { isCompatible } from './semver';\n\nconst major = VERSION.split('.')[0];\nconst GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(\n `opentelemetry.js.api.${major}`\n);\n\nconst _global = _globalThis as OTelGlobal;\n\nexport function registerGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type,\n instance: OTelGlobalAPI[Type],\n diag: DiagLogger,\n allowOverride = false\n): boolean {\n const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = _global[\n GLOBAL_OPENTELEMETRY_API_KEY\n ] ?? {\n version: VERSION,\n });\n\n if (!allowOverride && api[type]) {\n // already registered an API of this type\n const err = new Error(\n `@opentelemetry/api: Attempted duplicate registration of API: ${type}`\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n if (api.version !== VERSION) {\n // All registered APIs must be of the same version exactly\n const err = new Error(\n '@opentelemetry/api: All API registration versions must match'\n );\n diag.error(err.stack || err.message);\n return false;\n }\n\n api[type] = instance;\n diag.debug(\n `@opentelemetry/api: Registered a global for ${type} v${VERSION}.`\n );\n\n return true;\n}\n\nexport function getGlobal<Type extends keyof OTelGlobalAPI>(\n type: Type\n): OTelGlobalAPI[Type] | undefined {\n const globalVersion = _global[GLOBAL_OPENTELEMETRY_API_KEY]?.version;\n if (!globalVersion || !isCompatible(globalVersion)) {\n return;\n }\n return _global[GLOBAL_OPENTELEMETRY_API_KEY]?.[type];\n}\n\nexport function unregisterGlobal(type: keyof OTelGlobalAPI, diag: DiagLogger) {\n diag.debug(\n `@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`\n );\n const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];\n\n if (api) {\n delete api[type];\n }\n}\n\ntype OTelGlobal = {\n [GLOBAL_OPENTELEMETRY_API_KEY]?: OTelGlobalAPI;\n};\n\ntype OTelGlobalAPI = {\n version: string;\n\n diag?: DiagLogger;\n trace?: TracerProvider;\n context?: ContextManager;\n metrics?: MeterProvider;\n propagation?: TextMapPropagator;\n};\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BatchObservableCallback, Counter, Histogram, MetricAttributes, MetricOptions, Observable, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from './Metric';
|
|
2
|
+
/**
|
|
3
|
+
* An interface describes additional metadata of a meter.
|
|
4
|
+
*/
|
|
5
|
+
export interface MeterOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The schemaUrl of the meter or instrumentation library
|
|
8
|
+
*/
|
|
9
|
+
schemaUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An interface to allow the recording metrics.
|
|
13
|
+
*
|
|
14
|
+
* {@link Metric}s are used for recording pre-defined aggregation (`Counter`),
|
|
15
|
+
* or raw values (`Histogram`) in which the aggregation and attributes
|
|
16
|
+
* for the exported metric are deferred.
|
|
17
|
+
*/
|
|
18
|
+
export interface Meter {
|
|
19
|
+
/**
|
|
20
|
+
* Creates and returns a new `Histogram`.
|
|
21
|
+
* @param name the name of the metric.
|
|
22
|
+
* @param [options] the metric options.
|
|
23
|
+
*/
|
|
24
|
+
createHistogram<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): Histogram<AttributesTypes>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new `Counter` metric. Generally, this kind of metric when the
|
|
27
|
+
* value is a quantity, the sum is of primary interest, and the event count
|
|
28
|
+
* and value distribution are not of primary interest.
|
|
29
|
+
* @param name the name of the metric.
|
|
30
|
+
* @param [options] the metric options.
|
|
31
|
+
*/
|
|
32
|
+
createCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): Counter<AttributesTypes>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous
|
|
35
|
+
* instrument and very similar to Counter except that Add(increment)
|
|
36
|
+
* supports negative increments. It is generally useful for capturing changes
|
|
37
|
+
* in an amount of resources used, or any quantity that rises and falls
|
|
38
|
+
* during a request.
|
|
39
|
+
* Example uses for UpDownCounter:
|
|
40
|
+
* <ol>
|
|
41
|
+
* <li> count the number of active requests. </li>
|
|
42
|
+
* <li> count memory in use by instrumenting new and delete. </li>
|
|
43
|
+
* <li> count queue size by instrumenting enqueue and dequeue. </li>
|
|
44
|
+
* <li> count semaphore up and down operations. </li>
|
|
45
|
+
* </ol>
|
|
46
|
+
*
|
|
47
|
+
* @param name the name of the metric.
|
|
48
|
+
* @param [options] the metric options.
|
|
49
|
+
*/
|
|
50
|
+
createUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): UpDownCounter<AttributesTypes>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new `ObservableGauge` metric.
|
|
53
|
+
*
|
|
54
|
+
* The callback SHOULD be safe to be invoked concurrently.
|
|
55
|
+
*
|
|
56
|
+
* @param name the name of the metric.
|
|
57
|
+
* @param [options] the metric options.
|
|
58
|
+
*/
|
|
59
|
+
createObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableGauge<AttributesTypes>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new `ObservableCounter` metric.
|
|
62
|
+
*
|
|
63
|
+
* The callback SHOULD be safe to be invoked concurrently.
|
|
64
|
+
*
|
|
65
|
+
* @param name the name of the metric.
|
|
66
|
+
* @param [options] the metric options.
|
|
67
|
+
*/
|
|
68
|
+
createObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableCounter<AttributesTypes>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new `ObservableUpDownCounter` metric.
|
|
71
|
+
*
|
|
72
|
+
* The callback SHOULD be safe to be invoked concurrently.
|
|
73
|
+
*
|
|
74
|
+
* @param name the name of the metric.
|
|
75
|
+
* @param [options] the metric options.
|
|
76
|
+
*/
|
|
77
|
+
createObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableUpDownCounter<AttributesTypes>;
|
|
78
|
+
/**
|
|
79
|
+
* Sets up a function that will be called whenever a metric collection is
|
|
80
|
+
* initiated.
|
|
81
|
+
*
|
|
82
|
+
* If the function is already in the list of callbacks for this Observable,
|
|
83
|
+
* the function is not added a second time.
|
|
84
|
+
*
|
|
85
|
+
* Only the associated observables can be observed in the callback.
|
|
86
|
+
* Measurements of observables that are not associated observed in the
|
|
87
|
+
* callback are dropped.
|
|
88
|
+
*
|
|
89
|
+
* @param callback the batch observable callback
|
|
90
|
+
* @param observables the observables associated with this batch observable callback
|
|
91
|
+
*/
|
|
92
|
+
addBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(callback: BatchObservableCallback<AttributesTypes>, observables: Observable<AttributesTypes>[]): void;
|
|
93
|
+
/**
|
|
94
|
+
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
|
|
95
|
+
*
|
|
96
|
+
* The callback to be removed is identified using a combination of the callback itself,
|
|
97
|
+
* and the set of the observables associated with it.
|
|
98
|
+
*
|
|
99
|
+
* @param callback the batch observable callback
|
|
100
|
+
* @param observables the observables associated with this batch observable callback
|
|
101
|
+
*/
|
|
102
|
+
removeBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(callback: BatchObservableCallback<AttributesTypes>, observables: Observable<AttributesTypes>[]): void;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=Meter.d.ts.map
|
|
@@ -13,6 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Meter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Meter.js","sourceRoot":"","sources":["../../../src/metrics/Meter.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 {\n BatchObservableCallback,\n Counter,\n Histogram,\n MetricAttributes,\n MetricOptions,\n Observable,\n ObservableCounter,\n ObservableGauge,\n ObservableUpDownCounter,\n UpDownCounter,\n} from './Metric';\n\n/**\n * An interface describes additional metadata of a meter.\n */\nexport interface MeterOptions {\n /**\n * The schemaUrl of the meter or instrumentation library\n */\n schemaUrl?: string;\n}\n\n/**\n * An interface to allow the recording metrics.\n *\n * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),\n * or raw values (`Histogram`) in which the aggregation and attributes\n * for the exported metric are deferred.\n */\nexport interface Meter {\n /**\n * Creates and returns a new `Histogram`.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createHistogram<AttributesTypes extends MetricAttributes = MetricAttributes>(\n name: string,\n options?: MetricOptions\n ): Histogram<AttributesTypes>;\n\n /**\n * Creates a new `Counter` metric. Generally, this kind of metric when the\n * value is a quantity, the sum is of primary interest, and the event count\n * and value distribution are not of primary interest.\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(\n name: string,\n options?: MetricOptions\n ): Counter<AttributesTypes>;\n\n /**\n * Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous\n * instrument and very similar to Counter except that Add(increment)\n * supports negative increments. It is generally useful for capturing changes\n * in an amount of resources used, or any quantity that rises and falls\n * during a request.\n * Example uses for UpDownCounter:\n * <ol>\n * <li> count the number of active requests. </li>\n * <li> count memory in use by instrumenting new and delete. </li>\n * <li> count queue size by instrumenting enqueue and dequeue. </li>\n * <li> count semaphore up and down operations. </li>\n * </ol>\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): UpDownCounter<AttributesTypes>;\n\n /**\n * Creates a new `ObservableGauge` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(\n name: string,\n options?: MetricOptions\n ): ObservableGauge<AttributesTypes>;\n\n /**\n * Creates a new `ObservableCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(\n name: string,\n options?: MetricOptions\n ): ObservableCounter<AttributesTypes>;\n\n /**\n * Creates a new `ObservableUpDownCounter` metric.\n *\n * The callback SHOULD be safe to be invoked concurrently.\n *\n * @param name the name of the metric.\n * @param [options] the metric options.\n */\n createObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(\n name: string,\n options?: MetricOptions\n ): ObservableUpDownCounter<AttributesTypes>;\n\n /**\n * Sets up a function that will be called whenever a metric collection is\n * initiated.\n *\n * If the function is already in the list of callbacks for this Observable,\n * the function is not added a second time.\n *\n * Only the associated observables can be observed in the callback.\n * Measurements of observables that are not associated observed in the\n * callback are dropped.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n addBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(\n callback: BatchObservableCallback<AttributesTypes>,\n observables: Observable<AttributesTypes>[]\n ): void;\n\n /**\n * Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.\n *\n * The callback to be removed is identified using a combination of the callback itself,\n * and the set of the observables associated with it.\n *\n * @param callback the batch observable callback\n * @param observables the observables associated with this batch observable callback\n */\n removeBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(\n callback: BatchObservableCallback<AttributesTypes>,\n observables: Observable<AttributesTypes>[]\n ): void;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meter, MeterOptions } from './Meter';
|
|
2
|
+
/**
|
|
3
|
+
* A registry for creating named {@link Meter}s.
|
|
4
|
+
*/
|
|
5
|
+
export interface MeterProvider {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a Meter, creating one if one with the given name, version, and
|
|
8
|
+
* schemaUrl pair is not already created.
|
|
9
|
+
*
|
|
10
|
+
* @param name The name of the meter or instrumentation library.
|
|
11
|
+
* @param version The version of the meter or instrumentation library.
|
|
12
|
+
* @param options The options of the meter or instrumentation library.
|
|
13
|
+
* @returns Meter A Meter with the given name and version
|
|
14
|
+
*/
|
|
15
|
+
getMeter(name: string, version?: string, options?: MeterOptions): Meter;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=MeterProvider.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=MeterProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/MeterProvider.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 { Meter, MeterOptions } from './Meter';\n\n/**\n * A registry for creating named {@link Meter}s.\n */\nexport interface MeterProvider {\n /**\n * Returns a Meter, creating one if one with the given name, version, and\n * schemaUrl pair is not already created.\n *\n * @param name The name of the meter or instrumentation library.\n * @param version The version of the meter or instrumentation library.\n * @param options The options of the meter or instrumentation library.\n * @returns Meter A Meter with the given name and version\n */\n getMeter(name: string, version?: string, options?: MeterOptions): Meter;\n}\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
* Attributes is a map from string to attribute values.
|
|
64
|
+
*
|
|
65
|
+
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
66
|
+
*/
|
|
67
|
+
export declare type MetricAttributes = Attributes;
|
|
68
|
+
/**
|
|
69
|
+
* Attribute values may be any non-nullish primitive value except an object.
|
|
70
|
+
*
|
|
71
|
+
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
72
|
+
*/
|
|
73
|
+
export declare type MetricAttributeValue = AttributeValue;
|
|
74
|
+
/**
|
|
75
|
+
* The observable callback for Observable instruments.
|
|
76
|
+
*/
|
|
77
|
+
export declare type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: ObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* The observable callback for a batch of Observable instruments.
|
|
80
|
+
*/
|
|
81
|
+
export declare type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: BatchObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
82
|
+
export interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
83
|
+
/**
|
|
84
|
+
* Sets up a function that will be called whenever a metric collection is initiated.
|
|
85
|
+
*
|
|
86
|
+
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
|
|
87
|
+
*/
|
|
88
|
+
addCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
89
|
+
/**
|
|
90
|
+
* Removes a callback previously registered with {@link Observable.addCallback}.
|
|
91
|
+
*/
|
|
92
|
+
removeCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
93
|
+
}
|
|
94
|
+
export declare type ObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
95
|
+
export declare type ObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
96
|
+
export declare type ObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
97
|
+
//# sourceMappingURL=Metric.d.ts.map
|