@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.
- package/README.md +18 -2
- package/dist/index.d.ts +867 -14
- package/dist/index.js +570 -17
- package/package.json +1 -1
- package/schema/v0/aggregates.schema.json +233 -6
- package/schema/v0/capture-evidence.schema.json +200 -0
- package/schema/v0/fixtures/evidence/invalid/half-a-coverage.json +8 -0
- package/schema/v0/fixtures/evidence/invalid/no-coverage.json +7 -0
- package/schema/v0/fixtures/evidence/invalid/no-instance.json +7 -0
- package/schema/v0/fixtures/evidence/invalid/operation-with-text.json +17 -0
- package/schema/v0/fixtures/evidence/invalid/operation-without-hash.json +17 -0
- package/schema/v0/fixtures/evidence/invalid/reference-without-selection.json +49 -0
- package/schema/v0/fixtures/evidence/invalid/unknown-protocol.json +8 -0
- package/schema/v0/fixtures/evidence/valid/complete.json +28 -0
- package/schema/v0/fixtures/evidence/valid/no-requests.json +8 -0
- package/schema/v0/fixtures/evidence/valid/partial.json +27 -0
- package/schema/v0/fixtures/evidence/valid/with-reference.json +75 -0
- package/schema/v0/fixtures/invalid/capture-without-a-start.json +50 -0
- package/schema/v0/fixtures/invalid/exception-that-did-not-happen.json +52 -0
- package/schema/v0/fixtures/invalid/operation-with-class-and-text.json +87 -0
- package/schema/v0/fixtures/invalid/runtime-with-nothing-in-it.json +51 -0
- package/schema/v0/fixtures/invalid/withholding-with-nothing-in-it.json +46 -0
- package/schema/v0/fixtures/response/invalid/capture-without-deadline.json +5 -0
- package/schema/v0/fixtures/response/invalid/capture-without-id.json +5 -0
- package/schema/v0/fixtures/response/invalid/missing-accepted.json +1 -0
- package/schema/v0/fixtures/response/invalid/unknown-field.json +1 -0
- package/schema/v0/fixtures/response/invalid/window-of-no-time.json +5 -0
- package/schema/v0/fixtures/response/valid/nothing-pending.json +1 -0
- package/schema/v0/fixtures/response/valid/one-capture.json +16 -0
- package/schema/v0/fixtures/response/valid/re-sent-batch.json +1 -0
- package/schema/v0/fixtures/valid/capture-started.json +51 -0
- package/schema/v0/fixtures/valid/operation-omitted-with-class.json +86 -0
- package/schema/v0/fixtures/valid/process-exceptions.json +58 -0
- package/schema/v0/fixtures/valid/profile-without-intervals.json +60 -0
- package/schema/v0/fixtures/{invalid/runtime-missing-rss.json → valid/runtime-without-an-event-loop.json} +2 -7
- package/schema/v0/fixtures/valid/withholding.json +49 -0
- package/schema/v0/ingest-response.schema.json +71 -0
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
"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
|
+
"errors": 0
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "query",
|
|
37
|
+
"hash": "9a02ff31b4c7d5e0",
|
|
38
|
+
"count": 720,
|
|
39
|
+
"totalMs": 190.1
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"kind": "error",
|
|
43
|
+
"hash": "c4d5e6f708192a3b",
|
|
44
|
+
"text": "PoolTimeoutError",
|
|
45
|
+
"count": 3,
|
|
46
|
+
"totalMs": 15003.2,
|
|
47
|
+
"errors": 3
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "query",
|
|
51
|
+
"hash": "(other)",
|
|
52
|
+
"count": 96,
|
|
53
|
+
"totalMs": 41.7,
|
|
54
|
+
"distinct": 7
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"agent": {
|
|
4
4
|
"name": "@downtrace/agent",
|
|
5
5
|
"version": "0.0.0",
|
|
6
|
-
"runtime": "
|
|
6
|
+
"runtime": "go",
|
|
7
7
|
"runtimeVersion": "v24.0.0"
|
|
8
8
|
},
|
|
9
9
|
"instance": {
|
|
@@ -46,15 +46,10 @@
|
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
48
|
"runtime": {
|
|
49
|
-
"eventLoopDelayMs": {
|
|
50
|
-
"p50": 0.9,
|
|
51
|
-
"p99": 14.2,
|
|
52
|
-
"max": 61.5
|
|
53
|
-
},
|
|
54
49
|
"gcPauseMs": 22.4,
|
|
55
50
|
"gcCount": 7,
|
|
56
51
|
"heapUsedMb": 48.6,
|
|
57
|
-
"
|
|
52
|
+
"rssMb": 140.2
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
]
|
|
@@ -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
|
+
"withholding": {
|
|
9
|
+
"freeText": true,
|
|
10
|
+
"endpoints": 3
|
|
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,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://downtrace.io/schema/v0/ingest-response.schema.json",
|
|
4
|
+
"title": "IngestResponse",
|
|
5
|
+
"description": "What the cloud answers to POST /v0/aggregates. Described here, and not left as an implementation detail, because since protocol 0.7.0 it carries instructions: the captures the cloud is waiting for. It follows the same rules as the batch — fields are only ever added, each addition bumps the minor, and a published minor is accepted for ever — with one difference in who owes what. An agent that does not read this body must behave exactly as it did before (ADR 0008), so every field here is something an agent may ignore.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["accepted", "inserted"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"accepted": {
|
|
11
|
+
"type": "integer",
|
|
12
|
+
"minimum": 0,
|
|
13
|
+
"description": "How many intervals of the batch the cloud took."
|
|
14
|
+
},
|
|
15
|
+
"inserted": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"minimum": 0,
|
|
18
|
+
"description": "How many rows were new. Lower than `accepted` when a batch is re-sent: ingest is idempotent."
|
|
19
|
+
},
|
|
20
|
+
"captures": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"maxItems": 16,
|
|
23
|
+
"items": { "$ref": "#/$defs/PendingCapture" },
|
|
24
|
+
"description": "Captures the cloud is waiting for, in the environment this batch came from. Absent or empty means none. Bounded because this rides on every batch: the cloud never asks for more at once than an instrumentation could reasonably freeze, and the concurrency budget is far below this anyway. Several instances of one deployment receive the same list on purpose — the cloud knows which instance sent recently, not which is alive, so dealing one capture to one instance would lose it silently when that process is gone (invariant 14)."
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"$defs": {
|
|
28
|
+
"PendingCapture": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"title": "PendingCapture",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["id", "windowSeconds", "expiresAt"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"id": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1,
|
|
37
|
+
"maxLength": 64,
|
|
38
|
+
"description": "What the evidence will be sent back under. Carries nothing the service wrote."
|
|
39
|
+
},
|
|
40
|
+
"environment": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"maxLength": 128,
|
|
43
|
+
"description": "The environment this capture is about, which is always the one the batch came from. Sent anyway so the payload is readable on its own."
|
|
44
|
+
},
|
|
45
|
+
"method": { "type": "string", "maxLength": 16, "description": "HTTP method of the route to watch." },
|
|
46
|
+
"route": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"maxLength": 512,
|
|
49
|
+
"description": "Route template to watch. Empty when the capture is about a dependency rather than a route."
|
|
50
|
+
},
|
|
51
|
+
"kind": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"maxLength": 32,
|
|
54
|
+
"description": "Dependency kind to watch. Empty when the capture is about a route."
|
|
55
|
+
},
|
|
56
|
+
"target": { "type": "string", "maxLength": 256, "description": "Dependency target to watch." },
|
|
57
|
+
"windowSeconds": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 1,
|
|
60
|
+
"maximum": 600,
|
|
61
|
+
"description": "How long to watch for, from the effective start of observation."
|
|
62
|
+
},
|
|
63
|
+
"expiresAt": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"format": "date-time",
|
|
66
|
+
"description": "After this instant the cloud stops waiting. An instrumentation that reads a stale response must not start a capture past it: the cloud will refuse the evidence, and a capture nobody is waiting for spends the fine register for nothing."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|