@azure/core-tracing 1.0.0-preview.7 → 1.0.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 (66) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/LICENSE +21 -0
  3. package/README.md +16 -82
  4. package/dist/index.js +150 -663
  5. package/dist/index.js.map +1 -1
  6. package/dist-esm/src/index.js +5 -0
  7. package/dist-esm/src/index.js.map +1 -0
  8. package/dist-esm/src/instrumenter.js +61 -0
  9. package/dist-esm/src/instrumenter.js.map +1 -0
  10. package/dist-esm/src/interfaces.js +4 -0
  11. package/dist-esm/src/interfaces.js.map +1 -0
  12. package/dist-esm/src/tracingClient.js +74 -0
  13. package/dist-esm/src/tracingClient.js.map +1 -0
  14. package/dist-esm/src/tracingContext.js +52 -0
  15. package/dist-esm/src/tracingContext.js.map +1 -0
  16. package/package.json +63 -60
  17. package/types/core-tracing.d.ts +211 -314
  18. package/Changelog.md +0 -27
  19. package/LICENSE.txt +0 -21
  20. package/ThirdPartyNotices.txt +0 -27
  21. package/dist-esm/lib/index.js +0 -13
  22. package/dist-esm/lib/index.js.map +0 -1
  23. package/dist-esm/lib/tracerProxy.js +0 -31
  24. package/dist-esm/lib/tracerProxy.js.map +0 -1
  25. package/dist-esm/lib/tracers/noop/noOpBinaryFormat.js +0 -23
  26. package/dist-esm/lib/tracers/noop/noOpBinaryFormat.js.map +0 -1
  27. package/dist-esm/lib/tracers/noop/noOpHttpTextFormat.js +0 -27
  28. package/dist-esm/lib/tracers/noop/noOpHttpTextFormat.js.map +0 -1
  29. package/dist-esm/lib/tracers/noop/noOpSpan.js +0 -70
  30. package/dist-esm/lib/tracers/noop/noOpSpan.js.map +0 -1
  31. package/dist-esm/lib/tracers/noop/noOpTracer.js +0 -65
  32. package/dist-esm/lib/tracers/noop/noOpTracer.js.map +0 -1
  33. package/dist-esm/lib/tracers/opencensus/openCensusSpanWrapper.js +0 -111
  34. package/dist-esm/lib/tracers/opencensus/openCensusSpanWrapper.js.map +0 -1
  35. package/dist-esm/lib/tracers/opencensus/openCensusTraceStateWrapper.js +0 -26
  36. package/dist-esm/lib/tracers/opencensus/openCensusTraceStateWrapper.js.map +0 -1
  37. package/dist-esm/lib/tracers/opencensus/openCensusTracerWrapper.js +0 -71
  38. package/dist-esm/lib/tracers/opencensus/openCensusTracerWrapper.js.map +0 -1
  39. package/dist-esm/lib/tracers/test/testSpan.js +0 -72
  40. package/dist-esm/lib/tracers/test/testSpan.js.map +0 -1
  41. package/dist-esm/lib/tracers/test/testTracer.js +0 -126
  42. package/dist-esm/lib/tracers/test/testTracer.js.map +0 -1
  43. package/dist-esm/lib/utils/cache.js +0 -40
  44. package/dist-esm/lib/utils/cache.js.map +0 -1
  45. package/dist-esm/lib/utils/global.browser.js +0 -6
  46. package/dist-esm/lib/utils/global.browser.js.map +0 -1
  47. package/dist-esm/lib/utils/global.js +0 -6
  48. package/dist-esm/lib/utils/global.js.map +0 -1
  49. package/dist-esm/lib/utils/traceParentHeader.js +0 -49
  50. package/dist-esm/lib/utils/traceParentHeader.js.map +0 -1
  51. package/lib/index.ts +0 -21
  52. package/lib/tracerProxy.ts +0 -36
  53. package/lib/tracers/noop/noOpBinaryFormat.ts +0 -22
  54. package/lib/tracers/noop/noOpHttpTextFormat.ts +0 -25
  55. package/lib/tracers/noop/noOpSpan.ts +0 -76
  56. package/lib/tracers/noop/noOpTracer.ts +0 -68
  57. package/lib/tracers/opencensus/openCensusSpanWrapper.ts +0 -142
  58. package/lib/tracers/opencensus/openCensusTraceStateWrapper.ts +0 -32
  59. package/lib/tracers/opencensus/openCensusTracerWrapper.ts +0 -83
  60. package/lib/tracers/test/testSpan.ts +0 -119
  61. package/lib/tracers/test/testTracer.ts +0 -162
  62. package/lib/utils/browser.d.ts +0 -2
  63. package/lib/utils/cache.ts +0 -53
  64. package/lib/utils/global.browser.ts +0 -6
  65. package/lib/utils/global.ts +0 -6
  66. package/lib/utils/traceParentHeader.ts +0 -63
