@opentelemetry/api 0.10.3-alpha.34 → 0.11.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.
Files changed (45) hide show
  1. package/build/src/api/global-utils.d.ts +2 -2
  2. package/build/src/api/propagation.d.ts +2 -2
  3. package/build/src/api/propagation.js +3 -3
  4. package/build/src/api/propagation.js.map +1 -1
  5. package/build/src/api/trace.d.ts +3 -0
  6. package/build/src/api/trace.js +8 -2
  7. package/build/src/api/trace.js.map +1 -1
  8. package/build/src/common/Exception.d.ts +26 -0
  9. package/build/src/common/Exception.js +18 -0
  10. package/build/src/common/Exception.js.map +1 -0
  11. package/build/src/context/propagation/NoopTextMapPropagator.d.ts +13 -0
  12. package/build/src/context/propagation/NoopTextMapPropagator.js +35 -0
  13. package/build/src/context/propagation/NoopTextMapPropagator.js.map +1 -0
  14. package/build/src/context/propagation/TextMapPropagator.d.ts +44 -0
  15. package/build/src/context/propagation/TextMapPropagator.js +18 -0
  16. package/build/src/context/propagation/TextMapPropagator.js.map +1 -0
  17. package/build/src/index.d.ts +6 -2
  18. package/build/src/index.js +9 -2
  19. package/build/src/index.js.map +1 -1
  20. package/build/src/metrics/BoundInstrument.d.ts +0 -8
  21. package/build/src/metrics/Metric.d.ts +0 -9
  22. package/build/src/metrics/Metric.js.map +1 -1
  23. package/build/src/metrics/MetricObservable.d.ts +18 -0
  24. package/build/src/metrics/MetricObservable.js +3 -0
  25. package/build/src/metrics/MetricObservable.js.map +1 -0
  26. package/build/src/metrics/NoopMeter.d.ts +1 -1
  27. package/build/src/metrics/NoopMeter.js +2 -10
  28. package/build/src/metrics/NoopMeter.js.map +1 -1
  29. package/build/src/trace/NoopSpan.d.ts +2 -2
  30. package/build/src/trace/NoopSpan.js +5 -10
  31. package/build/src/trace/NoopSpan.js.map +1 -1
  32. package/build/src/trace/ProxyTracer.d.ts +22 -0
  33. package/build/src/trace/ProxyTracer.js +59 -0
  34. package/build/src/trace/ProxyTracer.js.map +1 -0
  35. package/build/src/trace/ProxyTracerProvider.d.ts +24 -0
  36. package/build/src/trace/ProxyTracerProvider.js +56 -0
  37. package/build/src/trace/ProxyTracerProvider.js.map +1 -0
  38. package/build/src/trace/span.d.ts +8 -0
  39. package/build/src/trace/spancontext-utils.d.ts +12 -0
  40. package/build/src/trace/spancontext-utils.js +30 -0
  41. package/build/src/trace/spancontext-utils.js.map +1 -0
  42. package/build/src/version.d.ts +1 -1
  43. package/build/src/version.js +1 -1
  44. package/build/src/version.js.map +1 -1
  45. package/package.json +5 -3
@@ -1,5 +1,5 @@
1
1
  import { ContextManager } from '@opentelemetry/context-base';
2
- import { HttpTextPropagator } from '../context/propagation/HttpTextPropagator';
2
+ import { TextMapPropagator } from '../context/propagation/TextMapPropagator';
3
3
  import { MeterProvider } from '../metrics/MeterProvider';
4
4
  import { TracerProvider } from '../trace/tracer_provider';
5
5
  export declare const GLOBAL_CONTEXT_MANAGER_API_KEY: unique symbol;
@@ -10,7 +10,7 @@ declare type Get<T> = (version: number) => T;
10
10
  export declare const _global: Partial<{
11
11
  [GLOBAL_CONTEXT_MANAGER_API_KEY]: Get<ContextManager>;
12
12
  [GLOBAL_METRICS_API_KEY]: Get<MeterProvider>;
13
- [GLOBAL_PROPAGATION_API_KEY]: Get<HttpTextPropagator>;
13
+ [GLOBAL_PROPAGATION_API_KEY]: Get<TextMapPropagator>;
14
14
  [GLOBAL_TRACE_API_KEY]: Get<TracerProvider>;
15
15
  }>;
16
16
  /**
@@ -1,6 +1,6 @@
1
1
  import { Context } from '@opentelemetry/context-base';
2
2
  import { GetterFunction } from '../context/propagation/getter';
3
- import { HttpTextPropagator } from '../context/propagation/HttpTextPropagator';
3
+ import { TextMapPropagator } from '../context/propagation/TextMapPropagator';
4
4
  import { SetterFunction } from '../context/propagation/setter';
5
5
  /**
6
6
  * Singleton object which represents the entry point to the OpenTelemetry Propagation API
@@ -14,7 +14,7 @@ export declare class PropagationAPI {
14
14
  /**
15
15
  * Set the current propagator. Returns the initialized propagator
16
16
  */
17
- setGlobalPropagator(propagator: HttpTextPropagator): HttpTextPropagator;
17
+ setGlobalPropagator(propagator: TextMapPropagator): TextMapPropagator;
18
18
  /**
19
19
  * Inject context into a carrier to be propagated inter-process
20
20
  *
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PropagationAPI = void 0;
19
19
  var getter_1 = require("../context/propagation/getter");
20
- var NoopHttpTextPropagator_1 = require("../context/propagation/NoopHttpTextPropagator");
20
+ var NoopTextMapPropagator_1 = require("../context/propagation/NoopTextMapPropagator");
21
21
  var setter_1 = require("../context/propagation/setter");
22
22
  var context_1 = require("./context");
23
23
  var global_utils_1 = require("./global-utils");
@@ -44,7 +44,7 @@ var PropagationAPI = /** @class */ (function () {
44
44
  // global propagator has already been set
45
45
  return this._getGlobalPropagator();
46
46
  }
47
- global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR);
47
+ global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, propagator, NoopTextMapPropagator_1.NOOP_TEXT_MAP_PROPAGATOR);
48
48
  return propagator;
