@downtrace/protocol 0.7.1 → 0.9.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 (36) hide show
  1. package/README.md +25 -1
  2. package/dist/index.d.ts +435 -20
  3. package/dist/index.js +325 -23
  4. package/package.json +1 -1
  5. package/schema/v0/aggregates.schema.json +108 -13
  6. package/schema/v0/capture-evidence.schema.json +159 -4
  7. package/schema/v0/fixtures/evidence/invalid/coarse-second-without-its-calls.json +20 -0
  8. package/schema/v0/fixtures/evidence/invalid/dependencies-truncated-negative.json +14 -0
  9. package/schema/v0/fixtures/evidence/invalid/dependencies-truncated-not-a-boolean.json +24 -0
  10. package/schema/v0/fixtures/evidence/invalid/operation-of-an-unknown-kind.json +33 -0
  11. package/schema/v0/fixtures/evidence/invalid/shed-with-an-extra-field.json +14 -0
  12. package/schema/v0/fixtures/evidence/invalid/shed-with-unknown-reason.json +14 -0
  13. package/schema/v0/fixtures/evidence/invalid/shed-with-zero-ms.json +14 -0
  14. package/schema/v0/fixtures/evidence/valid/with-coarse.json +40 -0
  15. package/schema/v0/fixtures/evidence/valid/with-dependencies-truncated.json +32 -0
  16. package/schema/v0/fixtures/evidence/valid/with-operation-kinds.json +57 -0
  17. package/schema/v0/fixtures/evidence/valid/with-shed.json +31 -0
  18. package/schema/v0/fixtures/invalid/a-running-total-of-nothing.json +27 -0
  19. package/schema/v0/fixtures/invalid/an-ending-nobody-declared.json +46 -0
  20. package/schema/v0/fixtures/invalid/call-with-a-path.json +38 -0
  21. package/schema/v0/fixtures/invalid/call-with-a-query-string.json +38 -0
  22. package/schema/v0/fixtures/invalid/command-with-its-key.json +38 -0
  23. package/schema/v0/fixtures/invalid/context-that-is-not-flat.json +40 -0
  24. package/schema/v0/fixtures/invalid/error-sources-with-a-call.json +49 -0
  25. package/schema/v0/fixtures/invalid/error-sources-with-a-query.json +49 -0
  26. package/schema/v0/fixtures/invalid/error-sources-with-a-repeat.json +49 -0
  27. package/schema/v0/fixtures/invalid/error-sources-with-an-unknown-value.json +49 -0
  28. package/schema/v0/fixtures/invalid/operation-of-an-unknown-kind.json +37 -0
  29. package/schema/v0/fixtures/valid/calls-and-commands.json +59 -0
  30. package/schema/v0/fixtures/valid/dropped-exceptions.json +56 -0
  31. package/schema/v0/fixtures/valid/error-sources.json +49 -0
  32. package/schema/v0/fixtures/valid/exceptions-with-a-running-total.json +38 -0
  33. package/schema/v0/fixtures/valid/exceptions-without-intervals.json +37 -0
  34. package/schema/v0/fixtures/valid/reported-errors.json +97 -0
  35. package/schema/v0/fixtures/valid/the-last-batch-of-a-process.json +59 -0
  36. package/schema/v0/fixtures/valid/triggers-without-intervals.json +28 -0
