@opentelemetry/api 0.8.3 → 0.10.2

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.
Files changed (150) hide show
  1. package/README.md +3 -0
  2. package/build/src/api/context.d.ts +0 -15
  3. package/build/src/api/context.js +28 -24
  4. package/build/src/api/context.js.map +1 -0
  5. package/build/src/api/global-utils.d.ts +0 -15
  6. package/build/src/api/global-utils.js +7 -4
  7. package/build/src/api/global-utils.js.map +1 -0
  8. package/build/src/api/metrics.d.ts +0 -15
  9. package/build/src/api/metrics.js +22 -19
  10. package/build/src/api/metrics.js.map +1 -0
  11. package/build/src/api/propagation.d.ts +0 -15
  12. package/build/src/api/propagation.js +32 -25
  13. package/build/src/api/propagation.js.map +1 -0
  14. package/build/src/api/trace.d.ts +0 -15
  15. package/build/src/api/trace.js +22 -19
  16. package/build/src/api/trace.js.map +1 -0
  17. package/build/src/common/Logger.d.ts +0 -15
  18. package/build/src/common/Logger.js +2 -2
  19. package/build/src/common/Logger.js.map +1 -0
  20. package/build/src/common/Time.d.ts +0 -16
  21. package/build/src/common/Time.js +0 -15
  22. package/build/src/common/Time.js.map +1 -0
  23. package/build/src/context/propagation/HttpTextPropagator.d.ts +0 -15
  24. package/build/src/context/propagation/HttpTextPropagator.js +2 -2
  25. package/build/src/context/propagation/HttpTextPropagator.js.map +1 -0
  26. package/build/src/context/propagation/NoopHttpTextPropagator.d.ts +0 -15
  27. package/build/src/context/propagation/NoopHttpTextPropagator.js +11 -7
  28. package/build/src/context/propagation/NoopHttpTextPropagator.js.map +1 -0
  29. package/build/src/context/propagation/getter.d.ts +0 -15
  30. package/build/src/context/propagation/getter.js +3 -2
  31. package/build/src/context/propagation/getter.js.map +1 -0
  32. package/build/src/context/propagation/setter.d.ts +0 -15
  33. package/build/src/context/propagation/setter.js +3 -2
  34. package/build/src/context/propagation/setter.js.map +1 -0
  35. package/build/src/correlation_context/CorrelationContext.d.ts +0 -15
  36. package/build/src/correlation_context/CorrelationContext.js +2 -2
  37. package/build/src/correlation_context/CorrelationContext.js.map +1 -0
  38. package/build/src/correlation_context/EntryValue.d.ts +0 -19
  39. package/build/src/correlation_context/EntryValue.js +1 -15
  40. package/build/src/correlation_context/EntryValue.js.map +1 -0
  41. package/build/src/index.d.ts +3 -16
  42. package/build/src/index.js +55 -23
  43. package/build/src/index.js.map +1 -0
  44. package/build/src/metrics/BatchObserverResult.d.ts +15 -0
  45. package/build/src/metrics/{MetricObservable.js → BatchObserverResult.js} +3 -3
  46. package/build/src/metrics/BatchObserverResult.js.map +1 -0
  47. package/build/src/metrics/BoundInstrument.d.ts +10 -21
  48. package/build/src/metrics/BoundInstrument.js +2 -2
  49. package/build/src/metrics/BoundInstrument.js.map +1 -0
  50. package/build/src/metrics/Meter.d.ts +35 -21
  51. package/build/src/metrics/Meter.js +2 -2
  52. package/build/src/metrics/Meter.js.map +1 -0
  53. package/build/src/metrics/MeterProvider.d.ts +0 -15
  54. package/build/src/metrics/MeterProvider.js +2 -2
  55. package/build/src/metrics/MeterProvider.js.map +1 -0
  56. package/build/src/metrics/Metric.d.ts +33 -33
  57. package/build/src/metrics/Metric.js +3 -2
  58. package/build/src/metrics/Metric.js.map +1 -0
  59. package/build/src/metrics/NoopMeter.d.ts +39 -28
  60. package/build/src/metrics/NoopMeter.js +126 -47
  61. package/build/src/metrics/NoopMeter.js.map +1 -0
  62. package/build/src/metrics/NoopMeterProvider.d.ts +0 -15
  63. package/build/src/metrics/NoopMeterProvider.js +11 -7
  64. package/build/src/metrics/NoopMeterProvider.js.map +1 -0
  65. package/build/src/metrics/Observation.d.ts +9 -0
  66. package/build/src/metrics/Observation.js +18 -0
  67. package/build/src/metrics/Observation.js.map +1 -0
  68. package/build/src/metrics/ObserverResult.d.ts +2 -18
  69. package/build/src/metrics/ObserverResult.js +2 -2
  70. package/build/src/metrics/ObserverResult.js.map +1 -0
  71. package/build/src/platform/browser/globalThis.d.ts +0 -15
  72. package/build/src/platform/browser/globalThis.js +3 -2
  73. package/build/src/platform/browser/globalThis.js.map +1 -0
  74. package/build/src/platform/browser/index.d.ts +0 -15
  75. package/build/src/platform/browser/index.js +13 -6
  76. package/build/src/platform/browser/index.js.map +1 -0
  77. package/build/src/platform/index.d.ts +0 -15
  78. package/build/src/platform/index.js +13 -6
  79. package/build/src/platform/index.js.map +1 -0
  80. package/build/src/platform/node/globalThis.d.ts +0 -15
  81. package/build/src/platform/node/globalThis.js +3 -2
  82. package/build/src/platform/node/globalThis.js.map +1 -0
  83. package/build/src/platform/node/index.d.ts +0 -15
  84. package/build/src/platform/node/index.js +13 -6
  85. package/build/src/platform/node/index.js.map +1 -0
  86. package/build/src/trace/Event.d.ts +0 -15
  87. package/build/src/trace/Event.js +2 -2
  88. package/build/src/trace/Event.js.map +1 -0
  89. package/build/src/trace/NoopSpan.d.ts +0 -15
  90. package/build/src/trace/NoopSpan.js +25 -22
  91. package/build/src/trace/NoopSpan.js.map +1 -0
  92. package/build/src/trace/NoopTracer.d.ts +0 -15
  93. package/build/src/trace/NoopTracer.js +17 -13
  94. package/build/src/trace/NoopTracer.js.map +1 -0
  95. package/build/src/trace/NoopTracerProvider.d.ts +0 -15
  96. package/build/src/trace/NoopTracerProvider.js +11 -7
  97. package/build/src/trace/NoopTracerProvider.js.map +1 -0
  98. package/build/src/trace/Sampler.d.ts +15 -19
  99. package/build/src/trace/Sampler.js +2 -2
  100. package/build/src/trace/Sampler.js.map +1 -0
  101. package/build/src/trace/SamplingResult.d.ts +39 -0
  102. package/build/src/trace/SamplingResult.js +41 -0
  103. package/build/src/trace/SamplingResult.js.map +1 -0
  104. package/build/src/trace/SpanOptions.d.ts +0 -15
  105. package/build/src/trace/SpanOptions.js +2 -2
  106. package/build/src/trace/SpanOptions.js.map +1 -0
  107. package/build/src/trace/TimedEvent.d.ts +0 -15
  108. package/build/src/trace/TimedEvent.js +2 -2
  109. package/build/src/trace/TimedEvent.js.map +1 -0
  110. package/build/src/trace/attributes.d.ts +0 -19
  111. package/build/src/trace/attributes.js +0 -15
  112. package/build/src/trace/attributes.js.map +1 -0
  113. package/build/src/trace/instrumentation/Plugin.d.ts +0 -15
  114. package/build/src/trace/instrumentation/Plugin.js +2 -2
  115. package/build/src/trace/instrumentation/Plugin.js.map +1 -0
  116. package/build/src/trace/link.d.ts +0 -15
  117. package/build/src/trace/link.js +2 -2
  118. package/build/src/trace/link.js.map +1 -0
  119. package/build/src/trace/link_context.d.ts +0 -15
  120. package/build/src/trace/link_context.js +2 -2
  121. package/build/src/trace/link_context.js.map +1 -0
  122. package/build/src/trace/span.d.ts +0 -15
  123. package/build/src/trace/span.js +2 -2
  124. package/build/src/trace/span.js.map +1 -0
  125. package/build/src/trace/span_context.d.ts +0 -15
  126. package/build/src/trace/span_context.js +2 -2
  127. package/build/src/trace/span_context.js.map +1 -0
  128. package/build/src/trace/span_kind.d.ts +0 -19
  129. package/build/src/trace/span_kind.js +4 -7
  130. package/build/src/trace/span_kind.js.map +1 -0
  131. package/build/src/trace/status.d.ts +0 -19
  132. package/build/src/trace/status.js +1 -15
  133. package/build/src/trace/status.js.map +1 -0
  134. package/build/src/trace/trace_flags.d.ts +0 -20
  135. package/build/src/trace/trace_flags.js +4 -8
  136. package/build/src/trace/trace_flags.js.map +1 -0
  137. package/build/src/trace/trace_state.d.ts +0 -20
  138. package/build/src/trace/trace_state.js +0 -15
  139. package/build/src/trace/trace_state.js.map +1 -0
  140. package/build/src/trace/tracer.d.ts +1 -16
  141. package/build/src/trace/tracer.js +2 -2
  142. package/build/src/trace/tracer.js.map +1 -0
  143. package/build/src/trace/tracer_provider.d.ts +0 -15
  144. package/build/src/trace/tracer_provider.js +2 -2
  145. package/build/src/trace/tracer_provider.js.map +1 -0
  146. package/build/src/version.d.ts +1 -1
  147. package/build/src/version.js +3 -2
  148. package/build/src/version.js.map +1 -0
  149. package/package.json +24 -22
  150. package/build/src/metrics/MetricObservable.d.ts +0 -36
