@azure/core-tracing 1.0.0-preview.9 → 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 +57 -0
- package/README.md +18 -71
- package/dist/index.js +147 -606
- package/dist/index.js.map +1 -1
- package/dist-esm/src/index.js +2 -10
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/instrumenter.js +61 -0
- package/dist-esm/src/instrumenter.js.map +1 -0
- package/dist-esm/src/interfaces.js +1 -0
- package/dist-esm/src/interfaces.js.map +1 -1
- 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 +49 -46
- package/types/core-tracing.d.ts +197 -345
- package/dist-esm/src/tracerProxy.js +0 -31
- package/dist-esm/src/tracerProxy.js.map +0 -1
- package/dist-esm/src/tracers/noop/noOpSpan.js +0 -74
- package/dist-esm/src/tracers/noop/noOpSpan.js.map +0 -1
- package/dist-esm/src/tracers/noop/noOpTracer.js +0 -44
- package/dist-esm/src/tracers/noop/noOpTracer.js.map +0 -1
- package/dist-esm/src/tracers/opencensus/openCensusSpanWrapper.js +0 -113
- package/dist-esm/src/tracers/opencensus/openCensusSpanWrapper.js.map +0 -1
- package/dist-esm/src/tracers/opencensus/openCensusTraceStateWrapper.js +0 -26
- package/dist-esm/src/tracers/opencensus/openCensusTraceStateWrapper.js.map +0 -1
- package/dist-esm/src/tracers/opencensus/openCensusTracerWrapper.js +0 -54
- package/dist-esm/src/tracers/opencensus/openCensusTracerWrapper.js.map +0 -1
- package/dist-esm/src/tracers/test/testSpan.js +0 -93
- package/dist-esm/src/tracers/test/testSpan.js.map +0 -1
- package/dist-esm/src/tracers/test/testTracer.js +0 -127
- package/dist-esm/src/tracers/test/testTracer.js.map +0 -1
- package/dist-esm/src/utils/cache.js +0 -43
- package/dist-esm/src/utils/cache.js.map +0 -1
- package/dist-esm/src/utils/global.browser.js +0 -6
- package/dist-esm/src/utils/global.browser.js.map +0 -1
- package/dist-esm/src/utils/global.js +0 -6
- package/dist-esm/src/utils/global.js.map +0 -1
- package/dist-esm/src/utils/traceParentHeader.js +0 -48
- package/dist-esm/src/utils/traceParentHeader.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Release History
|
|
2
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
|
+
|
|
3
60
|
## 1.0.0-preview.9 (2020-08-04)
|
|
4
61
|
|
|
5
62
|
- Update `@opentelemetry/api` to version 0.10.2 [PR 10393](https://github.com/Azure/azure-sdk-for-js/pull/10393)
|
package/README.md
CHANGED
|
@@ -6,85 +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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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.
|
|
22
|
+
|
|
23
|
+
## Next steps
|
|
24
|
+
|
|
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.
|
|
26
|
+
|
|
27
|
+
## Troubleshooting
|
|
28
|
+
|
|
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).
|
|
85
30
|
|
|
86
31
|
## Contributing
|
|
87
32
|
|
|
88
|
-
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/
|
|
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.
|
|
34
|
+
|
|
35
|
+
[@azure/opentelemetry-instrumentation-azure-sdk]: https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk
|
|
89
36
|
|
|
90
37
|

|