@@ -0,0 +1,32 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "instance": { "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55", "hostname": "web-1", "pid": 4242 },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": {
7
+ "observedRequests": 1,
8
+ "attachedRequests": 1,
9
+ "detailLost": 0,
10
+ "truncated": 0,
11
+ "dependenciesTruncated": 1
12
+ },
13
+ "requests": [
14
+ {
15
+ "method": "GET",
16
+ "route": "/cart",
17
+ "status": 200,
18
+ "startedAt": "2026-09-10T09:59:12.120Z",
19
+ "durationMs": 412.5,
20
+ "operations": [{ "hash": "9f2b1c", "startMs": 1.2, "endMs": 38.4 }],
21
+ "dependenciesTruncated": true
22
+ },
23
+ {
24
+ "method": "GET",
25
+ "route": "/cart",
26
+ "status": 500,
27
+ "startedAt": "2026-09-10T09:59:58.900Z",
28
+ "durationMs": 88,
29
+ "operations": []
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "instance": {
4
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
5
+ "hostname": "web-1",
6
+ "pid": 4242
7
+ },
8
+ "startedAt": "2026-09-10T10:00:00.000Z",
9
+ "endedAt": "2026-09-10T10:01:00.000Z",
10
+ "coverage": {
11
+ "observedRequests": 1,
12
+ "attachedRequests": 0,
13
+ "detailLost": 0,
14
+ "truncated": 0
15
+ },
16
+ "requests": [
17
+ {
18
+ "method": "POST",
19
+ "route": "/checkout",
20
+ "status": 200,
21
+ "startedAt": "2026-09-10T10:00:03.120Z",
22
+ "durationMs": 250,
23
+ "operations": [
24
+ {
25
+ "kind": "query",
26
+ "hash": "9f2b1c",
27
+ "startMs": 1.2,
28
+ "endMs": 38.4
29
+ },
30
+ {
31
+ "kind": "call",
32
+ "hash": "3e1f0a9c5b7d2468",
33
+ "startMs": 40,
34
+ "endMs": 240
35
+ },
36
+ {
37
+ "kind": "call",
38
+ "hash": "3e1f0a9c5b7d2468",
39
+ "startMs": 40,
40
+ "endMs": 240
41
+ },
42
+ {
43
+ "kind": "command",
44
+ "hash": "5d2c8e4f1a6b9073",
45
+ "startMs": 241,
46
+ "endMs": 242.5
47
+ },
48
+ {
49
+ "kind": "error",
50
+ "hash": "c4d5e6f708192a3b",
51
+ "startMs": 241,
52
+ "endMs": 242.5
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "instance": { "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55", "hostname": "web-1", "pid": 4242 },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": {
7
+ "observedRequests": 0,
8
+ "attachedRequests": 2,
9
+ "detailLost": 0,
10
+ "truncated": 0,
11
+ "shed": { "ms": 60000, "reason": "latency" }
12
+ },
13
+ "requests": [
14
+ {
15
+ "method": "GET",
16
+ "route": "/checkout",
17
+ "status": 200,
18
+ "startedAt": "2026-09-10T09:59:12.120Z",
19
+ "durationMs": 412.5,
20
+ "operations": [{ "hash": "9f2b1c", "startMs": 1.2, "endMs": 38.4 }]
21
+ },
22
+ {
23
+ "method": "GET",
24
+ "route": "/checkout",
25
+ "status": 500,
26
+ "startedAt": "2026-09-10T09:59:58.900Z",
27
+ "durationMs": 88,
28
+ "operations": []
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "5c2a7e19-3d4b-4f8a-9e61-0b7d2c4a8f33",
11
+ "hostname": "web-2",
12
+ "pid": 6262
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "exceptions": [
20
+ {
21
+ "kind": "uncaught",
22
+ "hash": "9f1c2d3e4a5b6c7d",
23
+ "count": 1,
24
+ "total": 0
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [
19
+ {
20
+ "start": 1756900000000,
21
+ "durationMs": 10000,
22
+ "endpoints": [
23
+ {
24
+ "method": "GET",
25
+ "route": "/healthz",
26
+ "count": 3,
27
+ "errors": 0,
28
+ "status": {
29
+ "success": 3,
30
+ "redirect": 0,
31
+ "clientError": 0,
32
+ "serverError": 0
33
+ },
34
+ "latency": {
35
+ "counts": [
36
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
37
+ ],
38
+ "sum": 2.4,
39
+ "max": 0.9
40
+ }
41
+ }
42
+ ]
43
+ }
44
+ ],
45
+ "ending": "crashed"
46
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "call",
29
+ "hash": "3e1f0a9c5b7d2468",
30
+ "text": "POST api.stripe.com/v1/charges",
31
+ "count": 2,
32
+ "totalMs": 400
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "call",
29
+ "hash": "3e1f0a9c5b7d2468",
30
+ "text": "GET api.example.com?email=?",
31
+ "count": 2,
32
+ "totalMs": 400
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "command",
29
+ "hash": "5d2c8e4f1a6b9073",
30
+ "text": "HGETALL cache:6379 user:42",
31
+ "count": 1,
32
+ "totalMs": 1
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "explicit",
29
+ "hash": "3c9f0a1b2d4e5f60",
30
+ "count": 1,
31
+ "totalMs": 0,
32
+ "context": {
33
+ "order": { "id": 17, "items": 3 }
34
+ }
35
+ }
36
+ ]
37
+ }
38
+ ]
39
+ }
40
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "protocol": "0.1.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0",
8
+ "errorSources": {
9
+ "inRequest": ["error", "call"],
10
+ "outsideRequest": ["uncaught"]
11
+ }
12
+ },
13
+ "instance": {
14
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
15
+ "hostname": "web-1",
16
+ "pid": 4242
17
+ },
18
+ "deploy": {
19
+ "version": "8f71ac2",
20
+ "environment": "production"
21
+ },
22
+ "intervals": [
23
+ {
24
+ "start": 1756900000000,
25
+ "durationMs": 10000,
26
+ "endpoints": [
27
+ {
28
+ "method": "GET",
29
+ "route": "/healthz",
30
+ "count": 3,
31
+ "errors": 0,
32
+ "status": {
33
+ "success": 3,
34
+ "redirect": 0,
35
+ "clientError": 0,
36
+ "serverError": 0
37
+ },
38
+ "latency": {
39
+ "counts": [
40
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
41
+ ],
42
+ "sum": 2.4,
43
+ "max": 0.9
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "protocol": "0.1.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0",
8
+ "errorSources": {
9
+ "inRequest": ["error", "query"],
10
+ "outsideRequest": ["uncaught"]
11
+ }
12
+ },
13
+ "instance": {
14
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
15
+ "hostname": "web-1",
16
+ "pid": 4242
17
+ },
18
+ "deploy": {
19
+ "version": "8f71ac2",
20
+ "environment": "production"
21
+ },
22
+ "intervals": [
23
+ {
24
+ "start": 1756900000000,
25
+ "durationMs": 10000,
26
+ "endpoints": [
27
+ {
28
+ "method": "GET",
29
+ "route": "/healthz",
30
+ "count": 3,
31
+ "errors": 0,
32
+ "status": {
33
+ "success": 3,
34
+ "redirect": 0,
35
+ "clientError": 0,
36
+ "serverError": 0
37
+ },
38
+ "latency": {
39
+ "counts": [
40
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
41
+ ],
42
+ "sum": 2.4,
43
+ "max": 0.9
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "protocol": "0.1.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0",
8
+ "errorSources": {
9
+ "inRequest": ["error", "error"],
10
+ "outsideRequest": ["uncaught"]
11
+ }
12
+ },
13
+ "instance": {
14
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
15
+ "hostname": "web-1",
16
+ "pid": 4242
17
+ },
18
+ "deploy": {
19
+ "version": "8f71ac2",
20
+ "environment": "production"
21
+ },
22
+ "intervals": [
23
+ {
24
+ "start": 1756900000000,
25
+ "durationMs": 10000,
26
+ "endpoints": [
27
+ {
28
+ "method": "GET",
29
+ "route": "/healthz",
30
+ "count": 3,
31
+ "errors": 0,
32
+ "status": {
33
+ "success": 3,
34
+ "redirect": 0,
35
+ "clientError": 0,
36
+ "serverError": 0
37
+ },
38
+ "latency": {
39
+ "counts": [
40
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
41
+ ],
42
+ "sum": 2.4,
43
+ "max": 0.9
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "protocol": "0.1.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0",
8
+ "errorSources": {
9
+ "inRequest": ["error", "timeout"],
10
+ "outsideRequest": ["uncaught"]
11
+ }
12
+ },
13
+ "instance": {
14
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
15
+ "hostname": "web-1",
16
+ "pid": 4242
17
+ },
18
+ "deploy": {
19
+ "version": "8f71ac2",
20
+ "environment": "production"
21
+ },
22
+ "intervals": [
23
+ {
24
+ "start": 1756900000000,
25
+ "durationMs": 10000,
26
+ "endpoints": [
27
+ {
28
+ "method": "GET",
29
+ "route": "/healthz",
30
+ "count": 3,
31
+ "errors": 0,
32
+ "status": {
33
+ "success": 3,
34
+ "redirect": 0,
35
+ "clientError": 0,
36
+ "serverError": 0
37
+ },
38
+ "latency": {
39
+ "counts": [
40
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
41
+ ],
42
+ "sum": 2.4,
43
+ "max": 0.9
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "timeout",
29
+ "hash": "3e1f0a9c5b7d2468",
30
+ "count": 1,
31
+ "totalMs": 30000
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "protocol": "0.9.0",
3
+ "agent": {
4
+ "name": "@downtrace/agent",
5
+ "version": "0.0.0",
6
+ "runtime": "node",
7
+ "runtimeVersion": "v24.0.0"
8
+ },
9
+ "instance": {
10
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
11
+ "hostname": "web-1",
12
+ "pid": 4242
13
+ },
14
+ "deploy": {
15
+ "version": "8f71ac2",
16
+ "environment": "production"
17
+ },
18
+ "intervals": [],
19
+ "profile": {
20
+ "start": 1756900000000,
21
+ "durationMs": 60000,
22
+ "endpoints": [
23
+ {
24
+ "method": "POST",
25
+ "route": "/checkout",
26
+ "operations": [
27
+ {
28
+ "kind": "query",
29
+ "hash": "b7c1d0f2a3e45861",
30
+ "text": "SELECT id, price_cents FROM products WHERE id = ?",
31
+ "count": 1440,
32
+ "totalMs": 812.4
33
+ },
34
+ {
35
+ "kind": "call",
36
+ "hash": "3e1f0a9c5b7d2468",
37
+ "text": "POST api.stripe.com",
38
+ "count": 1440,
39
+ "totalMs": 288000.5,
40
+ "errors": 2
41
+ },
42
+ {
43
+ "kind": "command",
44
+ "hash": "5d2c8e4f1a6b9073",
45
+ "text": "HGETALL cache:6379",
46
+ "count": 720,
47
+ "totalMs": 360.2
48
+ },
49
+ {
50
+ "kind": "call",
51
+ "hash": "7a9b1c3d5e7f9021",
52
+ "count": 12,
53
+ "totalMs": 2400
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
59
+ }