@@ -1,13 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- export { getTracer, setTracer } from "./tracerProxy";
4
- // Tracers and wrappers
5
- export { NoOpSpan } from "./tracers/noop/noOpSpan";
6
- export { NoOpTracer } from "./tracers/noop/noOpTracer";
7
- export { OpenCensusSpanWrapper } from "./tracers/opencensus/openCensusSpanWrapper";
8
- export { OpenCensusTracerWrapper } from "./tracers/opencensus/openCensusTracerWrapper";
9
- export { TestTracer } from "./tracers/test/testTracer";
10
- export { TestSpan } from "./tracers/test/testSpan";
11
- // Utilities
12
- export { extractSpanContextFromTraceParentHeader, getTraceParentHeader } from "./utils/traceParentHeader";
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,uBAAuB;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,UAAU,EAA4B,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,YAAY;AACZ,OAAO,EACL,uCAAuC,EACvC,oBAAoB,EACrB,MAAM,2BAA2B,CAAC"}
@@ -1,31 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- import { NoOpTracer } from "./tracers/noop/noOpTracer";
4
- import { getCache } from "./utils/cache";
5
- var defaultTracer;
6
- function getDefaultTracer() {
7
- if (!defaultTracer) {
8
- defaultTracer = new NoOpTracer();
9
- }
10
- return defaultTracer;
11
- }
12
- /**
13
- * Sets the global tracer, enabling tracing for the Azure SDK.
14
- * @param tracer An OpenTelemetry Tracer instance.
15
- */
16
- export function setTracer(tracer) {
17
- var cache = getCache();
18
- cache.tracer = tracer;
19
- }
20
- /**
21
- * Retrieves the active tracer, or returns a
22
- * no-op implementation if one is not set.
23
- */
24
- export function getTracer() {
25
- var cache = getCache();
26
- if (!cache.tracer) {
27
- return getDefaultTracer();
28
- }
29
- return cache.tracer;
30
- }
31
- //# sourceMappingURL=tracerProxy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracerProxy.js","sourceRoot":"","sources":["../../lib/tracerProxy.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,IAAI,aAAqB,CAAC;AAE1B,SAAS,gBAAgB;IACvB,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,IAAI,UAAU,EAAE,CAAC;KAClC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,IAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,IAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACjB,OAAO,gBAAgB,EAAE,CAAC;KAC3B;IACD,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC"}
@@ -1,23 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- /**
4
- * A no-op implementation of BinaryFormat to be used when tracing is disabled.
5
- */
6
- var NoOpBinaryFormat = /** @class */ (function () {
7
- function NoOpBinaryFormat() {
8
- }
9
- /** Serialize the given SpanContext to a buffer */
10
- NoOpBinaryFormat.prototype.toBytes = function (_spanContext) {
11
- return new ArrayBuffer(0);
12
- };
13
- /**
14
- * Deserialize a SpanContext from binary encoding.
15
- * Returns null if the buffer does not contain a valid SpanContext.
16
- */
17
- NoOpBinaryFormat.prototype.fromBytes = function (_buffer) {
18
- return null;
19
- };
20
- return NoOpBinaryFormat;
21
- }());
22
- export { NoOpBinaryFormat };
23
- //# sourceMappingURL=noOpBinaryFormat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noOpBinaryFormat.js","sourceRoot":"","sources":["../../../../lib/tracers/noop/noOpBinaryFormat.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAIlC;;GAEG;AACH;IAAA;IAaA,CAAC;IAZC,kDAAkD;IAClD,kCAAO,GAAP,UAAQ,YAAyB;QAC/B,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,oCAAS,GAAT,UAAU,OAAoB;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACH,uBAAC;AAAD,CAAC,AAbD,IAaC"}
@@ -1,27 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- /**
4
- * A no-op implementation of HttpTextFormat to be used when tracing is disabled.
5
- */
6
- var NoOpHttpTextFormat = /** @class */ (function () {
7
- function NoOpHttpTextFormat() {
8
- }
9
- /**
10
- * Injects the given SpanContext for transmitting to a remote server.
11
- * @param _spanContext The SpanContext to transmit
12
- * @param _format The format of the carrier
13
- * @param _carrier The carrier to propagate through, e.g. an HTTP request
14
- */
15
- NoOpHttpTextFormat.prototype.inject = function (_spanContext, _format, _carrier) { };
16
- /**
17
- * Returns a SpanContext intance extracted from the carrier.
18
- * @param _format the format of the carrier
19
- * @param _carrier The carrier being used for propagation, e.g. an HTTP request
20
- */
21
- NoOpHttpTextFormat.prototype.extract = function (_format, _carrier) {
22
- return null;
23
- };
24
- return NoOpHttpTextFormat;
25
- }());
26
- export { NoOpHttpTextFormat };
27
- //# sourceMappingURL=noOpHttpTextFormat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noOpHttpTextFormat.js","sourceRoot":"","sources":["../../../../lib/tracers/noop/noOpHttpTextFormat.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAIlC;;GAEG;AACH;IAAA;IAgBA,CAAC;IAfC;;;;;OAKG;IACH,mCAAM,GAAN,UAAO,YAAyB,EAAE,OAAe,EAAE,QAAiB,IAAS,CAAC;IAC9E;;;;OAIG;IACH,oCAAO,GAAP,UAAQ,OAAe,EAAE,QAAiB;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACH,yBAAC;AAAD,CAAC,AAhBD,IAgBC"}
@@ -1,70 +0,0 @@
1
- /**
2
- * A no-op implementation of Span that can safely be used without side-effects.
3
- */
4
- var NoOpSpan = /** @class */ (function () {
5
- function NoOpSpan() {
6
- }
7
- /**
8
- * Returns the SpanContext associated with this Span.
9
- */
10
- NoOpSpan.prototype.context = function () {
11
- return {
12
- spanId: "",
13
- traceId: ""
14
- };
15
- };
16
- /**
17
- * Marks the end of Span execution.
18
- * @param _endTime The time to use as the Span's end time. Defaults to
19
- * the current time.
20
- */
21
- NoOpSpan.prototype.end = function (_endTime) {
22
- /* Noop */
23
- };
24
- /**
25
- * Sets an attribute on the Span
26
- * @param _key the attribute key
27
- * @param _value the attribute value
28
- */
29
- NoOpSpan.prototype.setAttribute = function (_key, _value) {
30
- return this;
31
- };
32
- /**
33
- * Sets attributes on the Span
34
- * @param _attributes the attributes to add
35
- */
36
- NoOpSpan.prototype.setAttributes = function (_attributes) {
37
- return this;
38
- };
39
- /**
40
- * Adds an event to the Span
41
- * @param _name The name of the event
42
- * @param _attributes The associated attributes to add for this event
43
- */
44
- NoOpSpan.prototype.addEvent = function (_name, _attributes) {
45
- return this;
46
- };
47
- /**
48
- * Sets a status on the span. Overrides the default of CanonicalCode.OK.
49
- * @param _status The status to set.
50
- */
51
- NoOpSpan.prototype.setStatus = function (_status) {
52
- return this;
53
- };
54
- /**
55
- * Updates the name of the Span
56
- * @param _name the new Span name
57
- */
58
- NoOpSpan.prototype.updateName = function (_name) {
59
- return this;
60
- };
61
- /**
62
- * Returns whether this span will be recorded
63
- */
64
- NoOpSpan.prototype.isRecording = function () {
65
- return false;
66
- };
67
- return NoOpSpan;
68
- }());
69
- export { NoOpSpan };
70
- //# sourceMappingURL=noOpSpan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noOpSpan.js","sourceRoot":"","sources":["../../../../lib/tracers/noop/noOpSpan.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAAA;IAoEA,CAAC;IAnEC;;OAEG;IACH,0BAAO,GAAP;QACE,OAAO;YACL,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,sBAAG,GAAH,UAAI,QAAiB;QACnB,UAAU;IACZ,CAAC;IAED;;;;OAIG;IACH,+BAAY,GAAZ,UAAa,IAAY,EAAE,MAAe;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,gCAAa,GAAb,UAAc,WAAuB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,2BAAQ,GAAR,UAAS,KAAa,EAAE,WAAwB;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,4BAAS,GAAT,UAAU,OAAe;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,6BAAU,GAAV,UAAW,KAAa;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,8BAAW,GAAX;QACE,OAAO,KAAK,CAAC;IACf,CAAC;IACH,eAAC;AAAD,CAAC,AApED,IAoEC"}
@@ -1,65 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- import { NoOpSpan } from "./noOpSpan";
4
- import { NoOpBinaryFormat } from "./noOpBinaryFormat";
5
- import { NoOpHttpTextFormat } from "./noOpHttpTextFormat";
6
- /**
7
- * A no-op implementation of Tracer that can be used when tracing
8
- * is disabled.
9
- */
10
- var NoOpTracer = /** @class */ (function () {
11
- function NoOpTracer() {
12
- }
13
- /**
14
- * Starts a new Span.
15
- * @param _name The name of the span.
16
- * @param _options The SpanOptions used during Span creation.
17
- */
18
- NoOpTracer.prototype.startSpan = function (_name, _options) {
19
- return new NoOpSpan();
20
- };
21
- /**
22
- * Returns the current Span from the current context, if available.
23
- */
24
- NoOpTracer.prototype.getCurrentSpan = function () {
25
- return new NoOpSpan();
26
- };
27
- /**
28
- * Executes the given function within the context provided by a Span.
29
- * @param _span The span that provides the context.
30
- * @param fn The function to be executed.
31
- */
32
- NoOpTracer.prototype.withSpan = function (_span, fn) {
33
- return fn();
34
- };
35
- /**
36
- * Bind a Span as the target's scope
37
- * @param target An object to bind the scope.
38
- * @param _span A specific Span to use. Otherwise, use the current one.
39
- */
40
- NoOpTracer.prototype.bind = function (target, _span) {
41
- return target;
42
- };
43
- /**
44
- * Send a pre-populated Span object to the exporter.
45
- * @param _span The span to pass along.
46
- */
47
- NoOpTracer.prototype.recordSpanData = function (_span) {
48
- /* NOOP */
49
- };
50
- /**
51
- * Returns the BinaryFormat interface for serializing/deserializing Spans.
52
- */
53
- NoOpTracer.prototype.getBinaryFormat = function () {
54
- return new NoOpBinaryFormat();
55
- };
56
- /**
57
- * Returns the HttpTextFormat interface for injecting/extracting Spans.
58
- */
59
- NoOpTracer.prototype.getHttpTextFormat = function () {
60
- return new NoOpHttpTextFormat();
61
- };
62
- return NoOpTracer;
63
- }());
64
- export { NoOpTracer };
65
- //# sourceMappingURL=noOpTracer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noOpTracer.js","sourceRoot":"","sources":["../../../../lib/tracers/noop/noOpTracer.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;GAGG;AACH;IAAA;IAwDA,CAAC;IAvDC;;;;OAIG;IACH,8BAAS,GAAT,UAAU,KAAa,EAAE,QAAsB;QAC7C,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,mCAAc,GAAd;QACE,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,6BAAQ,GAAR,UAA0D,KAAW,EAAE,EAAK;QAC1E,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,yBAAI,GAAJ,UAAQ,MAAS,EAAE,KAAY;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,mCAAc,GAAd,UAAe,KAAW;QACxB,UAAU;IACZ,CAAC;IAED;;OAEG;IACH,oCAAe,GAAf;QACE,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,sCAAiB,GAAjB;QACE,OAAO,IAAI,kBAAkB,EAAE,CAAC;IAClC,CAAC;IACH,iBAAC;AAAD,CAAC,AAxDD,IAwDC"}
@@ -1,111 +0,0 @@
1
- import { OpenCensusTraceStateWrapper } from "./openCensusTraceStateWrapper";
2
- function isWrappedSpan(span) {
3
- return !!span && span.getWrappedSpan !== undefined;
4
- }
5
- function isTracer(tracerOrSpan) {
6
- return tracerOrSpan.getWrappedTracer !== undefined;
7
- }
8
- /**
9
- * An implementation of OpenTelemetry Span that wraps an OpenCensus Span.
10
- */
11
- var OpenCensusSpanWrapper = /** @class */ (function () {
12
- function OpenCensusSpanWrapper(tracerOrSpan, name, options) {
13
- if (name === void 0) { name = ""; }
14
- if (options === void 0) { options = {}; }
15
- if (isTracer(tracerOrSpan)) {
16
- var parent = isWrappedSpan(options.parent) ? options.parent.getWrappedSpan() : undefined;
17
- this._span = tracerOrSpan.getWrappedTracer().startChildSpan({
18
- name: name,
19
- childOf: parent
20
- });
21
- this._span.start();
22
- if (options.links) {
23
- for (var _i = 0, _a = options.links; _i < _a.length; _i++) {
24
- var link = _a[_i];
25
- // Since there is no way to set the link relationship, leave it as Unspecified.
26
- this._span.addLink(link.spanContext.traceId, link.spanContext.spanId, 0 /* LinkType.UNSPECIFIED */, link.attributes);
27
- }
28
- }
29
- }
30
- else {
31
- this._span = tracerOrSpan;
32
- }
33
- }
34
- /**
35
- * The underlying OpenCensus Span
36
- */
37
- OpenCensusSpanWrapper.prototype.getWrappedSpan = function () {
38
- return this._span;
39
- };
40
- /**
41
- * Marks the end of Span execution.
42
- * @param endTime The time to use as the Span's end time. Defaults to
43
- * the current time.
44
- */
45
- OpenCensusSpanWrapper.prototype.end = function (_endTime) {
46
- this._span.end();
47
- };
48
- /**
49
- * Returns the SpanContext associated with this Span.
50
- */
51
- OpenCensusSpanWrapper.prototype.context = function () {
52
- var openCensusSpanContext = this._span.spanContext;
53
- return {
54
- spanId: openCensusSpanContext.spanId,
55
- traceId: openCensusSpanContext.traceId,
56
- traceFlags: openCensusSpanContext.options,
57
- traceState: new OpenCensusTraceStateWrapper(openCensusSpanContext.traceState)
58
- };
59
- };
60
- /**
61
- * Sets an attribute on the Span
62
- * @param key the attribute key
63
- * @param value the attribute value
64
- */
65
- OpenCensusSpanWrapper.prototype.setAttribute = function (key, value) {
66
- this._span.addAttribute(key, value);
67
- return this;
68
- };
69
- /**
70
- * Sets attributes on the Span
71
- * @param attributes the attributes to add
72
- */
73
- OpenCensusSpanWrapper.prototype.setAttributes = function (attributes) {
74
- this._span.attributes = attributes;
75
- return this;
76
- };
77
- /**
78
- * Adds an event to the Span
79
- * @param name The name of the event
80
- * @param attributes The associated attributes to add for this event
81
- */
82
- OpenCensusSpanWrapper.prototype.addEvent = function (_name, _attributes) {
83
- throw new Error("Method not implemented.");
84
- };
85
- /**
86
- * Sets a status on the span. Overrides the default of CanonicalCode.OK.
87
- * @param status The status to set.
88
- */
89
- OpenCensusSpanWrapper.prototype.setStatus = function (status) {
90
- this._span.setStatus(status.code, status.message);
91
- return this;
92
- };
93
- /**
94
- * Updates the name of the Span
95
- * @param name the new Span name
96
- */
97
- OpenCensusSpanWrapper.prototype.updateName = function (name) {
98
- this._span.name = name;
99
- return this;
100
- };
101
- /**
102
- * Returns whether this span will be recorded
103
- */
104
- OpenCensusSpanWrapper.prototype.isRecording = function () {
105
- // NoRecordSpans have an empty traceId
106
- return !!this._span.traceId;
107
- };
108
- return OpenCensusSpanWrapper;
109
- }());
110
- export { OpenCensusSpanWrapper };
111
- //# sourceMappingURL=openCensusSpanWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openCensusSpanWrapper.js","sourceRoot":"","sources":["../../../../lib/tracers/opencensus/openCensusSpanWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAI5E,SAAS,aAAa,CAAC,IAAyB;IAC9C,OAAO,CAAC,CAAC,IAAI,IAAK,IAA8B,CAAC,cAAc,KAAK,SAAS,CAAC;AAChF,CAAC;AAED,SAAS,QAAQ,CACf,YAAsD;IAEtD,OAAQ,YAAwC,CAAC,gBAAgB,KAAK,SAAS,CAAC;AAClF,CAAC;AAED;;GAEG;AACH;IAsBE,+BACE,YAAsD,EACtD,IAAiB,EACjB,OAAyB;QADzB,qBAAA,EAAA,SAAiB;QACjB,wBAAA,EAAA,YAAyB;QAEzB,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE;YAC1B,IAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAC3F,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,gBAAgB,EAAE,CAAC,cAAc,CAAC;gBAC1D,IAAI,MAAA;gBACJ,OAAO,EAAE,MAAM;aAChB,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,OAAO,CAAC,KAAK,EAAE;gBACjB,KAAmB,UAAa,EAAb,KAAA,OAAO,CAAC,KAAK,EAAb,cAAa,EAAb,IAAa,EAAE;oBAA7B,IAAM,IAAI,SAAA;oBACb,+EAA+E;oBAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,0BAA0B,EAAE,IAAI,CAAC,UAAkC,CAAC,CAAC;iBAC9I;aACF;SACF;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;SAC3B;IACH,CAAC;IAxCD;;OAEG;IACI,8CAAc,GAArB;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAqCD;;;;OAIG;IACH,mCAAG,GAAH,UAAI,QAAiB;QACnB,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,uCAAO,GAAP;QACE,IAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAErD,OAAO;YACL,MAAM,EAAE,qBAAqB,CAAC,MAAM;YACpC,OAAO,EAAE,qBAAqB,CAAC,OAAO;YACtC,UAAU,EAAE,qBAAqB,CAAC,OAAO;YACzC,UAAU,EAAE,IAAI,2BAA2B,CAAC,qBAAqB,CAAC,UAAU,CAAC;SAC9E,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,4CAAY,GAAZ,UAAa,GAAW,EAAE,KAAc;QACtC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,KAAY,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,6CAAa,GAAb,UAAc,UAAsB;QAClC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,UAAkC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,wCAAQ,GAAR,UAAS,KAAa,EAAE,WAAwB;QAC9C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,yCAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,0CAAU,GAAV,UAAW,IAAY;QACrB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,2CAAW,GAAX;QACE,sCAAsC;QACtC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IACH,4BAAC;AAAD,CAAC,AAzHD,IAyHC"}
@@ -1,26 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- /**
4
- * @ignore
5
- * @internal
6
- */
7
- var OpenCensusTraceStateWrapper = /** @class */ (function () {
8
- function OpenCensusTraceStateWrapper(state) {
9
- this._state = state;
10
- }
11
- OpenCensusTraceStateWrapper.prototype.get = function (_key) {
12
- throw new Error("Method not implemented.");
13
- };
14
- OpenCensusTraceStateWrapper.prototype.set = function (_key, _value) {
15
- throw new Error("Method not implemented.");
16
- };
17
- OpenCensusTraceStateWrapper.prototype.unset = function (_key) {
18
- throw new Error("Method not implemented");
19
- };
20
- OpenCensusTraceStateWrapper.prototype.serialize = function () {
21
- return this._state || "";
22
- };
23
- return OpenCensusTraceStateWrapper;
24
- }());
25
- export { OpenCensusTraceStateWrapper };
26
- //# sourceMappingURL=openCensusTraceStateWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openCensusTraceStateWrapper.js","sourceRoot":"","sources":["../../../../lib/tracers/opencensus/openCensusTraceStateWrapper.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAIlC;;;GAGG;AACH;IAGE,qCAAY,KAAc;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,yCAAG,GAAH,UAAI,IAAY;QACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,yCAAG,GAAH,UAAI,IAAY,EAAE,MAAc;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2CAAK,GAAL,UAAM,IAAY;QAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,+CAAS,GAAT;QACE,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3B,CAAC;IACH,kCAAC;AAAD,CAAC,AAtBD,IAsBC"}
@@ -1,71 +0,0 @@
1
- import { OpenCensusSpanWrapper } from "./openCensusSpanWrapper";
2
- /**
3
- * An implementation of OpenTelemetry Tracer that wraps an OpenCensus Tracer.
4
- */
5
- var OpenCensusTracerWrapper = /** @class */ (function () {
6
- /**
7
- * Create a new wrapper around a given OpenCensus Tracer.
8
- * @param tracer The OpenCensus Tracer to wrap.
9
- */
10
- function OpenCensusTracerWrapper(tracer) {
11
- this._tracer = tracer;
12
- }
13
- /**
14
- * The wrapped OpenCensus Tracer
15
- */
16
- OpenCensusTracerWrapper.prototype.getWrappedTracer = function () {
17
- return this._tracer;
18
- };
19
- /**
20
- * Starts a new Span.
21
- * @param name The name of the span.
22
- * @param options The SpanOptions used during Span creation.
23
- */
24
- OpenCensusTracerWrapper.prototype.startSpan = function (name, options) {
25
- return new OpenCensusSpanWrapper(this, name, options);
26
- };
27
- /**
28
- * Returns the current Span from the current context, if available.
29
- */
30
- OpenCensusTracerWrapper.prototype.getCurrentSpan = function () {
31
- return null;
32
- };
33
- /**
34
- * Executes the given function within the context provided by a Span.
35
- * @param _span The span that provides the context.
36
- * @param _fn The function to be executed.
37
- */
38
- OpenCensusTracerWrapper.prototype.withSpan = function (_span, _fn) {
39
- throw new Error("Method not implemented.");
40
- };
41
- /**
42
- * Bind a Span as the target's scope
43
- * @param target An object to bind the scope.
44
- * @param _span A specific Span to use. Otherwise, use the current one.
45
- */
46
- OpenCensusTracerWrapper.prototype.bind = function (_target, _span) {
47
- throw new Error("Method not implemented.");
48
- };
49
- /**
50
- * Send a pre-populated Span object to the exporter.
51
- * @param _span The span to pass along.
52
- */
53
- OpenCensusTracerWrapper.prototype.recordSpanData = function (_span) {
54
- throw new Error("Method not implemented.");
55
- };
56
- /**
57
- * Returns the BinaryFormat interface for serializing/deserializing Spans.
58
- */
59
- OpenCensusTracerWrapper.prototype.getBinaryFormat = function () {
60
- throw new Error("Method not implemented.");
61
- };
62
- /**
63
- * Returns the HttpTextFormat interface for injecting/extracting Spans.
64
- */
65
- OpenCensusTracerWrapper.prototype.getHttpTextFormat = function () {
66
- throw new Error("Method not implemented.");
67
- };
68
- return OpenCensusTracerWrapper;
69
- }());
70
- export { OpenCensusTracerWrapper };
71
- //# sourceMappingURL=openCensusTracerWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openCensusTracerWrapper.js","sourceRoot":"","sources":["../../../../lib/tracers/opencensus/openCensusTracerWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;GAEG;AACH;IAUE;;;OAGG;IACH,iCAAmB,MAAwB;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAbD;;OAEG;IACI,kDAAgB,GAAvB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAUD;;;;OAIG;IACH,2CAAS,GAAT,UAAU,IAAY,EAAE,OAAqB;QAC3C,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,gDAAc,GAAd;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,0CAAQ,GAAR,UAAoD,KAAW,EAAE,GAAM;QACrE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,sCAAI,GAAJ,UAAQ,OAAU,EAAE,KAAY;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,gDAAc,GAAd,UAAe,KAAW;QACxB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,iDAAe,GAAf;QACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,mDAAiB,GAAjB;QACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACH,8BAAC;AAAD,CAAC,AAzED,IAyEC"}
@@ -1,72 +0,0 @@
1
- import { __extends } from "tslib";
2
- // Copyright (c) Microsoft Corporation. All rights reserved.
3
- // Licensed under the MIT License.
4
- import { NoOpSpan } from "../noop/noOpSpan";
5
- import { CanonicalCode } from "@opentelemetry/types";
6
- /**
7
- * A mock span useful for testing.
8
- */
9
- var TestSpan = /** @class */ (function (_super) {
10
- __extends(TestSpan, _super);
11
- /**
12
- * Starts a new Span.
13
- * @param parentTracer The tracer that created this Span
14
- * @param name The name of the span.
15
- * @param context The SpanContext this span belongs to
16
- * @param kind The SpanKind of this Span
17
- * @param parentSpanId The identifier of the parent Span
18
- * @param startTime The startTime of the event (defaults to now)
19
- */
20
- function TestSpan(parentTracer, name, context, kind, parentSpanId, startTime) {
21
- if (startTime === void 0) { startTime = Date.now(); }
22
- var _this = _super.call(this) || this;
23
- _this._tracer = parentTracer;
24
- _this.name = name;
25
- _this.kind = kind;
26
- _this.startTime = startTime;
27
- _this.parentSpanId = parentSpanId;
28
- _this.status = {
29
- code: CanonicalCode.OK
30
- };
31
- _this.endCalled = false;
32
- _this._context = context;
33
- return _this;
34
- }
35
- /**
36
- * Returns the Tracer that created this Span
37
- */
38
- TestSpan.prototype.tracer = function () {
39
- return this._tracer;
40
- };
41
- /**
42
- * Returns the SpanContext associated with this Span.
43
- */
44
- TestSpan.prototype.context = function () {
45
- return this._context;
46
- };
47
- /**
48
- * Marks the end of Span execution.
49
- * @param _endTime The time to use as the Span's end time. Defaults to
50
- * the current time.
51
- */
52
- TestSpan.prototype.end = function (_endTime) {
53
- this.endCalled = true;
54
- };
55
- /**
56
- * Sets a status on the span. Overrides the default of CanonicalCode.OK.
57
- * @param status The status to set.
58
- */
59
- TestSpan.prototype.setStatus = function (status) {
60
- this.status = status;
61
- return this;
62
- };
63
- /**
64
- * Returns whether this span will be recorded
65
- */
66
- TestSpan.prototype.isRecording = function () {
67
- return true;
68
- };
69
- return TestSpan;
70
- }(NoOpSpan));
71
- export { TestSpan };
72
- //# sourceMappingURL=testSpan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testSpan.js","sourceRoot":"","sources":["../../../../lib/tracers/test/testSpan.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAML,aAAa,EACd,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH;IAA8B,4BAAQ;IAkCpC;;;;;;;;OAQG;IACH,kBACE,YAAwB,EACxB,IAAY,EACZ,OAAoB,EACpB,IAAc,EACd,YAAqB,EACrB,SAAiC;QAAjC,0BAAA,EAAA,YAAuB,IAAI,CAAC,GAAG,EAAE;QANnC,YAQE,iBAAO,SAWR;QAVC,KAAI,CAAC,OAAO,GAAG,YAAY,CAAC;QAC5B,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,KAAI,CAAC,MAAM,GAAG;YACZ,IAAI,EAAE,aAAa,CAAC,EAAE;SACvB,CAAC;QACF,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;;IAC1B,CAAC;IAED;;OAEG;IACH,yBAAM,GAAN;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,0BAAO,GAAP;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,sBAAG,GAAH,UAAI,QAAiB;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,4BAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,8BAAW,GAAX;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IACH,eAAC;AAAD,CAAC,AAtGD,CAA8B,QAAQ,GAsGrC"}