You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 23, 2023. It is now read-only.
See https://github.com/opentracing/specification/blob/f7ca62c9/rfc/scope_manager.md
However, use continuation passing style which better fits JS and available APIs.
Implementations:
* AsyncHookSpanManager - uses Node.js async_hooks
* AsyncWrapSpanManager - uses async-hook-jl which uses Node.js AsyncWrap
* ZoneSpanManager - uses Zone.js
Note: `globalTracer()` returns a wrapper on the actual tracer object. This is done for the convenience of use as it ensures that the function will always return a non-null object. This can be helpful in cases where it is difficult or impossible to know precisely when `initGlobalTracer` is called (for example, when writing a utility library that does not control the initialization process). For more precise control, individual `Tracer` objects can be used instead of the global tracer.
107
107
108
+
### Span manager (experimental)
109
+
110
+
This library supports span activation in the spirit of the [Scope Manager](https://github.com/opentracing/specification/blob/f7ca62c9/rfc/scope_manager.md) draft RFC.
111
+
112
+
The intention is that it remains active within the executed function and its transitive call graph, including both synchronous and asynchronous calls.
113
+
114
+
```js
115
+
tracer.activeSpan() // null
116
+
tracer.activate(span, () => {
117
+
tracer.activeSpan() // span
118
+
setTimeout(() => {
119
+
tracer.activeSpan() // span
120
+
}, 0);
121
+
(async () => {
122
+
tracer.activeSpan() // span
123
+
})();
124
+
});
125
+
tracer.activeSpan() // null
126
+
```
127
+
128
+
JavaScript support for continuation local storage is a patchwork.
129
+
This library includes simple wrappers around a few common APIs for continuation tracing.
130
+
131
+
**ZoneSpanManger**
132
+
133
+
This uses [Zone.js](https://github.com/angular/zone.js). (See the associated [Zone](https://github.com/domenic/zones) ES TC39 proposal.)
134
+
It includes support for most common APIs: Web, Node.js, Electron, RxJS. Async syntax (async/await) is not supported.
This uses [async-hook-jl](https://github.com/Jeff-Lewis/async-hook-jl) which patches the Node.js AsyncWrap API, available in Node.js 0.11.x - 7.x.x. Though without futher transpilation async-hook-jl requires Node.js 4.x.x+.
0 commit comments