@downtrace/protocol 0.6.0 → 0.7.1

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 (37) hide show
  1. package/README.md +18 -2
  2. package/dist/index.d.ts +867 -14
  3. package/dist/index.js +570 -17
  4. package/package.json +1 -1
  5. package/schema/v0/aggregates.schema.json +233 -6
  6. package/schema/v0/capture-evidence.schema.json +200 -0
  7. package/schema/v0/fixtures/evidence/invalid/half-a-coverage.json +8 -0
  8. package/schema/v0/fixtures/evidence/invalid/no-coverage.json +7 -0
  9. package/schema/v0/fixtures/evidence/invalid/no-instance.json +7 -0
  10. package/schema/v0/fixtures/evidence/invalid/operation-with-text.json +17 -0
  11. package/schema/v0/fixtures/evidence/invalid/operation-without-hash.json +17 -0
  12. package/schema/v0/fixtures/evidence/invalid/reference-without-selection.json +49 -0
  13. package/schema/v0/fixtures/evidence/invalid/unknown-protocol.json +8 -0
  14. package/schema/v0/fixtures/evidence/valid/complete.json +28 -0
  15. package/schema/v0/fixtures/evidence/valid/no-requests.json +8 -0
  16. package/schema/v0/fixtures/evidence/valid/partial.json +27 -0
  17. package/schema/v0/fixtures/evidence/valid/with-reference.json +75 -0
  18. package/schema/v0/fixtures/invalid/capture-without-a-start.json +50 -0
  19. package/schema/v0/fixtures/invalid/exception-that-did-not-happen.json +52 -0
  20. package/schema/v0/fixtures/invalid/operation-with-class-and-text.json +87 -0
  21. package/schema/v0/fixtures/invalid/runtime-with-nothing-in-it.json +51 -0
  22. package/schema/v0/fixtures/invalid/withholding-with-nothing-in-it.json +46 -0
  23. package/schema/v0/fixtures/response/invalid/capture-without-deadline.json +5 -0
  24. package/schema/v0/fixtures/response/invalid/capture-without-id.json +5 -0
  25. package/schema/v0/fixtures/response/invalid/missing-accepted.json +1 -0
  26. package/schema/v0/fixtures/response/invalid/unknown-field.json +1 -0
  27. package/schema/v0/fixtures/response/invalid/window-of-no-time.json +5 -0
  28. package/schema/v0/fixtures/response/valid/nothing-pending.json +1 -0
  29. package/schema/v0/fixtures/response/valid/one-capture.json +16 -0
  30. package/schema/v0/fixtures/response/valid/re-sent-batch.json +1 -0
  31. package/schema/v0/fixtures/valid/capture-started.json +51 -0
  32. package/schema/v0/fixtures/valid/operation-omitted-with-class.json +86 -0
  33. package/schema/v0/fixtures/valid/process-exceptions.json +58 -0
  34. package/schema/v0/fixtures/valid/profile-without-intervals.json +60 -0
  35. package/schema/v0/fixtures/{invalid/runtime-missing-rss.json → valid/runtime-without-an-event-loop.json} +2 -7
  36. package/schema/v0/fixtures/valid/withholding.json +49 -0
  37. package/schema/v0/ingest-response.schema.json +71 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 3, "attachedRequests": 9, "detailLost": 1, "truncated": 1 },