@@ -1,22 +1,7 @@
1
- /*!
2
- * Copyright 2019, 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
1
  import { CorrelationContext } from '../correlation_context/CorrelationContext';
17
2
  import { SpanContext } from '../trace/span_context';
18
- import { ObserverResult } from './ObserverResult';
19
- import { BoundCounter, BoundMeasure } from './BoundInstrument';
3
+ import { BoundBaseObserver, BoundCounter, BoundValueRecorder } from './BoundInstrument';
4
+ import { Logger } from '../common/Logger';
20
5
  /**
21
6
  * Options needed for metric creation
22
7
  */
@@ -33,8 +18,6 @@ export interface MetricOptions {
33
18
  * @default '1'
34
19
  */
35
20
  unit?: string;
36
- /** The list of label keys for the Metric. */
37
- labelKeys?: string[];
38
21
  /** The map of constant labels for the Metric. */
39
22
  constantLabels?: Map<string, string>;
40
23
  /**
@@ -42,10 +25,6 @@ export interface MetricOptions {
42
25
  * @default false
43
26
  */
44
27
  disabled?: boolean;
45
- /**
46
- * Asserts that this metric may only increase (e.g. time spent).
47
- */
48
- monotonic?: boolean;
49
28
  /**
50
29
  * (Measure only, default true) Asserts that this metric will only accept
51
30
  * non-negative values (e.g. disk usage).
@@ -56,6 +35,16 @@ export interface MetricOptions {
56
35
  * @default {@link ValueType.DOUBLE}
57
36
  */
58
37
  valueType?: ValueType;
38
+ /**
39
+ * User provided logger.
40
+ */
41
+ logger?: Logger;
42
+ }
43
+ export interface BatchMetricOptions extends MetricOptions {
44
+ /**
45
+ * Indicates how long the batch metric should wait to update before cancel
46
+ */
47
+ maxTimeoutUpdateMS?: number;
59
48
  }
