@dxos/tracing 0.8.4-main.66e292d → 0.8.4-main.69d29f4
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/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/api.d.ts +4 -4
- package/dist/types/src/api.d.ts.map +1 -1
- package/dist/types/src/diagnostic.d.ts +2 -2
- package/dist/types/src/diagnostic.d.ts.map +1 -1
- package/dist/types/src/trace-processor.d.ts +4 -4
- package/dist/types/src/trace-processor.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -9
- package/src/api.ts +4 -4
- package/src/diagnostic.ts +2 -2
- package/src/trace-processor.ts +5 -5
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/tracing",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.69d29f4",
|
|
4
4
|
"description": "Async utilities.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -27,14 +31,14 @@
|
|
|
27
31
|
"src"
|
|
28
32
|
],
|
|
29
33
|
"dependencies": {
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/protocols": "0.8.4-main.
|
|
36
|
-
"@dxos/util": "0.8.4-main.
|
|
37
|
-
"@dxos/
|
|
34
|
+
"@dxos/async": "0.8.4-main.69d29f4",
|
|
35
|
+
"@dxos/codec-protobuf": "0.8.4-main.69d29f4",
|
|
36
|
+
"@dxos/context": "0.8.4-main.69d29f4",
|
|
37
|
+
"@dxos/invariant": "0.8.4-main.69d29f4",
|
|
38
|
+
"@dxos/node-std": "0.8.4-main.69d29f4",
|
|
39
|
+
"@dxos/protocols": "0.8.4-main.69d29f4",
|
|
40
|
+
"@dxos/util": "0.8.4-main.69d29f4",
|
|
41
|
+
"@dxos/log": "0.8.4-main.69d29f4"
|
|
38
42
|
},
|
|
39
43
|
"publishConfig": {
|
|
40
44
|
"access": "public"
|
package/src/api.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Context } from '@dxos/context';
|
|
|
6
6
|
import { type MaybePromise } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
import { getTracingContext } from './symbols';
|
|
9
|
-
import { TRACE_PROCESSOR, type
|
|
9
|
+
import { TRACE_PROCESSOR, type TraceSpanProps, type TracingSpan } from './trace-processor';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Annotates a class as a tracked resource.
|
|
@@ -108,7 +108,7 @@ const spans = new Map<string, TracingSpan>();
|
|
|
108
108
|
/**
|
|
109
109
|
* Creates a span that must be ended manually.
|
|
110
110
|
*/
|
|
111
|
-
const spanStart = (params:
|
|
111
|
+
const spanStart = (params: TraceSpanProps & { id: string }) => {
|
|
112
112
|
if (spans.has(params.id)) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
@@ -141,7 +141,7 @@ const addLink = (parent: any, child: any, opts: AddLinkOptions = {}) => {
|
|
|
141
141
|
TRACE_PROCESSOR.addLink(parent, child, opts);
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
export type
|
|
144
|
+
export type TraceDiagnosticProps<T> = {
|
|
145
145
|
/**
|
|
146
146
|
* Unique ID.
|
|
147
147
|
*/
|
|
@@ -167,7 +167,7 @@ export interface TraceDiagnostic {
|
|
|
167
167
|
/**
|
|
168
168
|
* Register a diagnostic that could be queried.
|
|
169
169
|
*/
|
|
170
|
-
const diagnostic = <T>(params:
|
|
170
|
+
const diagnostic = <T>(params: TraceDiagnosticProps<T>): TraceDiagnostic => {
|
|
171
171
|
return TRACE_PROCESSOR.diagnostics.registerDiagnostic(params);
|
|
172
172
|
};
|
|
173
173
|
|
package/src/diagnostic.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { asyncTimeout } from '@dxos/async';
|
|
6
6
|
import { invariant } from '@dxos/invariant';
|
|
7
7
|
|
|
8
|
-
import { type TraceDiagnostic, type
|
|
8
|
+
import { type TraceDiagnostic, type TraceDiagnosticProps } from './api';
|
|
9
9
|
import { createId } from './util';
|
|
10
10
|
|
|
11
11
|
export const DIAGNOSTICS_TIMEOUT = 10_000;
|
|
@@ -58,7 +58,7 @@ export class DiagnosticsManager {
|
|
|
58
58
|
this._instanceTag = tag;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
registerDiagnostic(params:
|
|
61
|
+
registerDiagnostic(params: TraceDiagnosticProps<any>): TraceDiagnostic {
|
|
62
62
|
const impl = new TraceDiagnosticImpl(params.id, params.fetch, params.name ?? params.id, () => {
|
|
63
63
|
if (this.registry.get(params.id) === impl) {
|
|
64
64
|
this.registry.delete(params.id);
|
package/src/trace-processor.ts
CHANGED
|
@@ -25,13 +25,13 @@ export type Diagnostics = {
|
|
|
25
25
|
logs: LogEntry[];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type TraceResourceConstructorProps = {
|
|
29
29
|
constructor: { new (...args: any[]): {} };
|
|
30
30
|
instance: any;
|
|
31
31
|
annotation?: symbol;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export type
|
|
34
|
+
export type TraceSpanProps = {
|
|
35
35
|
instance: any;
|
|
36
36
|
// TODO(wittjosiah): Rename to `name`.
|
|
37
37
|
methodName: string;
|
|
@@ -122,7 +122,7 @@ export class TraceProcessor {
|
|
|
122
122
|
* @internal
|
|
123
123
|
*/
|
|
124
124
|
// TODO(burdon): Comment.
|
|
125
|
-
createTraceResource(params:
|
|
125
|
+
createTraceResource(params: TraceResourceConstructorProps): void {
|
|
126
126
|
const id = this.resources.size;
|
|
127
127
|
|
|
128
128
|
// Init metrics counters.
|
|
@@ -158,7 +158,7 @@ export class TraceProcessor {
|
|
|
158
158
|
return new TraceSender(this);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
traceSpan(params:
|
|
161
|
+
traceSpan(params: TraceSpanProps): TracingSpan {
|
|
162
162
|
const span = new TracingSpan(this, params);
|
|
163
163
|
this._flushSpan(span);
|
|
164
164
|
return span;
|
|
@@ -381,7 +381,7 @@ export class TracingSpan {
|
|
|
381
381
|
|
|
382
382
|
constructor(
|
|
383
383
|
private _traceProcessor: TraceProcessor,
|
|
384
|
-
params:
|
|
384
|
+
params: TraceSpanProps,
|
|
385
385
|
) {
|
|
386
386
|
this.id = TracingSpan.nextId++;
|
|
387
387
|
this.methodName = params.methodName;
|