7
+ "requests": [
8
+ {
9
+ "method": "POST",
10
+ "route": "/orders",
11
+ "status": 200,
12
+ "startedAt": "2026-09-10T10:00:05.000Z",
13
+ "durationMs": 1200,
14
+ "operations": [{ "hash": "aa11bb", "startMs": 0.5, "endMs": 900 }],
15
+ "truncated": true
16
+ },
17
+ {
18
+ "method": "POST",
19
+ "route": "/orders",
20
+ "status": 200,
21
+ "startedAt": "2026-09-10T10:00:06.000Z",
22
+ "durationMs": 90,
23
+ "operations": [],
24
+ "detailLost": true
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "protocol": "0.7.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": 2,
12
+ "attachedRequests": 0,
13
+ "detailLost": 0,
14
+ "truncated": 0
15
+ },
16
+ "requests": [
17
+ {
18
+ "method": "GET",
19
+ "route": "/checkout",
20
+ "status": 200,
21
+ "startedAt": "2026-09-10T10:00:03.120Z",
22
+ "durationMs": 412.5,
23
+ "operations": [
24
+ {
25
+ "hash": "9f2b1c",
26
+ "startMs": 1.2,
27
+ "endMs": 38.4
28
+ },
29
+ {
30
+ "hash": "9f2b1c",
31
+ "startMs": 38.9,
32
+ "endMs": 74.1
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "method": "GET",
38
+ "route": "/checkout",
39
+ "status": 500,
40
+ "startedAt": "2026-09-10T10:00:41.900Z",
41
+ "durationMs": 88,
42
+ "operations": []
43
+ }
44
+ ],
45
+ "reference": {
46
+ "selection": "uniform-reservoir",
47
+ "population": 1843,
48
+ "routesDropped": 0,
49
+ "renewalPaused": true,
50
+ "samples": [
51
+ {
52
+ "method": "GET",
53
+ "route": "/checkout",
54
+ "status": 200,
55
+ "startedAt": "2026-09-10T09:12:44.010Z",
56
+ "durationMs": 96.4,
57
+ "operations": [
58
+ {
59
+ "hash": "9f2b1c",
60
+ "startMs": 0.8,
61
+ "endMs": 31.2
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "method": "GET",
67
+ "route": "/products",
68
+ "status": 200,
69
+ "startedAt": "2026-09-10T09:31:02.550Z",
70
+ "durationMs": 12.1,
71
+ "operations": []
72
+ }
73
+ ]
74
+ }
75
+ }
@@ -0,0 +1,50 @@
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
+ },
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
+ "captures": [
46
+ {
47
+ "id": "cap-1"
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,52 @@
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
+ },
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
+ "exceptions": [
46
+ {
47
+ "kind": "uncaught",
48
+ "hash": "abc",
49
+ "count": 0
50
+ }
51
+ ]
52
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "protocol": "0.6.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": "POST",
25
+ "route": "/checkout",
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
+ "profile": {
46
+ "start": 1756900000000,
47
+ "durationMs": 60000,
48
+ "endpoints": [
49
+ {
50
+ "method": "POST",
51
+ "route": "/checkout",
52
+ "operations": [
53
+ {
54
+ "kind": "query",
55
+ "hash": "b7c1d0f2a3e45861",
56
+ "text": "SELECT id, price_cents FROM products WHERE id = ?",
57
+ "count": 1440,
58
+ "totalMs": 812.4,
59
+ "errors": 0,
60
+ "class": "select"
61
+ },
62
+ {
63
+ "kind": "query",
64
+ "hash": "9a02ff31b4c7d5e0",
65
+ "count": 720,
66
+ "totalMs": 190.1
67
+ },
68
+ {
69
+ "kind": "error",
70
+ "hash": "c4d5e6f708192a3b",
71
+ "text": "PoolTimeoutError",
72
+ "count": 3,
73
+ "totalMs": 15003.2,
74
+ "errors": 3
75
+ },
76
+ {
77
+ "kind": "query",
78
+ "hash": "(other)",
79
+ "count": 96,
80
+ "totalMs": 41.7,
81
+ "distinct": 7
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ }
87
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "protocol": "0.3.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": "POST",
25
+ "route": "/checkout",
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
+ "postgres": {
42
+ "queriesPerRequest": [0, 0, 0, 0, 0, 3, 0, 0],
43
+ "totalMs": 41.25,
44
+ "max": 9.5
45
+ }
46
+ }
47
+ ],
48
+ "runtime": {}
49
+ }
50
+ ]
51
+ }
@@ -0,0 +1,46 @@
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
+ "withholding": {}
9
+ },
10
+ "instance": {
11
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
12
+ "hostname": "web-1",
13
+ "pid": 4242
14
+ },
15
+ "deploy": {
16
+ "version": "8f71ac2",
17
+ "environment": "production"
18
+ },
19
+ "intervals": [
20
+ {
21
+ "start": 1756900000000,
22
+ "durationMs": 10000,
23
+ "endpoints": [
24
+ {
25
+ "method": "GET",
26
+ "route": "/healthz",
27
+ "count": 3,
28
+ "errors": 0,
29
+ "status": {
30
+ "success": 3,
31
+ "redirect": 0,
32
+ "clientError": 0,
33
+ "serverError": 0
34
+ },
35
+ "latency": {
36
+ "counts": [
37
+ 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
38
+ ],
39
+ "sum": 2.4,
40
+ "max": 0.9
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "accepted": 1,
3
+ "inserted": 1,
4
+ "captures": [{ "id": "cap-1", "route": "/checkout", "windowSeconds": 60 }]
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "accepted": 1,
3
+ "inserted": 1,
4
+ "captures": [{ "route": "/checkout", "windowSeconds": 60, "expiresAt": "2026-09-10T10:15:00Z" }]
5
+ }
@@ -0,0 +1 @@
1
+ { "inserted": 1 }
@@ -0,0 +1 @@
1
+ { "accepted": 1, "inserted": 1, "retryAfterSeconds": 30 }
@@ -0,0 +1,5 @@
1
+ {
2
+ "accepted": 1,
3
+ "inserted": 1,
4
+ "captures": [{ "id": "cap-1", "windowSeconds": 0, "expiresAt": "2026-09-10T10:15:00Z" }]
5
+ }
@@ -0,0 +1 @@
1
+ { "accepted": 3, "inserted": 3 }
@@ -0,0 +1,16 @@
1
+ {
2
+ "accepted": 1,
3
+ "inserted": 1,
4
+ "captures": [
5
+ {
6
+ "id": "5b6d1f0e-2c3a-4d5e-8f90-1a2b3c4d5e6f",
7
+ "environment": "production",
8
+ "method": "GET",
9
+ "route": "/checkout",
10
+ "kind": "",
11
+ "target": "",
12
+ "windowSeconds": 60,
13
+ "expiresAt": "2026-09-10T10:15:00Z"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1 @@
1
+ { "accepted": 6, "inserted": 0, "captures": [] }
@@ -0,0 +1,51 @@
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
+ },
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
+ "captures": [
46
+ {
47
+ "id": "cap-1",
48
+ "startedAt": 1764000000000
49
+ }
50
+ ]
51
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "protocol": "0.6.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": "POST",
25
+ "route": "/checkout",
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
+ "profile": {
46
+ "start": 1756900000000,
47
+ "durationMs": 60000,
48
+ "endpoints": [
49
+ {
50
+ "method": "POST",
51
+ "route": "/checkout",
52
+ "operations": [
53
+ {
54
+ "kind": "query",
55
+ "hash": "b7c1d0f2a3e45861",
56
+ "count": 1440,
57
+ "totalMs": 812.4,
58
+ "errors": 0,
59
+ "class": "select"
60
+ },
61
+ {
62
+ "kind": "query",
63
+ "hash": "9a02ff31b4c7d5e0",
64
+ "count": 720,
65
+ "totalMs": 190.1
66
+ },
67
+ {
68
+ "kind": "error",
69
+ "hash": "c4d5e6f708192a3b",
70
+ "text": "PoolTimeoutError",
71
+ "count": 3,
72
+ "totalMs": 15003.2,
73
+ "errors": 3
74
+ },
75
+ {
76
+ "kind": "query",
77
+ "hash": "(other)",
78
+ "count": 96,
79
+ "totalMs": 41.7,
80
+ "distinct": 7
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ }
86
+ }
@@ -0,0 +1,58 @@
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
+ },
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
+ "exceptions": [
46
+ {
47
+ "kind": "uncaught",
48
+ "hash": "9f1c2d3e4a5b6c7d",
49
+ "text": "TypeError: cannot read ? of ? · handler@orders.js:41",
50
+ "count": 3
51
+ },
52
+ {
53
+ "kind": "unhandled-rejection",
54
+ "hash": "1a2b3c4d5e6f7a8b",
55
+ "count": 1
56
+ }
57
+ ]
58
+ }