49
49
  };
50
50
  /**
@@ -77,7 +77,7 @@ var PropagationAPI = /** @class */ (function () {
77
77
  };
78
78
  PropagationAPI.prototype._getGlobalPropagator = function () {
79
79
  var _a, _b;
80
- return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopHttpTextPropagator_1.NOOP_HTTP_TEXT_PROPAGATOR);
80
+ return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_PROPAGATION_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTextMapPropagator_1.NOOP_TEXT_MAP_PROPAGATOR);
81
81
  };
82
82
  return PropagationAPI;
83
83
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../src/api/propagation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,wDAA8E;AAE9E,wFAA0F;AAC1F,wDAA8E;AAC9E,qCAAuC;AACvC,+CAKwB;AAExB,IAAM,UAAU,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC;AAE5C;;GAEG;AACH;IAGE,+FAA+F;IAC/F;IAAuB,CAAC;IAExB,uDAAuD;IACzC,0BAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,4CAAmB,GAA1B,UACE,UAA8B;QAE9B,IAAI,sBAAO,CAAC,yCAA0B,CAAC,EAAE;YACvC,yCAAyC;YACzC,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;SACpC;QAED,sBAAO,CAAC,yCAA0B,CAAC,GAAG,yBAAU,CAC9C,kDAAmC,EACnC,UAAU,EACV,kDAAyB,CAC1B,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACI,+BAAM,GAAb,UACE,OAAgB,EAChB,MAA+C,EAC/C,OAA6B;QAD7B,uBAAA,EAAA,SAAkC,sBAAa;QAC/C,wBAAA,EAAA,UAAU,UAAU,CAAC,MAAM,EAAE;QAE7B,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM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CAAC,GAAG,yBAAU,CAC9C,kDAAmC,EACnC,UAAU,EACV,gDAAwB,CACzB,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACI,+BAAM,GAAb,UACE,OAAgB,EAChB,MAA+C,EAC/C,OAA6B;QAD7B,uBAAA,EAAA,SAAkC,sBAAa;QAC/C,wBAAA,EAAA,UAAU,UAAU,CAAC,MAAM,EAAE;QAE7B,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,gCAAO,GAAd,UACE,OAAgB,EAChB,MAA+C,EAC/C,OAA6B;QAD7B,uBAAA,EAAA,SAAkC,sBAAa;QAC/C,wBAAA,EAAA,UAAU,UAAU,CAAC,MAAM,EAAE;QAE7B,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED,mCAAmC;IAC5B,gCAAO,GAAd;QACE,OAAO,sBAAO,CAAC,yCAA0B,CAAC,CAAC;IAC7C,CAAC;IAEO,6CAAoB,GAA5B;;QACE,OAAO,aACL,sBAAO,CAAC,yCAA0B,CAAC,+CAAnC,sBAAO,EACL,kDAAmC,oCAChC,gDAAwB,CAC9B,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA3ED,IA2EC;AA3EY,wCAAc"}
@@ -1,10 +1,12 @@
1
1
  import { Tracer } from '../trace/tracer';
2
2
  import { TracerProvider } from '../trace/tracer_provider';
3
+ import { isSpanContextValid } from '../trace/spancontext-utils';
3
4
  /**
4
5
  * Singleton object which represents the entry point to the OpenTelemetry Tracing API
5
6
  */