60
49
  /** The Type of value. It describes how the data is reported. */
61
50
  export declare enum ValueType {
@@ -112,24 +101,35 @@ export interface Counter extends UnboundMetric<BoundCounter> {
112
101
  */
113
102
  add(value: number, labels?: Labels): void;
114
103
  }
115
- export interface Measure extends UnboundMetric<BoundMeasure> {
104
+ export interface UpDownCounter extends UnboundMetric<BoundCounter> {
105
+ /**
106
+ * Adds the given value to the current value. Values can be negative.
107
+ */
108
+ add(value: number, labels?: Labels): void;
109
+ }
110
+ export interface ValueRecorder extends UnboundMetric<BoundValueRecorder> {
116
111
  /**
117
- * Records the given value to this measure.
112
+ * Records the given value to this value recorder.
118
113
  */
119
114
  record(value: number, labels?: Labels): void;
120
115
  record(value: number, labels: Labels, correlationContext: CorrelationContext): void;
121
116
  record(value: number, labels: Labels, correlationContext: CorrelationContext, spanContext: SpanContext): void;
122
117
  }
123
118
  /** Base interface for the Observer metrics. */
124
- export interface Observer extends Metric {
125
- /**
126
- * Sets a callback where user can observe value for certain labels. The
127
- * observers are called periodically to retrieve the value.
128
- * @param callback a function that will be called once to set observers
129
- * for values
130
- */
131
- setCallback(callback: (observerResult: ObserverResult) => void): void;
119
+ export interface BaseObserver extends UnboundMetric<BoundBaseObserver> {
120
+ observation: (value: number) => {
121
+ value: number;
122
+ observer: BaseObserver;
123
+ };
132
124
  }
125
+ /** Base interface for the ValueObserver metrics. */
126
+ export declare type ValueObserver = BaseObserver;
127
+ /** Base interface for the UpDownSumObserver metrics. */
128
+ export declare type UpDownSumObserver = BaseObserver;
129
+ /** Base interface for the SumObserver metrics. */
130
+ export declare type SumObserver = BaseObserver;
131
+ /** Base interface for the Batch Observer metrics. */
132
+ export declare type BatchObserver = Metric;
133
133
  /**
134
134
  * key-value pairs passed by the user.
135
135
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /*!
3
- * Copyright 2019, OpenTelemetry Authors
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ValueType = void 0;
18
19
  /** The Type of value. It describes how the data is reported. */
19
20
  var ValueType;
20
21
  (function (ValueType) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAgEH,gEAAgE;AAChE,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
@@ -1,21 +1,7 @@
1
- /*!
2
- * Copyright 2019, 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
- */
1
+ import { BatchObserverResult } from './BatchObserverResult';
16
2
  import { Meter } from './Meter';
17
- import { MetricOptions, UnboundMetric, Labels, Counter, Measure, Observer } from './Metric';
18
- import { BoundMeasure, BoundCounter } from './BoundInstrument';
3
+ import { MetricOptions, UnboundMetric, Labels, Counter, ValueRecorder, ValueObserver, BatchObserver, UpDownCounter, BaseObserver } from './Metric';
4
+ import { BoundValueRecorder, BoundCounter, BoundBaseObserver } from './BoundInstrument';
19
5
  import { CorrelationContext } from '../correlation_context/CorrelationContext';
20
6
  import { SpanContext } from '../trace/span_context';
21
7
  import { ObserverResult } from './ObserverResult';
@@ -26,11 +12,11 @@ import { ObserverResult } from './ObserverResult';
26
12
  export declare class NoopMeter implements Meter {
27
13
  constructor();
28
14
  /**
29
- * Returns constant noop measure.
15
+ * Returns constant noop value recorder.
30
16
  * @param name the name of the metric.
31
17
  * @param [options] the metric options.
32
18
  */
33
- createMeasure(name: string, options?: MetricOptions): Measure;
19
+ createValueRecorder(name: string, options?: MetricOptions): ValueRecorder;
34
20
  /**
35
21
  * Returns a constant noop counter.
36
22
  * @param name the name of the metric.
@@ -38,11 +24,24 @@ export declare class NoopMeter implements Meter {
38
24
  */
39
25
  createCounter(name: string, options?: MetricOptions): Counter;
40
26
  /**
41
- * Returns constant noop observer.
27
+ * Returns a constant noop UpDownCounter.
28
+ * @param name the name of the metric.
29
+ * @param [options] the metric options.
30
+ */
31
+ createUpDownCounter(name: string, options?: MetricOptions): UpDownCounter;
32
+ /**
33
+ * Returns constant noop value observer.
42
34
  * @param name the name of the metric.
43
35
  * @param [options] the metric options.
36
+ * @param [callback] the value observer callback
44
37
  */
45
- createObserver(name: string, options?: MetricOptions): Observer;
38
+ createValueObserver(name: string, options?: MetricOptions, callback?: (observerResult: ObserverResult) => void): ValueObserver;
39
+ /**
40
+ * Returns constant noop batch observer.
41
+ * @param name the name of the metric.
42
+ * @param callback the batch observer callback
43
+ */
44
+ createBatchObserver(name: string, callback: (batchObserverResult: BatchObserverResult) => void): BatchObserver;
46
45
  }
47
46
  export declare class NoopMetric<T> implements UnboundMetric<T> {
48
47
  private readonly _instrument;
@@ -68,22 +67,34 @@ export declare class NoopMetric<T> implements UnboundMetric<T> {
68
67
  export declare class NoopCounterMetric extends NoopMetric<BoundCounter> implements Counter {
69
68
  add(value: number, labels: Labels): void;
70
69
  }
71
- export declare class NoopMeasureMetric extends NoopMetric<BoundMeasure> implements Measure {
70
+ export declare class NoopValueRecorderMetric extends NoopMetric<BoundValueRecorder> implements ValueRecorder {
72
71
  record(value: number, labels: Labels, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
73
72
  }
74
- export declare class NoopObserverMetric extends NoopMetric<void> implements Observer {
75
- setCallback(callback: (observerResult: ObserverResult) => void): void;
73
+ export declare class NoopBaseObserverMetric extends NoopMetric<BoundBaseObserver> implements BaseObserver {
74
+ observation(): {
75
+ observer: BaseObserver;
76
+ value: number;
77
+ };
78
+ }
79
+ export declare class NoopBatchObserverMetric extends NoopMetric<void> implements BatchObserver {
76
80
  }
77
81
  export declare class NoopBoundCounter implements BoundCounter {
78
82
  add(value: number): void;
79
83
  }
80
- export declare class NoopBoundMeasure implements BoundMeasure {
84
+ export declare class NoopBoundValueRecorder implements BoundValueRecorder {
81
85
  record(value: number, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
82
86
  }
87
+ export declare class NoopBoundBaseObserver implements BoundBaseObserver {
88
+ update(value: number): void;
89
+ }
83
90
  export declare const NOOP_METER: NoopMeter;
84
91
  export declare const NOOP_BOUND_COUNTER: NoopBoundCounter;
85
92
  export declare const NOOP_COUNTER_METRIC: NoopCounterMetric;
86
- export declare const NOOP_BOUND_MEASURE: NoopBoundMeasure;
87
- export declare const NOOP_MEASURE_METRIC: NoopMeasureMetric;
88
- export declare const NOOP_OBSERVER_METRIC: NoopObserverMetric;
93
+ export declare const NOOP_BOUND_VALUE_RECORDER: NoopBoundValueRecorder;
94
+ export declare const NOOP_VALUE_RECORDER_METRIC: NoopValueRecorderMetric;
95
+ export declare const NOOP_BOUND_BASE_OBSERVER: NoopBoundBaseObserver;
96
+ export declare const NOOP_VALUE_OBSERVER_METRIC: NoopBaseObserverMetric;
97
+ export declare const NOOP_UP_DOWN_SUM_OBSERVER_METRIC: NoopBaseObserverMetric;
98
+ export declare const NOOP_SUM_OBSERVER_METRIC: NoopBaseObserverMetric;
99
+ export declare const NOOP_BATCH_OBSERVER_METRIC: NoopBatchObserverMetric;
89
100
  //# sourceMappingURL=NoopMeter.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /*!
3
- * Copyright 2019, OpenTelemetry Authors
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -14,41 +14,74 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __extends = (this && this.__extends) || (function () {
18
+ var extendStatics = function (d, b) {
19
+ extendStatics = Object.setPrototypeOf ||
20
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22
+ return extendStatics(d, b);
23
+ };
24
+ return function (d, b) {
25
+ extendStatics(d, b);
26
+ function __() { this.constructor = d; }
27
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
+ };
29
+ })();
17
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.NOOP_BATCH_OBSERVER_METRIC = exports.NOOP_SUM_OBSERVER_METRIC = exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = exports.NOOP_VALUE_OBSERVER_METRIC = exports.NOOP_BOUND_BASE_OBSERVER = exports.NOOP_VALUE_RECORDER_METRIC = exports.NOOP_BOUND_VALUE_RECORDER = exports.NOOP_COUNTER_METRIC = exports.NOOP_BOUND_COUNTER = exports.NOOP_METER = exports.NoopBoundBaseObserver = exports.NoopBoundValueRecorder = exports.NoopBoundCounter = exports.NoopBatchObserverMetric = exports.NoopBaseObserverMetric = exports.NoopValueRecorderMetric = exports.NoopCounterMetric = exports.NoopMetric = exports.NoopMeter = void 0;
18
32
  /**
19
33
  * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
20
34
  * constant NoopMetrics for all of its methods.
21
35
  */
22
- class NoopMeter {
23
- constructor() { }
36
+ var NoopMeter = /** @class */ (function () {
37
+ function NoopMeter() {
38
+ }
24
39
  /**
25
- * Returns constant noop measure.
40
+ * Returns constant noop value recorder.
26
41
  * @param name the name of the metric.
27
42
  * @param [options] the metric options.
28
43
  */
29
- createMeasure(name, options) {
30
- return exports.NOOP_MEASURE_METRIC;
31
- }
44
+ NoopMeter.prototype.createValueRecorder = function (name, options) {
45
+ return exports.NOOP_VALUE_RECORDER_METRIC;
46
+ };
32
47
  /**
33
48
  * Returns a constant noop counter.
34
49
  * @param name the name of the metric.
35
50
  * @param [options] the metric options.
36
51
  */
37
- createCounter(name, options) {
52
+ NoopMeter.prototype.createCounter = function (name, options) {
38
53
  return exports.NOOP_COUNTER_METRIC;
39
- }
54
+ };
40
55
  /**
41
- * Returns constant noop observer.
56
+ * Returns a constant noop UpDownCounter.
42
57
  * @param name the name of the metric.
43
58
  * @param [options] the metric options.
44
59
  */
45
- createObserver(name, options) {
46
- return exports.NOOP_OBSERVER_METRIC;
47
- }
48
- }
60
+ NoopMeter.prototype.createUpDownCounter = function (name, options) {
61
+ return exports.NOOP_COUNTER_METRIC;
62
+ };
63
+ /**
64
+ * Returns constant noop value observer.
65
+ * @param name the name of the metric.
66
+ * @param [options] the metric options.
67
+ * @param [callback] the value observer callback
68
+ */
69
+ NoopMeter.prototype.createValueObserver = function (name, options, callback) {
70
+ return exports.NOOP_VALUE_OBSERVER_METRIC;
71
+ };
72
+ /**
73
+ * Returns constant noop batch observer.
74
+ * @param name the name of the metric.
75
+ * @param callback the batch observer callback
76
+ */
77
+ NoopMeter.prototype.createBatchObserver = function (name, callback) {
78
+ return exports.NOOP_BATCH_OBSERVER_METRIC;
79
+ };
80
+ return NoopMeter;
81
+ }());
49
82
  exports.NoopMeter = NoopMeter;
50
- class NoopMetric {
51
- constructor(instrument) {
83
+ var NoopMetric = /** @class */ (function () {
84
+ function NoopMetric(instrument) {
52
85
  this._instrument = instrument;
53
86
  }
54
87
  /**
@@ -58,32 +91,42 @@ class NoopMetric {
58
91
  * @param labels key-values pairs that are associated with a specific metric
59
92
  * that you want to record.
60
93
  */
61
- bind(labels) {
94
+ NoopMetric.prototype.bind = function (labels) {
62
95
  return this._instrument;
63
- }
96
+ };
64
97
  /**
65
98
  * Removes the Binding from the metric, if it is present.
66
99
  * @param labels key-values pairs that are associated with a specific metric.
67
100
  */
68
- unbind(labels) {
101
+ NoopMetric.prototype.unbind = function (labels) {
69
102
  return;
70
- }
103
+ };
71
104
  /**
72
105
  * Clears all timeseries from the Metric.
73
106
  */
74
- clear() {
107
+ NoopMetric.prototype.clear = function () {
75
108
  return;
76
- }
77
- }
109
+ };
110
+ return NoopMetric;
111
+ }());
78
112
  exports.NoopMetric = NoopMetric;
79
- class NoopCounterMetric extends NoopMetric {
80
- add(value, labels) {
81
- this.bind(labels).add(value);
113
+ var NoopCounterMetric = /** @class */ (function (_super) {
114
+ __extends(NoopCounterMetric, _super);
115
+ function NoopCounterMetric() {
116
+ return _super !== null && _super.apply(this, arguments) || this;
82
117
  }
83
- }
118
+ NoopCounterMetric.prototype.add = function (value, labels) {
119
+ this.bind(labels).add(value);
120
+ };
121
+ return NoopCounterMetric;
122
+ }(NoopMetric));
84
123
  exports.NoopCounterMetric = NoopCounterMetric;
85
- class NoopMeasureMetric extends NoopMetric {
86
- record(value, labels, correlationContext, spanContext) {
124
+ var NoopValueRecorderMetric = /** @class */ (function (_super) {
125
+ __extends(NoopValueRecorderMetric, _super);
126
+ function NoopValueRecorderMetric() {
127
+ return _super !== null && _super.apply(this, arguments) || this;
128
+ }
129
+ NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) {
87
130
  if (typeof correlationContext === 'undefined') {
88
131
  this.bind(labels).record(value);
89
132
  }
@@ -93,29 +136,65 @@ class NoopMeasureMetric extends NoopMetric {
93
136
  else {
94
137
  this.bind(labels).record(value, correlationContext, spanContext);
95
138
  }
139
+ };
140
+ return NoopValueRecorderMetric;
141
+ }(NoopMetric));
142
+ exports.NoopValueRecorderMetric = NoopValueRecorderMetric;
143
+ var NoopBaseObserverMetric = /** @class */ (function (_super) {
144
+ __extends(NoopBaseObserverMetric, _super);
145
+ function NoopBaseObserverMetric() {
146
+ return _super !== null && _super.apply(this, arguments) || this;
96
147
  }
97
- }
98
- exports.NoopMeasureMetric = NoopMeasureMetric;
99
- class NoopObserverMetric extends NoopMetric {
100
- setCallback(callback) { }
101
- }
102
- exports.NoopObserverMetric = NoopObserverMetric;
103
- class NoopBoundCounter {
104
- add(value) {
105
- return;
148
+ NoopBaseObserverMetric.prototype.observation = function () {
149
+ return {
150
+ observer: this,
151
+ value: 0,
152
+ };
153
+ };
154
+ return NoopBaseObserverMetric;
155
+ }(NoopMetric));
156
+ exports.NoopBaseObserverMetric = NoopBaseObserverMetric;
157
+ var NoopBatchObserverMetric = /** @class */ (function (_super) {
158
+ __extends(NoopBatchObserverMetric, _super);
159
+ function NoopBatchObserverMetric() {
160
+ return _super !== null && _super.apply(this, arguments) || this;
161
+ }
162
+ return NoopBatchObserverMetric;
163
+ }(NoopMetric));
164
+ exports.NoopBatchObserverMetric = NoopBatchObserverMetric;
165
+ var NoopBoundCounter = /** @class */ (function () {
166
+ function NoopBoundCounter() {
106
167
  }
107
- }
168
+ NoopBoundCounter.prototype.add = function (value) {
169
+ return;
170
+ };
171
+ return NoopBoundCounter;
172
+ }());
108
173
  exports.NoopBoundCounter = NoopBoundCounter;
109
- class NoopBoundMeasure {
110
- record(value, correlationContext, spanContext) {
174
+ var NoopBoundValueRecorder = /** @class */ (function () {
175
+ function NoopBoundValueRecorder() {
176
+ }
177
+ NoopBoundValueRecorder.prototype.record = function (value, correlationContext, spanContext) {
111
178
  return;
179
+ };
180
+ return NoopBoundValueRecorder;
181
+ }());
182
+ exports.NoopBoundValueRecorder = NoopBoundValueRecorder;
183
+ var NoopBoundBaseObserver = /** @class */ (function () {
184
+ function NoopBoundBaseObserver() {
112
185
  }
113
- }
114
- exports.NoopBoundMeasure = NoopBoundMeasure;
186
+ NoopBoundBaseObserver.prototype.update = function (value) { };
187
+ return NoopBoundBaseObserver;
188
+ }());
189
+ exports.NoopBoundBaseObserver = NoopBoundBaseObserver;
115
190
  exports.NOOP_METER = new NoopMeter();
116
191
  exports.NOOP_BOUND_COUNTER = new NoopBoundCounter();
117
192
  exports.NOOP_COUNTER_METRIC = new NoopCounterMetric(exports.NOOP_BOUND_COUNTER);
118
- exports.NOOP_BOUND_MEASURE = new NoopBoundMeasure();
119
- exports.NOOP_MEASURE_METRIC = new NoopMeasureMetric(exports.NOOP_BOUND_MEASURE);
120
- exports.NOOP_OBSERVER_METRIC = new NoopObserverMetric();
193
+ exports.NOOP_BOUND_VALUE_RECORDER = new NoopBoundValueRecorder();
194
+ exports.NOOP_VALUE_RECORDER_METRIC = new NoopValueRecorderMetric(exports.NOOP_BOUND_VALUE_RECORDER);
195
+ exports.NOOP_BOUND_BASE_OBSERVER = new NoopBoundBaseObserver();
196
+ exports.NOOP_VALUE_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER);
197
+ exports.NOOP_UP_DOWN_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER);
198
+ exports.NOOP_SUM_OBSERVER_METRIC = new NoopBaseObserverMetric(exports.NOOP_BOUND_BASE_OBSERVER);
199
+ exports.NOOP_BATCH_OBSERVER_METRIC = new NoopBatchObserverMetric();
121
200
  //# sourceMappingURL=NoopMeter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopMeter.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAwBH;;;GAGG;AACH;IACE;IAAe,CAAC;IAEhB;;;;OAIG;IACH,uCAAmB,GAAnB,UAAoB,IAAY,EAAE,OAAuB;QACvD,OAAO,kCAA0B,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,iCAAa,GAAb,UAAc,IAAY,EAAE,OAAuB;QACjD,OAAO,2BAAmB,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,uCAAmB,GAAnB,UAAoB,IAAY,EAAE,OAAuB;QACvD,OAAO,2BAAmB,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,uCAAmB,GAAnB,UACE,IAAY,EACZ,OAAuB,EACvB,QAAmD;QAEnD,OAAO,kCAA0B,CAAC;I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ACzB,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAI,sBAAsB,CACxE,gCAAwB,CACzB,CAAC;AAEW,QAAA,wBAAwB,GAAG,IAAI,sBAAsB,CAChE,gCAAwB,CACzB,CAAC;AAEW,QAAA,0BAA0B,GAAG,IAAI,uBAAuB,EAAE,CAAC"}
@@ -1,18 +1,3 @@
1
- /*!
2
- * Copyright 2019, 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
1
  import { Meter } from './Meter';
17
2
  import { MeterProvider } from './MeterProvider';
18
3
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /*!
3
- * Copyright 2019, OpenTelemetry Authors
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -15,16 +15,20 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const NoopMeter_1 = require("./NoopMeter");
18
+ exports.NOOP_METER_PROVIDER = exports.NoopMeterProvider = void 0;
19
+ var NoopMeter_1 = require("./NoopMeter");
19
20
  /**
20
21
  * An implementation of the {@link MeterProvider} which returns an impotent Meter
21
22
  * for all calls to `getMeter`
22
23
  */
23
- class NoopMeterProvider {
24
- getMeter(_name, _version) {
25
- return NoopMeter_1.NOOP_METER;
24
+ var NoopMeterProvider = /** @class */ (function () {
25
+ function NoopMeterProvider() {
26
26
  }
27
- }
27
+ NoopMeterProvider.prototype.getMeter = function (_name, _version) {
28
+ return NoopMeter_1.NOOP_METER;
29
+ };
30
+ return NoopMeterProvider;
31
+ }());
28
32
  exports.NoopMeterProvider = NoopMeterProvider;
29
33
  exports.NOOP_METER_PROVIDER = new NoopMeterProvider();
30
34
  //# sourceMappingURL=NoopMeterProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopMeterProvider.js","sourceRoot":"","sources":["../../../src/metrics/NoopMeterProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,yCAAyC;AAEzC;;;GAGG;AACH;IAAA;IAIA,CAAC;IAHC,oCAAQ,GAAR,UAAS,KAAc,EAAE,QAAiB;QACxC,OAAO,sBAAU,CAAC;IACpB,CAAC;IACH,wBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,8CAAiB;AAMjB,QAAA,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { BaseObserver } from './Metric';
2
+ /**
3
+ * Interface for updating value of certain value observer
4
+ */
5
+ export interface Observation {
6
+ observer: BaseObserver;
7
+ value: number;
8
+ }
9
+ //# sourceMappingURL=Observation.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=Observation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Observation.js","sourceRoot":"","sources":["../../../src/metrics/Observation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,24 +1,8 @@
1
- /*!
2
- * Copyright 2020, 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
1
  import { Labels } from './Metric';
17
- import { MetricObservable } from './MetricObservable';
18
2
  /**
19
- * Interface that is being used in function setCallback for Observer Metric
3
+ * Interface that is being used in callback function for Observer Metric
20
4
  */
21
5
  export interface ObserverResult {
22
- observe(callback: Function | MetricObservable, labels: Labels): void;
6
+ observe(value: number, labels: Labels): void;
23
7
  }
24
8
  //# sourceMappingURL=ObserverResult.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /*!
3
- * Copyright 2020, OpenTelemetry Authors
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObserverResult.js","sourceRoot":"","sources":["../../../src/metrics/ObserverResult.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,18 +1,3 @@
1
- /*!
2
- * Copyright 2020, 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
1
  /** only globals that common to node and browsers are allowed */
17
2
  export declare const _globalThis: typeof globalThis;
18
3
  //# sourceMappingURL=globalThis.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- /*!
3
- * Copyright 2020, OpenTelemetry Authors
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports._globalThis = void 0;
18
19
  /** only globals that common to node and browsers are allowed */
19
20
  // eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
20
21
  exports._globalThis = typeof globalThis === 'object' ? globalThis : window;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalThis.js","sourceRoot":"","sources":["../../../../src/platform/browser/globalThis.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,gEAAgE;AAChE,8EAA8E;AACjE,QAAA,WAAW,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC"}