@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.
- package/CHANGELOG.md +99 -0
- package/LICENSE +21 -0
- package/README.md +16 -82
- package/dist/index.js +150 -663
- package/dist/index.js.map +1 -1
- package/dist-esm/src/index.js +5 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/instrumenter.js +61 -0
- package/dist-esm/src/instrumenter.js.map +1 -0
- package/dist-esm/src/interfaces.js +4 -0
- package/dist-esm/src/interfaces.js.map +1 -0
- package/dist-esm/src/tracingClient.js +74 -0
- package/dist-esm/src/tracingClient.js.map +1 -0
- package/dist-esm/src/tracingContext.js +52 -0
- package/dist-esm/src/tracingContext.js.map +1 -0
- package/package.json +63 -60
- package/types/core-tracing.d.ts +211 -314
- package/Changelog.md +0 -27
- package/LICENSE.txt +0 -21
- package/ThirdPartyNotices.txt +0 -27
- package/dist-esm/lib/index.js +0 -13
- package/dist-esm/lib/index.js.map +0 -1
- package/dist-esm/lib/tracerProxy.js +0 -31
- package/dist-esm/lib/tracerProxy.js.map +0 -1
- package/dist-esm/lib/tracers/noop/noOpBinaryFormat.js +0 -23
- package/dist-esm/lib/tracers/noop/noOpBinaryFormat.js.map +0 -1
- package/dist-esm/lib/tracers/noop/noOpHttpTextFormat.js +0 -27
- package/dist-esm/lib/tracers/noop/noOpHttpTextFormat.js.map +0 -1
- package/dist-esm/lib/tracers/noop/noOpSpan.js +0 -70
- package/dist-esm/lib/tracers/noop/noOpSpan.js.map +0 -1
- package/dist-esm/lib/tracers/noop/noOpTracer.js +0 -65
- package/dist-esm/lib/tracers/noop/noOpTracer.js.map +0 -1
- package/dist-esm/lib/tracers/opencensus/openCensusSpanWrapper.js +0 -111
- package/dist-esm/lib/tracers/opencensus/openCensusSpanWrapper.js.map +0 -1
- package/dist-esm/lib/tracers/opencensus/openCensusTraceStateWrapper.js +0 -26
- package/dist-esm/lib/tracers/opencensus/openCensusTraceStateWrapper.js.map +0 -1
- package/dist-esm/lib/tracers/opencensus/openCensusTracerWrapper.js +0 -71
- package/dist-esm/lib/tracers/opencensus/openCensusTracerWrapper.js.map +0 -1
- package/dist-esm/lib/tracers/test/testSpan.js +0 -72
- package/dist-esm/lib/tracers/test/testSpan.js.map +0 -1
- package/dist-esm/lib/tracers/test/testTracer.js +0 -126
- package/dist-esm/lib/tracers/test/testTracer.js.map +0 -1
- package/dist-esm/lib/utils/cache.js +0 -40
- package/dist-esm/lib/utils/cache.js.map +0 -1
- package/dist-esm/lib/utils/global.browser.js +0 -6
- package/dist-esm/lib/utils/global.browser.js.map +0 -1
- package/dist-esm/lib/utils/global.js +0 -6
- package/dist-esm/lib/utils/global.js.map +0 -1
- package/dist-esm/lib/utils/traceParentHeader.js +0 -49
- package/dist-esm/lib/utils/traceParentHeader.js.map +0 -1
- package/lib/index.ts +0 -21
- package/lib/tracerProxy.ts +0 -36
- package/lib/tracers/noop/noOpBinaryFormat.ts +0 -22
- package/lib/tracers/noop/noOpHttpTextFormat.ts +0 -25
- package/lib/tracers/noop/noOpSpan.ts +0 -76
- package/lib/tracers/noop/noOpTracer.ts +0 -68
- package/lib/tracers/opencensus/openCensusSpanWrapper.ts +0 -142
- package/lib/tracers/opencensus/openCensusTraceStateWrapper.ts +0 -32
- package/lib/tracers/opencensus/openCensusTracerWrapper.ts +0 -83
- package/lib/tracers/test/testSpan.ts +0 -119
- package/lib/tracers/test/testTracer.ts +0 -162
- package/lib/utils/browser.d.ts +0 -2
- package/lib/utils/cache.ts +0 -53
- package/lib/utils/global.browser.ts +0 -6
- package/lib/utils/global.ts +0 -6
- package/lib/utils/traceParentHeader.ts +0 -63
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Release History
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2022-03-31)
|
|
4
|
+
|
|
5
|
+
This release marks the GA release of our @azure/core-tracing libraries and is unchanged from preview.14
|
|
6
|
+
|
|
7
|
+
## 1.0.0-preview.14 (2022-02-03)
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- @azure/core-tracing has been rewritten in order to provide cleaner abstractions for client libraries as well as remove @opentelemetry/api as a direct dependency.
|
|
12
|
+
- @opentelemetry/api is no longer a direct dependency of @azure/core-tracing providing for smaller bundle sizes and lower incidence of version conflicts
|
|
13
|
+
- `createSpanFunction` has been removed and replaced with a stateful `TracingClient` which can be created using the `createTracingClient` function.
|
|
14
|
+
- `TracingClient` introduces a new API for creating tracing spans. Use `TracingClient#withSpan` to wrap an invocation in a span, ensuring the span is ended and exceptions are captured.
|
|
15
|
+
- `TracingClient` also provides the lower-level APIs necessary to start a span without making it active, create request headers, serialize `traceparent` header, and wrapping a callback with an active context.
|
|
16
|
+
|
|
17
|
+
### Other Changes
|
|
18
|
+
|
|
19
|
+
- Updates package to work with the react native bundler. [PR #17783](https://github.com/Azure/azure-sdk-for-js/pull/17783)
|
|
20
|
+
|
|
21
|
+
## 1.0.0-preview.13 (2021-07-15)
|
|
22
|
+
|
|
23
|
+
### Features Added
|
|
24
|
+
|
|
25
|
+
- Added support for disabling distributed tracing using the AZURE_TRACING_DISABLED environment variable.
|
|
26
|
+
|
|
27
|
+
### Breaking Changes
|
|
28
|
+
|
|
29
|
+
- Removed `TestTracer` and `TestSpan` from public API and into `@azure/test-utils`. [PR #16315](https://github.com/Azure/azure-sdk-for-js/pull/16315)
|
|
30
|
+
- `TestTracer` and `TestSpan` are intended for test support when used by other Azure packages and not intended for use by end users.
|
|
31
|
+
- Removed `setTracer`, @azure/core-tracing will now rely on the `trace` API to fetch a tracer from the global tracer provider. [PR #16347](https://github.com/Azure/azure-sdk-for-js/pull/16347)
|
|
32
|
+
- If you are using `setTracer`, please use `trace.setGlobalTracerProvider(provider)` instead as described in the OpenTelemetry documentation.
|
|
33
|
+
- Removed `NoOpTracer` and `NoOpSpan` from the public API. Please use `trace.wrapSpanContext(INVALID_SPAN_CONTEXT)` from `@opentelemetry/api` instead. [PR #16315](https://github.com/Azure/azure-sdk-for-js/pull/16315)
|
|
34
|
+
|
|
35
|
+
## 1.0.0-preview.12 (2021-06-30)
|
|
36
|
+
|
|
37
|
+
- Update `@opentelemetry/api` to version 1.0.0 [PR #15883](https://github.com/Azure/azure-sdk-for-js/pull/15883)
|
|
38
|
+
- This version ships with ESM modules and fixes an issue where Angular projects would warn ab out optimization bailouts due to dependencies on CommonJS or AMD.
|
|
39
|
+
|
|
40
|
+
### Breaking Changes
|
|
41
|
+
|
|
42
|
+
- Removed `OpenCensusSpanWrapper` and `OpenCensusTracerWrapper` from the public API. Customers using these wrappers should migrate to using `OpenTelemetry` directly. [PR #15770](https://github.com/Azure/azure-sdk-for-js/pull/15770)
|
|
43
|
+
- Update `@azure/core-tracing` to version 1.0.0-preview.12. This brings core-tracing up to date with `@opentelemetry/api@1.0.0`.
|
|
44
|
+
- `Span#context` was renamed to `Span#spanContext`. This change is supported in `@azure/core-http@1.2.7`.
|
|
45
|
+
|
|
46
|
+
## 1.0.0-preview.11 (2021-03-30)
|
|
47
|
+
|
|
48
|
+
### Breaking Changes
|
|
49
|
+
|
|
50
|
+
- Update @azure/core-tracing to version 1.0.0-preview.11. This brings core-tracing up to date with @opentelemetry/api@1.0.0-rc.0.
|
|
51
|
+
There are two scenarios that will require changes if you are using tracing:
|
|
52
|
+
- Previously, you would pass a parent span using the `OperationOptions.tracingOptions.spanOptions.parentSpan` property. This has been
|
|
53
|
+
changed so that you now specify a parent `Context` using the `OperationOptions.tracingOptions.tracingContext` property instead.
|
|
54
|
+
- The status code for Spans is no longer of type `CanonicalCode`. Instead, it's now `SpanStatusCode`, which also has a smaller range of values.
|
|
55
|
+
|
|
56
|
+
## 1.0.0-preview.10 (2021-03-04)
|
|
57
|
+
|
|
58
|
+
- Internal improvements to make future opentelemetry updates simpler.
|
|
59
|
+
|
|
60
|
+
## 1.0.0-preview.9 (2020-08-04)
|
|
61
|
+
|
|
62
|
+
- Update `@opentelemetry/api` to version 0.10.2 [PR 10393](https://github.com/Azure/azure-sdk-for-js/pull/10393)
|
|
63
|
+
|
|
64
|
+
## 1.0.0-preview.8 (2020-04-28)
|
|
65
|
+
|
|
66
|
+
- Update `TestSpan` to allow setting span attributes [PR link](https://github.com/Azure/azure-sdk-for-js/pull/6565).
|
|
67
|
+
- [BREAKING] Migrate to OpenTelemetry 0.6 using the new `@opentelemetry/api` package. There were a few breaking changes:
|
|
68
|
+
- `SpanContext` now requires traceFlags to be set.
|
|
69
|
+
- `Tracer` has removed `recordSpanData`, `getBinaryFormat`, and `getHttpTextFormat`.
|
|
70
|
+
- `Tracer.getCurrentSpan` returns `undefined` instead of `null` when unset.
|
|
71
|
+
- `Link` objects renamed `spanContext` property to `context`.
|
|
72
|
+
|
|
73
|
+
## 1.0.0-preview.7 (2019-12-03)
|
|
74
|
+
|
|
75
|
+
- Updated the behavior of how incompatible versions of OpenTelemetry Tracer are handled. Now, errors will be thrown only if the user has manually set a Tracer. This means that incompatible versions will be silently ignored when tracing is not enabled.
|
|
76
|
+
- Updated to use OpenTelemetry 0.2 via the `@opentelemetry/types` package. There were two breaking changes in this update:
|
|
77
|
+
- `isRecordingEvents` on `Span` was renamed to `isRecording`. [PR link](https://github.com/open-telemetry/opentelemetry-js/pull/454)
|
|
78
|
+
- `addLink` was removed from `Span` as links are now only allowed to be added during span creation. This is possible by specifying any necessary links inside `SpanOptions`. [PR link](https://github.com/open-telemetry/opentelemetry-js/pull/449)
|
|
79
|
+
|
|
80
|
+
## 1.0.0-preview.5 (2019-10-22)
|
|
81
|
+
|
|
82
|
+
- Fixes issue where loading multiple copies of this module could result in the tracer set by `setTracer()` being reset.
|
|
83
|
+
|
|
84
|
+
## 1.0.0-preview.4 (2019-10-08)
|
|
85
|
+
|
|
86
|
+
- Remove dependency on the `debug` module to ensure compatibility with IE11
|
|
87
|
+
|
|
88
|
+
## 1.0.0-preview.3 (2019-10-07)
|
|
89
|
+
|
|
90
|
+
- Updated to use the latest types from OpenTelemetry (PR [#5182](https://github.com/Azure/azure-sdk-for-js/pull/5182))
|
|
91
|
+
- Clean up and refactored code for easier usage and testability. (PR [#5233](https://github.com/Azure/azure-sdk-for-js/pull/5233) and PR [#5283](https://github.com/Azure/azure-sdk-for-js/pull/5283))
|
|
92
|
+
|
|
93
|
+
## 1.0.0-preview.2 (2019-09-09)
|
|
94
|
+
|
|
95
|
+
Updated the `OpenCensusSpanPlugin` & the `NoOpSpanPlugin` to support for retrieving span context. This allows updating of request headers with the right [span context](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format). (PR [#4712](https://github.com/Azure/azure-sdk-for-js/pull/4712))
|
|
96
|
+
|
|
97
|
+
## 1.0.0-preview.1 (2019-08-05)
|
|
98
|
+
|
|
99
|
+
Provides low-level interfaces and helper methods for tracing in Azure SDK
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Microsoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Azure Core tracing library for
|
|
1
|
+
# Azure Core tracing library for JavaScript
|
|
2
2
|
|
|
3
3
|
This is the core tracing library that provides low-level interfaces and helper methods for tracing in Azure SDK JavaScript libraries which work in the browser and Node.js.
|
|
4
4
|
|
|
@@ -6,98 +6,32 @@ This is the core tracing library that provides low-level interfaces and helper m
|
|
|
6
6
|
|
|
7
7
|
### Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install @azure/core-tracing
|
|
13
|
-
```
|
|
9
|
+
This package is primarily used in Azure client libraries and not meant to be used directly by consumers of Azure SDKs.
|
|
14
10
|
|
|
15
11
|
## Key Concepts
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
By default,
|
|
20
|
-
|
|
13
|
+
- `TracingClient` is the primary interface providing tracing functionality to client libraries. Client libraries should only be aware of and interact with a `TracingClient` instance.
|
|
14
|
+
- A `TracingClient` implementation can be created using the `createTracingClient` factory function.
|
|
15
|
+
- `Instrumenter` provides an abstraction over an instrumentation and acts as the interop point for using third party libraries like OpenTelemetry. By default, a no-op `Instrumenter` is used. Customers who wish to enable `OpenTelemetry` based tracing will do so by installing and registering the [@azure/opentelemetry-instrumentation-azure-sdk] package.
|
|
16
|
+
- `TracingContext` is an **immutable** data container, used to pass operation-specific information around (such as span parenting information).
|
|
17
|
+
- `TracingSpan` is an abstraction of a `Span` which can be used to record events, attributes, and exceptions.
|
|
21
18
|
|
|
22
19
|
## Examples
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
const opentelemetry = require("@opentelemetry/core");
|
|
28
|
-
const { BasicTracer, SimpleSpanProcessor } = require("@opentelemetry/tracing");
|
|
29
|
-
const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin");
|
|
30
|
-
const { setTracer } = require("@azure/core-tracing");
|
|
31
|
-
|
|
32
|
-
const exporter = new ZipkinExporter({
|
|
33
|
-
serviceName: "azure-tracing-sample"
|
|
34
|
-
});
|
|
35
|
-
const tracer = new BasicTracer();
|
|
36
|
-
tracer.addSpanProcessor(new SimpleSpanProcessor(exporter));
|
|
37
|
-
|
|
38
|
-
opentelemetry.initGlobalTracer(tracer);
|
|
39
|
-
|
|
40
|
-
const rootSpan = opentelemetry.getTracer().startSpan("root");
|
|
41
|
-
|
|
42
|
-
// Call some client library methods and pass rootSpan via tracingOptions.
|
|
43
|
-
|
|
44
|
-
rootSpan.end();
|
|
45
|
-
exporter.shutdown();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Example 2 - Setting an OpenCensus Tracer
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
const tracing = require("@opencensus/nodejs");
|
|
52
|
-
const { ZipkinTraceExporter } = require("@opencensus/exporter-zipkin");
|
|
53
|
-
const {
|
|
54
|
-
setTracer,
|
|
55
|
-
OpenCensusTracerWrapper,
|
|
56
|
-
OpenCensusSpanWrapper
|
|
57
|
-
} = require("@azure/core-tracing");
|
|
58
|
-
|
|
59
|
-
const tracer = tracing.start({ samplingRate: 1 }).tracer;
|
|
60
|
-
|
|
61
|
-
tracer.registerSpanEventListener(
|
|
62
|
-
new ZipkinTraceExporter({
|
|
63
|
-
serviceName: "azure-tracing-sample",
|
|
64
|
-
bufferTimeout: 2
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
setTracer(new OpenCensusTracerWrapper(tracer));
|
|
68
|
-
tracer.startRootSpan({ name: "root" }, async (rootSpanEx) => {
|
|
69
|
-
const rootSpan = new OpenCensusSpanWrapper(rootSpanEx);
|
|
70
|
-
// Call some client library methods and pass rootSpan via tracingOptions.
|
|
71
|
-
rootSpanEx.end(); // rootSpan.end() should work as well
|
|
72
|
-
});
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Example 3 - Passing parent Spans to library operations
|
|
76
|
-
|
|
77
|
-
```js
|
|
78
|
-
// Given a BlobClient from @azure/storage-blob
|
|
79
|
-
const result = await blobClient.download(undefined, undefined, {
|
|
80
|
-
tracingOptions: {
|
|
81
|
-
spanOptions: { parent: rootSpan }
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
```
|
|
21
|
+
Examples can be found in the `samples` folder.
|
|
85
22
|
|
|
86
|
-
##
|
|
23
|
+
## Next steps
|
|
87
24
|
|
|
88
|
-
|
|
89
|
-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
90
|
-
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
|
25
|
+
You can build and run the tests locally by executing `rushx test`. Explore the `test` folder to see advanced usage and behavior of the public classes.
|
|
91
26
|
|
|
92
|
-
|
|
93
|
-
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
|
94
|
-
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
27
|
+
## Troubleshooting
|
|
95
28
|
|
|
96
|
-
If you
|
|
29
|
+
If you run into issues while using this library, please feel free to [file an issue](https://github.com/Azure/azure-sdk-for-js/issues/new).
|
|
30
|
+
|
|
31
|
+
## Contributing
|
|
97
32
|
|
|
98
|
-
|
|
99
|
-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
100
|
-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
33
|
+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
|
101
34
|
|
|
35
|
+
[@azure/opentelemetry-instrumentation-azure-sdk]: https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk
|
|
102
36
|
|
|
103
37
|

|