6
7
  export declare class TraceAPI {
7
8
  private static _instance?;
9
+ private _proxyTracerProvider;
8
10
  /** Empty private constructor prevents end users from constructing a new instance of the API */
9
11
  private constructor();
10
12
  /** Get the singleton instance of the Trace API */
@@ -23,5 +25,6 @@ export declare class TraceAPI {
23
25
  getTracer(name: string, version?: string): Tracer;
24
26
  /** Remove the global tracer provider */
25
27
  disable(): void;
28
+ isSpanContextValid: typeof isSpanContextValid;
26
29
  }
27
30
  //# sourceMappingURL=trace.d.ts.map
@@ -17,6 +17,8 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TraceAPI = void 0;
19
19
  var NoopTracerProvider_1 = require("../trace/NoopTracerProvider");
20
+ var ProxyTracerProvider_1 = require("../trace/ProxyTracerProvider");
21
+ var spancontext_utils_1 = require("../trace/spancontext-utils");
20
22
  var global_utils_1 = require("./global-utils");
21
23
  /**
22
24
  * Singleton object which represents the entry point to the OpenTelemetry Tracing API
@@ -24,6 +26,8 @@ var global_utils_1 = require("./global-utils");
24
26
  var TraceAPI = /** @class */ (function () {
25
27
  /** Empty private constructor prevents end users from constructing a new instance of the API */
26
28
  function TraceAPI() {
29
+ this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
30
+ this.isSpanContextValid = spancontext_utils_1.isSpanContextValid;
27
31
  }
28
32
  /** Get the singleton instance of the Trace API */
29
33
  TraceAPI.getInstance = function () {
@@ -40,7 +44,8 @@ var TraceAPI = /** @class */ (function () {
40
44
  // global tracer provider has already been set
41
45
  return this.getTracerProvider();
42
46
  }
43
- global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, provider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER);
47
+ this._proxyTracerProvider.setDelegate(provider);
48
+ global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY] = global_utils_1.makeGetter(global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION, this._proxyTracerProvider, NoopTracerProvider_1.NOOP_TRACER_PROVIDER);
44
49
  return this.getTracerProvider();
45
50
  };
46
51
  /**
@@ -48,7 +53,7 @@ var TraceAPI = /** @class */ (function () {
48
53
  */
49
54
  TraceAPI.prototype.getTracerProvider = function () {
50
55
  var _a, _b;
51
- return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : NoopTracerProvider_1.NOOP_TRACER_PROVIDER);
56
+ return ((_b = (_a = global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(global_utils_1._global, global_utils_1.API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyTracerProvider);
52
57
  };
53
58
  /**
54
59
  * Returns a tracer from the global tracer provider.
@@ -59,6 +64,7 @@ var TraceAPI = /** @class */ (function () {
59
64
  /** Remove the global tracer provider */
60
65
  TraceAPI.prototype.disable = function () {
61
66
  delete global_utils_1._global[global_utils_1.GLOBAL_TRACE_API_KEY];
67
+ this._proxyTracerProvider = new ProxyTracerProvider_1.ProxyTracerProvider();
62
68
  };
63
69
  return TraceAPI;
64
70
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/api/trace.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,kEAAmE;AAGnE,+CAKwB;AAExB;;GAEG;AACH;IAGE,+FAA+F;IAC/F;IAAuB,CAAC;IAExB,kDAAkD;IACpC,oBAAW,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,0CAAuB,GAA9B,UAA+B,QAAwB;QACrD,IAAI,sBAAO,CAAC,mCAAoB,CAAC,EAAE;YACjC,8CAA8C;YAC9C,OAAO,IAAI,CAAC,iBAAiB,EAAE,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iBAAiB,EAAE,CAAC;SACjC;QAED,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhD,sBAAO,CAAC,mCAAoB,CAAC,GAAG,yBAAU,CACxC,kDAAmC,EACnC,IAAI,CAAC,oBAAoB,EACzB,yCAAoB,CACrB,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,oCAAiB,GAAxB;;QACE,OAAO,aACL,sBAAO,CAAC,mCAAoB,CAAC,+CAA7B,sBAAO,EAAyB,kDAAmC,oCACnE,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,4BAAS,GAAhB,UAAiB,IAAY,EAAE,OAAgB;QAC7C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,wCAAwC;IACjC,0BAAO,GAAd;QACE,OAAO,sBAAO,CAAC,mCAAoB,CAAC,CAAC;QACrC,IAAI,CAAC,oBAAoB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IACxD,CAAC;IAGH,eAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,4BAAQ"}
@@ -0,0 +1,26 @@
1
+ interface ExceptionWithCode {
2
+ code: string;
3
+ name?: string;
4
+ message?: string;
5
+ stack?: string;
6
+ }
7
+ interface ExceptionWithMessage {
8
+ code?: string;
9
+ message: string;
10
+ name?: string;
11
+ stack?: string;
12
+ }
13
+ interface ExceptionWithName {
14
+ code?: string;
15
+ message?: string;
16
+ name: string;
17
+ stack?: string;
18
+ }
19
+ /**
20
+ * Defines Exception.
21
+ *
22
+ * string or an object with one of (message or name or code) and optional stack
23
+ */
24
+ export declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
25
+ export {};
26
+ //# sourceMappingURL=Exception.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=Exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/common/Exception.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,13 @@
1
+ import { Context } from '@opentelemetry/context-base';
2
+ import { TextMapPropagator } from './TextMapPropagator';
3
+ /**
4
+ * No-op implementations of {@link TextMapPropagator}.
5
+ */
6
+ export declare class NoopTextMapPropagator implements TextMapPropagator {
7
+ /** Noop inject function does nothing */
8
+ inject(context: Context, carrier: unknown, setter: Function): void;
9
+ /** Noop extract function does nothing and returns the input context */
10
+ extract(context: Context, carrier: unknown, getter: Function): Context;
11
+ }
12
+ export declare const NOOP_TEXT_MAP_PROPAGATOR: NoopTextMapPropagator;
13
+ //# sourceMappingURL=NoopTextMapPropagator.d.ts.map
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.NOOP_TEXT_MAP_PROPAGATOR = exports.NoopTextMapPropagator = void 0;
19
+ /**
20
+ * No-op implementations of {@link TextMapPropagator}.
21
+ */
22
+ var NoopTextMapPropagator = /** @class */ (function () {
23
+ function NoopTextMapPropagator() {
24
+ }
25
+ /** Noop inject function does nothing */
26
+ NoopTextMapPropagator.prototype.inject = function (context, carrier, setter) { };
27
+ /** Noop extract function does nothing and returns the input context */
28
+ NoopTextMapPropagator.prototype.extract = function (context, carrier, getter) {
29
+ return context;
30
+ };
31
+ return NoopTextMapPropagator;
32
+ }());
33
+ exports.NoopTextMapPropagator = NoopTextMapPropagator;
34
+ exports.NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
35
+ //# sourceMappingURL=NoopTextMapPropagator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopTextMapPropagator.js","sourceRoot":"","sources":["../../../../src/context/propagation/NoopTextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAKH;;GAEG;AACH;IAAA;IAOA,CAAC;IANC,wCAAwC;IACxC,sCAAM,GAAN,UAAO,OAAgB,EAAE,OAAgB,EAAE,MAAgB,IAAS,CAAC;IACrE,uEAAuE;IACvE,uCAAO,GAAP,UAAQ,OAAgB,EAAE,OAAgB,EAAE,MAAgB;QAC1D,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,4BAAC;AAAD,CAAC,AAPD,IAOC;AAPY,sDAAqB;AASrB,QAAA,wBAAwB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Context } from '@opentelemetry/context-base';
2
+ import { SetterFunction } from './setter';
3
+ import { GetterFunction } from './getter';
4
+ /**
5
+ * Injects `Context` into and extracts it from carriers that travel
6
+ * in-band across process boundaries. Encoding is expected to conform to the
7
+ * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request
8
+ * headers.
9
+ *
10
+ * The carrier of propagated data on both the client (injector) and server
11
+ * (extractor) side is usually an object such as http headers. Propagation is
12
+ * usually implemented via library-specific request interceptors, where the
13
+ * client-side injects values and the server-side extracts them.
14
+ */
15
+ export interface TextMapPropagator {
16
+ /**
17
+ * Injects values from a given `Context` into a carrier.
18
+ *
19
+ * OpenTelemetry defines a common set of format values (TextMapPropagator),
20
+ * and each has an expected `carrier` type.
21
+ *
22
+ * @param context the Context from which to extract values to transmit over
23
+ * the wire.
24
+ * @param carrier the carrier of propagation fields, such as http request
25
+ * headers.
26
+ * @param setter a function which accepts a carrier, key, and value, which
27
+ * sets the key on the carrier to the value.
28
+ */
29
+ inject(context: Context, carrier: unknown, setter: SetterFunction): void;
30
+ /**
31
+ * Given a `Context` and a carrier, extract context values from a
32
+ * carrier and return a new context, created from the old context, with the
33
+ * extracted values.
34
+ *
35
+ * @param context the Context from which to extract values to transmit over
36
+ * the wire.
37
+ * @param carrier the carrier of propagation fields, such as http request
38
+ * headers.
39
+ * @param getter a function which accepts a carrier and a key, and returns
40
+ * the value from the carrier identified by the key.
41
+ */
42
+ extract(context: Context, carrier: unknown, getter: GetterFunction): Context;
43
+ }
44
+ //# sourceMappingURL=TextMapPropagator.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=TextMapPropagator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextMapPropagator.js","sourceRoot":"","sources":["../../../../src/context/propagation/TextMapPropagator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,8 +1,9 @@
1
+ export * from './common/Exception';
1
2
  export * from './common/Logger';
2
3
  export * from './common/Time';
3
4
  export * from './context/propagation/getter';
4
- export * from './context/propagation/HttpTextPropagator';
5
- export * from './context/propagation/NoopHttpTextPropagator';
5
+ export * from './context/propagation/TextMapPropagator';
6
+ export * from './context/propagation/NoopTextMapPropagator';
6
7
  export * from './context/propagation/setter';
7
8
  export * from './correlation_context/CorrelationContext';
8
9
  export * from './correlation_context/EntryValue';
@@ -23,6 +24,8 @@ export * from './trace/link';
23
24
  export * from './trace/NoopSpan';
24
25
  export * from './trace/NoopTracer';
25
26
  export * from './trace/NoopTracerProvider';
27
+ export * from './trace/ProxyTracer';
28
+ export * from './trace/ProxyTracerProvider';
26
29
  export * from './trace/Sampler';
27
30
  export * from './trace/SamplingResult';
28
31
  export * from './trace/span_context';
@@ -35,6 +38,7 @@ export * from './trace/trace_flags';
35
38
  export * from './trace/trace_state';
36
39
  export * from './trace/tracer_provider';
37
40
  export * from './trace/tracer';
41
+ export { INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT, } from './trace/spancontext-utils';
38
42
  export { Context } from '@opentelemetry/context-base';
39
43
  import { ContextAPI } from './api/context';
40
44
  /** Entrypoint for context API */
@@ -26,11 +26,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.propagation = exports.metrics = exports.trace = exports.context = void 0;
29
+ __exportStar(require("./common/Exception"), exports);
29
30
  __exportStar(require("./common/Logger"), exports);
30
31
  __exportStar(require("./common/Time"), exports);
31
32
  __exportStar(require("./context/propagation/getter"), exports);
32
- __exportStar(require("./context/propagation/HttpTextPropagator"), exports);
33
- __exportStar(require("./context/propagation/NoopHttpTextPropagator"), exports);
33
+ __exportStar(require("./context/propagation/TextMapPropagator"), exports);
34
+ __exportStar(require("./context/propagation/NoopTextMapPropagator"), exports);
34
35
  __exportStar(require("./context/propagation/setter"), exports);
35
36
  __exportStar(require("./correlation_context/CorrelationContext"), exports);
36
37
  __exportStar(require("./correlation_context/EntryValue"), exports);
@@ -51,6 +52,8 @@ __exportStar(require("./trace/link"), exports);
51
52
  __exportStar(require("./trace/NoopSpan"), exports);
52
53
  __exportStar(require("./trace/NoopTracer"), exports);
53
54
  __exportStar(require("./trace/NoopTracerProvider"), exports);
55
+ __exportStar(require("./trace/ProxyTracer"), exports);
56
+ __exportStar(require("./trace/ProxyTracerProvider"), exports);
54
57
  __exportStar(require("./trace/Sampler"), exports);
55
58
  __exportStar(require("./trace/SamplingResult"), exports);
56
59
  __exportStar(require("./trace/span_context"), exports);
@@ -63,6 +66,10 @@ __exportStar(require("./trace/trace_flags"), exports);
63
66
  __exportStar(require("./trace/trace_state"), exports);
64
67
  __exportStar(require("./trace/tracer_provider"), exports);
65
68
  __exportStar(require("./trace/tracer"), exports);
69
+ var spancontext_utils_1 = require("./trace/spancontext-utils");
70
+ Object.defineProperty(exports, "INVALID_SPANID", { enumerable: true, get: function () { return spancontext_utils_1.INVALID_SPANID; } });
71
+ Object.defineProperty(exports, "INVALID_TRACEID", { enumerable: true, get: function () { return spancontext_utils_1.INVALID_TRACEID; } });
72
+ Object.defineProperty(exports, "INVALID_SPAN_CONTEXT", { enumerable: true, get: function () { return spancontext_utils_1.INVALID_SPAN_CONTEXT; } });
66
73
  var context_base_1 = require("@opentelemetry/context-base");
67
74
  Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_base_1.Context; } });
68
75
  var context_1 = require("./api/context");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,kDAAgC;AAChC,gDAA8B;AAC9B,+DAA6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;AACjD,gEAA8C;AAC9C,4DAA0C;AAC1C,kDAAgC;AAChC,0DAAwC;AACxC,mDAAiC;AACjC,sDAAoC;AACpC,8DAA4C;AAC5C,wDAAsC;AACtC,2DAAyC;AACzC,qDAAmC;AACnC,gDAA8B;AAC9B,iEAA+C;AAC/C,uDAAqC;AACrC,+CAA6B;AAC7B,mDAAiC;AACjC,qDAAmC;AACnC,6DAA2C;AAC3C,sDAAoC;AACpC,8DAA4C;AAC5C,kDAAgC;AAChC,yDAAuC;AACvC,uDAAqC;AACrC,oDAAkC;AAClC,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,0DAAwC;AACxC,iDAA+B;AAE/B,+DAImC;AAHjC,mHAAA,cAAc,OAAA;AACd,oHAAA,eAAe,OAAA;AACf,yHAAA,oBAAoB,OAAA;AAGtB,4DAAsD;AAA7C,uGAAA,OAAO,OAAA;AAEhB,yCAA2C;AAC3C,iCAAiC;AACpB,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC;AAEhD,qCAAuC;AACvC,+BAA+B;AAClB,QAAA,KAAK,GAAG,gBAAQ,CAAC,WAAW,EAAE,CAAC;AAE5C,yCAA2C;AAC3C,iCAAiC;AACpB,QAAA,OAAO,GAAG,oBAAU,CAAC,WAAW,EAAE,CAAC;AAEhD,iDAAmD;AACnD,qCAAqC;AACxB,QAAA,WAAW,GAAG,4BAAc,CAAC,WAAW,EAAE,CAAC;AAExD,kBAAe;IACb,KAAK,eAAA;IACL,OAAO,iBAAA;IACP,OAAO,iBAAA;IACP,WAAW,qBAAA;CACZ,CAAC"}
@@ -1,5 +1,3 @@
1
- import { CorrelationContext } from '../correlation_context/CorrelationContext';
2
- import { SpanContext } from '../trace/span_context';
3
1
  /** An Instrument for Counter Metric. */
4
2
  export interface BoundCounter {
5
3
  /**
@@ -13,14 +11,8 @@ export interface BoundValueRecorder {
13
11
  /**
14
12
  * Records the given value to this value recorder.
15
13
  * @param value to record.
16
- * @param correlationContext the correlationContext associated with the
17
- * values.
18
- * @param spanContext the {@link SpanContext} that identifies the {@link Span}
19
- * which the values are associated with.
20
14
  */
21
15
  record(value: number): void;
22
- record(value: number, correlationContext: CorrelationContext): void;
23
- record(value: number, correlationContext: CorrelationContext, spanContext: SpanContext): void;
24
16
  }
25
17
  /** An Instrument for Base Observer */
26
18
  export interface BoundBaseObserver {
@@ -1,5 +1,3 @@
1
- import { CorrelationContext } from '../correlation_context/CorrelationContext';
2
- import { SpanContext } from '../trace/span_context';
3
1
  import { BoundBaseObserver, BoundCounter, BoundValueRecorder } from './BoundInstrument';
4
2
  import { Logger } from '../common/Logger';
5
3
  /**
@@ -25,11 +23,6 @@ export interface MetricOptions {
25
23
  * @default false
26
24
  */
27
25
  disabled?: boolean;
28
- /**
29
- * (Measure only, default true) Asserts that this metric will only accept
30
- * non-negative values (e.g. disk usage).
31
- */
32
- absolute?: boolean;
33
26
  /**
34
27
  * Indicates the type of the recorded value.
35
28
  * @default {@link ValueType.DOUBLE}
@@ -112,8 +105,6 @@ export interface ValueRecorder extends UnboundMetric<BoundValueRecorder> {
112
105
  * Records the given value to this value recorder.
113
106
  */
114
107
  record(value: number, labels?: Labels): void;
115
- record(value: number, labels: Labels, correlationContext: CorrelationContext): void;
116
- record(value: number, labels: Labels, correlationContext: CorrelationContext, spanContext: SpanContext): void;
117
108
  }
118
109
  /** Base interface for the Observer metrics. */
119
110
  export interface BaseObserver extends UnboundMetric<BoundBaseObserver> {
@@ -1 +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
+ {"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../src/metrics/Metric.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAwDH,gEAAgE;AAChE,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAG,CAAA;IACH,6CAAM,CAAA;AACR,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
@@ -0,0 +1,18 @@
1
+ export interface MetricObservable {
2
+ /**
3
+ * Sets the next value for observable metric
4
+ * @param value
5
+ */
6
+ next: (value: number) => void;
7
+ /**
8
+ * Subscribes for every value change
9
+ * @param callback
10
+ */
11
+ subscribe: (callback: (value: number) => void) => void;
12
+ /**
13
+ * Removes the subscriber
14
+ * @param [callback]
15
+ */
16
+ unsubscribe: (callback?: (value: number) => void) => void;
17
+ }
18
+ //# sourceMappingURL=MetricObservable.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=MetricObservable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricObservable.js","sourceRoot":"","sources":["../../../src/metrics/MetricObservable.ts"],"names":[],"mappings":""}
@@ -68,7 +68,7 @@ export declare class NoopCounterMetric extends NoopMetric<BoundCounter> implemen
68
68
  add(value: number, labels: Labels): void;
69
69
  }
70
70
  export declare class NoopValueRecorderMetric extends NoopMetric<BoundValueRecorder> implements ValueRecorder {
71
- record(value: number, labels: Labels, correlationContext?: CorrelationContext, spanContext?: SpanContext): void;
71
+ record(value: number, labels: Labels): void;
72
72
  }
73
73
  export declare class NoopBaseObserverMetric extends NoopMetric<BoundBaseObserver> implements BaseObserver {
74
74
  observation(): {
@@ -126,16 +126,8 @@ var NoopValueRecorderMetric = /** @class */ (function (_super) {
126
126
  function NoopValueRecorderMetric() {
127
127
  return _super !== null && _super.apply(this, arguments) || this;
128
128
  }
129
- NoopValueRecorderMetric.prototype.record = function (value, labels, correlationContext, spanContext) {
130
- if (typeof correlationContext === 'undefined') {
131
- this.bind(labels).record(value);
132
- }
133
- else if (typeof spanContext === 'undefined') {
134
- this.bind(labels).record(value, correlationContext);
135
- }
136
- else {
137
- this.bind(labels).record(value, correlationContext, spanContext);
138
- }
129
+ NoopValueRecorderMetric.prototype.record = function (value, labels) {
130
+ this.bind(labels).record(value);
139
131
  };
140
132
  return NoopValueRecorderMetric;
141
133
  }(NoopMetric));
@@ -1 +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;IACpC,CAAC;IAED;;;;OAIG;IACH,uCAAmB,GAAnB,UACE,IAAY,EACZ,QAA4D;QAE5D,OAAO,kCAA0B,CAAC;IACpC,CAAC;IACH,gBAAC;AAAD,CAAC,AAvDD,IAuDC;AAvDY,8BAAS;AAyDtB;IAGE,oBAAY,UAAa;QACvB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,yBAAI,GAAJ,UAAK,MAAc;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,2BAAM,GAAN,UAAO,MAAc;QACnB,OAAO;IACT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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,10 +1,9 @@
1
+ import { Exception } from '../common/Exception';
1
2
  import { TimeInput } from '../common/Time';
2
3
  import { Attributes } from './attributes';
3
4
  import { Span } from './span';
4
5
  import { SpanContext } from './span_context';
5
6
  import { Status } from './status';
6
- export declare const INVALID_TRACE_ID = "0";
7
- export declare const INVALID_SPAN_ID = "0";
8
7
  /**
9
8
  * The NoopSpan is the default {@link Span} that is used when no Span
10
9
  * implementation is available. All operations are no-op including context
@@ -21,6 +20,7 @@ export declare class NoopSpan implements Span {
21
20
  updateName(name: string): this;
22
21
  end(endTime?: TimeInput): void;
23
22
  isRecording(): boolean;
23
+ recordException(exception: Exception, time?: TimeInput): void;
24
24
  }
25
25
  export declare const NOOP_SPAN: NoopSpan;
26
26
  //# sourceMappingURL=NoopSpan.d.ts.map
@@ -15,15 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.NOOP_SPAN = exports.NoopSpan = exports.INVALID_SPAN_ID = exports.INVALID_TRACE_ID = void 0;
19
- var trace_flags_1 = require("./trace_flags");
20
- exports.INVALID_TRACE_ID = '0';
21
- exports.INVALID_SPAN_ID = '0';
22
- var INVALID_SPAN_CONTEXT = {
23
- traceId: exports.INVALID_TRACE_ID,
24
- spanId: exports.INVALID_SPAN_ID,
25
- traceFlags: trace_flags_1.TraceFlags.NONE,
26
- };
18
+ exports.NOOP_SPAN = exports.NoopSpan = void 0;
19
+ var spancontext_utils_1 = require("./spancontext-utils");
27
20
  /**
28
21
  * The NoopSpan is the default {@link Span} that is used when no Span
29
22
  * implementation is available. All operations are no-op including context
@@ -31,7 +24,7 @@ var INVALID_SPAN_CONTEXT = {
31
24
  */
32
25
  var NoopSpan = /** @class */ (function () {
33
26
  function NoopSpan(_spanContext) {
34
- if (_spanContext === void 0) { _spanContext = INVALID_SPAN_CONTEXT; }
27
+ if (_spanContext === void 0) { _spanContext = spancontext_utils_1.INVALID_SPAN_CONTEXT; }
35
28
  this._spanContext = _spanContext;
36
29
  }
37
30
  // Returns a SpanContext.
@@ -64,6 +57,8 @@ var NoopSpan = /** @class */ (function () {
64
57
  NoopSpan.prototype.isRecording = function () {
65
58
  return false;
66
59
  };
60
+ // By default does nothing
61
+ NoopSpan.prototype.recordException = function (exception, time) { };
67
62
  return NoopSpan;
68
63
  }());
69
64
  exports.NoopSpan = NoopSpan;
@@ -1 +1 @@
1
- {"version":3,"file":"NoopSpan.js","sourceRoot":"","sources":["../../../src/trace/NoopSpan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAOH,6CAA2C;AAE9B,QAAA,gBAAgB,GAAG,GAAG,CAAC;AACvB,QAAA,eAAe,GAAG,GAAG,CAAC;AACnC,IAAM,oBAAoB,GAAgB;IACxC,OAAO,EAAE,wBAAgB;IACzB,MAAM,EAAE,uBAAe;IACvB,UAAU,EAAE,wBAAU,CAAC,IAAI;CAC5B,CAAC;AAEF;;;;GAIG;AACH;IACE,kBACmB,YAAgD;QAAhD,6BAAA,EAAA,mCAAgD;QAAhD,iBAAY,GAAZ,YAAY,CAAoC;IAChE,CAAC;IAEJ,yBAAyB;IACzB,0BAAO,GAAP;QACE,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,0BAA0B;IAC1B,+BAAY,GAAZ,UAAa,GAAW,EAAE,KAAc;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,gCAAa,GAAb,UAAc,UAAsB;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,2BAAQ,GAAR,UAAS,IAAY,EAAE,UAAuB;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,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D,8BAAW,GAAX;QACE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0BAA0B;IAC1B,kCAAe,GAAf,UAAgB,SAAoB,EAAE,IAAgB,IAAS,CAAC;IAClE,eAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CY,4BAAQ;AA+CR,QAAA,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Span, SpanOptions, Tracer } from '..';
2
+ import { ProxyTracerProvider } from './ProxyTracerProvider';
3
+ /**
4
+ * Proxy tracer provided by the proxy tracer provider
5
+ */
6
+ export declare class ProxyTracer implements Tracer {
7
+ private _provider;
8
+ readonly name: string;
9
+ readonly version?: string | undefined;
10
+ private _delegate?;
11
+ constructor(_provider: ProxyTracerProvider, name: string, version?: string | undefined);
12
+ getCurrentSpan(): Span | undefined;
13
+ startSpan(name: string, options?: SpanOptions): Span;
14
+ withSpan<T extends (...args: unknown[]) => ReturnType<T>>(span: Span, fn: T): ReturnType<T>;
15
+ bind<T>(target: T, span?: Span): T;
16
+ /**
17
+ * Try to get a tracer from the proxy tracer provider.
18
+ * If the proxy tracer provider has no delegate, return a noop tracer.
19
+ */
20
+ private _getTracer;
21
+ }
22
+ //# sourceMappingURL=ProxyTracer.d.ts.map
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ProxyTracer = void 0;
19
+ var NoopTracer_1 = require("./NoopTracer");
20
+ /**
21
+ * Proxy tracer provided by the proxy tracer provider
22
+ */
23
+ var ProxyTracer = /** @class */ (function () {
24
+ function ProxyTracer(_provider, name, version) {
25
+ this._provider = _provider;
26
+ this.name = name;
27
+ this.version = version;
28
+ }
29
+ ProxyTracer.prototype.getCurrentSpan = function () {
30
+ return this._getTracer().getCurrentSpan();
31
+ };
32
+ ProxyTracer.prototype.startSpan = function (name, options) {
33
+ return this._getTracer().startSpan(name, options);
34
+ };
35
+ ProxyTracer.prototype.withSpan = function (span, fn) {
36
+ return this._getTracer().withSpan(span, fn);
37
+ };
38
+ ProxyTracer.prototype.bind = function (target, span) {
39
+ return this._getTracer().bind(target, span);
40
+ };
41
+ /**
42
+ * Try to get a tracer from the proxy tracer provider.
43
+ * If the proxy tracer provider has no delegate, return a noop tracer.
44
+ */
45
+ ProxyTracer.prototype._getTracer = function () {
46
+ if (this._delegate) {
47
+ return this._delegate;
48
+ }
49
+ var tracer = this._provider.getDelegateTracer(this.name, this.version);
50
+ if (!tracer) {
51
+ return NoopTracer_1.NOOP_TRACER;
52
+ }
53
+ this._delegate = tracer;
54
+ return this._delegate;
55
+ };
56
+ return ProxyTracer;
57
+ }());
58
+ exports.ProxyTracer = ProxyTracer;
59
+ //# sourceMappingURL=ProxyTracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyTracer.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,2CAA2C;AAG3C;;GAEG;AACH;IAIE,qBACU,SAA8B,EACtB,IAAY,EACZ,OAAgB;QAFxB,cAAS,GAAT,SAAS,CAAqB;QACtB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAS;IAC/B,CAAC;IAEJ,oCAAc,GAAd;QACE,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,CAAC;IAC5C,CAAC;IAED,+BAAS,GAAT,UAAU,IAAY,EAAE,OAAqB;QAC3C,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,8BAAQ,GAAR,UACE,IAAU,EACV,EAAK;QAEL,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,0BAAI,GAAJ,UAAQ,MAAS,EAAE,IAAW;QAC5B,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACK,gCAAU,GAAlB;QACE,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;QAED,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzE,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,wBAAW,CAAC;SACpB;QAED,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACH,kBAAC;AAAD,CAAC,AA/CD,IA+CC;AA/CY,kCAAW"}
@@ -0,0 +1,24 @@
1
+ import { Tracer } from './tracer';
2
+ import { TracerProvider } from './tracer_provider';
3
+ /**
4
+ * Tracer provider which provides {@link ProxyTracer}s.
5
+ *
6
+ * Before a delegate is set, tracers provided are NoOp.
7
+ * When a delegate is set, traces are provided from the delegate.
8
+ * When a delegate is set after tracers have already been provided,
9
+ * all tracers already provided will use the provided delegate implementation.
10
+ */
11
+ export declare class ProxyTracerProvider implements TracerProvider {
12
+ private _delegate?;
13
+ /**
14
+ * Get a {@link ProxyTracer}
15
+ */
16
+ getTracer(name: string, version?: string): Tracer;
17
+ getDelegate(): TracerProvider;
18
+ /**
19
+ * Set the delegate tracer provider
20
+ */
21
+ setDelegate(delegate: TracerProvider): void;
22
+ getDelegateTracer(name: string, version?: string): Tracer | undefined;
23
+ }
24
+ //# sourceMappingURL=ProxyTracerProvider.d.ts.map
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright The OpenTelemetry Authors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ProxyTracerProvider = void 0;
19
+ var ProxyTracer_1 = require("./ProxyTracer");
20
+ var NoopTracerProvider_1 = require("./NoopTracerProvider");
21
+ /**
22
+ * Tracer provider which provides {@link ProxyTracer}s.
23
+ *
24
+ * Before a delegate is set, tracers provided are NoOp.
25
+ * When a delegate is set, traces are provided from the delegate.
26
+ * When a delegate is set after tracers have already been provided,
27
+ * all tracers already provided will use the provided delegate implementation.
28
+ */
29
+ var ProxyTracerProvider = /** @class */ (function () {
30
+ function ProxyTracerProvider() {
31
+ }
32
+ /**
33
+ * Get a {@link ProxyTracer}
34
+ */
35
+ ProxyTracerProvider.prototype.getTracer = function (name, version) {
36
+ var _a;
37
+ return ((_a = this.getDelegateTracer(name, version)) !== null && _a !== void 0 ? _a : new ProxyTracer_1.ProxyTracer(this, name, version));
38
+ };
39
+ ProxyTracerProvider.prototype.getDelegate = function () {
40
+ var _a;
41
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NoopTracerProvider_1.NOOP_TRACER_PROVIDER;
42
+ };
43
+ /**
44
+ * Set the delegate tracer provider
45
+ */
46
+ ProxyTracerProvider.prototype.setDelegate = function (delegate) {
47
+ this._delegate = delegate;
48
+ };
49
+ ProxyTracerProvider.prototype.getDelegateTracer = function (name, version) {
50
+ var _a;
51
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version);
52
+ };
53
+ return ProxyTracerProvider;
54
+ }());
55
+ exports.ProxyTracerProvider = ProxyTracerProvider;
56
+ //# sourceMappingURL=ProxyTracerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyTracerProvider.js","sourceRoot":"","sources":["../../../src/trace/ProxyTracerProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,6CAA4C;AAC5C,2DAA4D;AAE5D;;;;;;;GAOG;AACH;IAAA;IA2BA,CAAC;IAxBC;;OAEG;IACH,uCAAS,GAAT,UAAU,IAAY,EAAE,OAAgB;;QACtC,OAAO,OACL,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,mCACrC,IAAI,yBAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CACrC,CAAC;IACJ,CAAC;IAED,yCAAW,GAAX;;QACE,aAAO,IAAI,CAAC,SAAS,mCAAI,yCAAoB,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,yCAAW,GAAX,UAAY,QAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,+CAAiB,GAAjB,UAAkB,IAAY,EAAE,OAAgB;;QAC9C,aAAO,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE;IAClD,CAAC;IACH,0BAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,kDAAmB"}
@@ -1,3 +1,4 @@
1
+ import { Exception } from '../common/Exception';
1
2
  import { Attributes } from './attributes';
2
3
  import { SpanContext } from './span_context';
3
4
  import { Status } from './status';
@@ -86,5 +87,12 @@ export interface Span {
86
87
  * with the `AddEvent` operation and attributes using `setAttributes`.
87
88
  */
88
89
  isRecording(): boolean;
90
+ /**
91
+ * Sets exception as a span event
92
+ * @param exception the exception the only accepted values are string or Error
93
+ * @param [time] the time to set as Span's event time. If not provided,
94
+ * use the current time.
95
+ */
96
+ recordException(exception: Exception, time?: TimeInput): void;
89
97
  }
90
98
  //# sourceMappingURL=span.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { SpanContext } from './span_context';
2
+ export declare const INVALID_SPANID = "0000000000000000";
3
+ export declare const INVALID_TRACEID = "00000000000000000000000000000000";
4
+ export declare const INVALID_SPAN_CONTEXT: SpanContext;
5
+ export declare function isValidTraceId(traceId: string): boolean;
6
+ export declare function isValidSpanId(spanId: string): boolean;
7
+ /**
8
+ * Returns true if this {@link SpanContext} is valid.
9
+ * @return true if this {@link SpanContext} is valid.
10
+ */
11
+ export declare function isSpanContextValid(spanContext: SpanContext): boolean;
12
+ //# sourceMappingURL=spancontext-utils.d.ts.map
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = exports.INVALID_SPAN_CONTEXT = exports.INVALID_TRACEID = exports.INVALID_SPANID = void 0;
4
+ var trace_flags_1 = require("./trace_flags");
5
+ var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
6
+ var VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
7
+ exports.INVALID_SPANID = '0000000000000000';
8
+ exports.INVALID_TRACEID = '00000000000000000000000000000000';
9
+ exports.INVALID_SPAN_CONTEXT = {
10
+ traceId: exports.INVALID_TRACEID,
11
+ spanId: exports.INVALID_SPANID,
12
+ traceFlags: trace_flags_1.TraceFlags.NONE,
13
+ };
14
+ function isValidTraceId(traceId) {
15
+ return VALID_TRACEID_REGEX.test(traceId) && traceId !== exports.INVALID_TRACEID;
16
+ }
17
+ exports.isValidTraceId = isValidTraceId;
18
+ function isValidSpanId(spanId) {
19
+ return VALID_SPANID_REGEX.test(spanId) && spanId !== exports.INVALID_SPANID;
20
+ }
21
+ exports.isValidSpanId = isValidSpanId;
22
+ /**
23
+ * Returns true if this {@link SpanContext} is valid.
24
+ * @return true if this {@link SpanContext} is valid.
25
+ */
26
+ function isSpanContextValid(spanContext) {
27
+ return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId));
28
+ }
29
+ exports.isSpanContextValid = isSpanContextValid;
30
+ //# sourceMappingURL=spancontext-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spancontext-utils.js","sourceRoot":"","sources":["../../../src/trace/spancontext-utils.ts"],"names":[],"mappings":";;;AAgBA,6CAA2C;AAE3C,IAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,IAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAChC,QAAA,cAAc,GAAG,kBAAkB,CAAC;AACpC,QAAA,eAAe,GAAG,kCAAkC,CAAC;AACrD,QAAA,oBAAoB,GAAgB;IAC/C,OAAO,EAAE,uBAAe;IACxB,MAAM,EAAE,sBAAc;IACtB,UAAU,EAAE,wBAAU,CAAC,IAAI;CAC5B,CAAC;AAEF,SAAgB,cAAc,CAAC,OAAe;IAC5C,OAAO,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,KAAK,uBAAe,CAAC;AAC1E,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAc;IAC1C,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,sBAAc,CAAC;AACtE,CAAC;AAFD,sCAEC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,WAAwB;IACzD,OAAO,CACL,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CACzE,CAAC;AACJ,CAAC;AAJD,gDAIC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.10.3-alpha.34+fb06b5b";
1
+ export declare const VERSION = "0.11.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.10.3-alpha.34+fb06b5b';
20
+ exports.VERSION = '0.11.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,yBAAyB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/api",
3
- "version": "0.10.3-alpha.34+fb06b5b",
3
+ "version": "0.11.0",
4
4
  "description": "Public API for OpenTelemetry",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -52,11 +52,12 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@opentelemetry/context-base": "^0.10.2"
55
+ "@opentelemetry/context-base": "^0.11.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/mocha": "8.0.2",
59
59
  "@types/node": "14.0.27",
60
+ "@types/sinon": "4.3.1",
60
61
  "@types/webpack-env": "1.15.2",
61
62
  "codecov": "3.7.2",
62
63
  "gts": "2.0.2",
@@ -70,11 +71,12 @@
70
71
  "linkinator": "2.1.1",
71
72
  "mocha": "7.2.0",
72
73
  "nyc": "15.1.0",
74
+ "sinon": "9.0.3",
73
75
  "ts-loader": "8.0.2",
74
76
  "ts-mocha": "7.0.0",
75
77
  "typedoc": "0.18.0",
76
78
  "typescript": "3.9.7",
77
79
  "webpack": "4.44.1"
78
80
  },
79
- "gitHead": "fb06b5bb1142286acf5b326925f3af3353aa9d90"
81
+ "gitHead": "15174c6647ab9863dfc1424412fa60f2fddb3351"
80
82
  }