@downtrace/protocol 0.7.1 → 0.8.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.
package/README.md CHANGED
@@ -26,6 +26,8 @@ Since **0.7.0** `agent` may also carry `observers`: which of `pg`, `http`, `redi
26
26
 
27
27
  Also since **0.7.0**, `RuntimeHealth` requires none of its fields and at least one of them. It used to demand all six, which made the one language-dependent corner of the protocol: a Go runtime has garbage collection, a heap and a resident set, and no event loop, so it could either invent one or send none of the three it does have. Relaxing a constraint is additive — a sender reporting all six still validates.
28
28
 
29
+ Since **0.8.0** a captured request may carry `poolWaitMs`: how long it waited for a connection from a pool before it could talk to the dependency at all. The instrumentation measures this per request already, and a consumer that only sees the total time cannot tell a slow database from one it never got to talk to. **Absent means the request asked no pool**, which is not a wait of zero — zero is a request that asked and was served at once — and the two have to stay apart, because a route that never queues must not read as one that queues for nothing.
30
+
29
31
  Also since **0.7.0**, a capture's evidence has a contract of its own: `schema/v0/capture-evidence.schema.json`, exported as `CAPTURE_EVIDENCE_SCHEMA_V0` with the types `CaptureEvidence`, `CapturedRequest`, `CapturedOperation` and `CaptureCoverage`, and its path as `CAPTURE_EVIDENCE_PATH` / `captureEvidencePath(id)`. It is the black box's fine detail, frozen: requests with their operations, in order, with **starts and ends** rather than durations — order and overlap are the whole reason for capturing detail. Hashes only; the text of a query never travels here. And it declares **two coverages**, never a total: what it observed from its effective start, and what it attached from detail still retained.
30
32
 
31
33
  And since **0.7.0** that evidence may carry `reference`: a few requests per endpoint the instrumentation kept as something to compare the captured ones against, with `selection` —an enum, because a sender writing «representative» in a free string means nothing— the `population` they were drawn from, and `renewalPaused` when requests were observed that it deliberately did not consider. A sample has the same shape as a captured request. Being earlier does not make one healthy, and nothing here says it does: `product.md:100`.
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ interface AggregatesBatch {
18
18
  /**
19
19
  * Protocol version this batch conforms to. Every published minor of v0 stays acceptable.
20
20
  */
21
- protocol: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.7.0";
21
+ protocol: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.7.0" | "0.8.0";
22
22
  agent: AgentInfo;
23
23
  instance: InstanceInfo;
24
24
  deploy: DeployInfo;
@@ -443,7 +443,7 @@ interface CaptureEvidence {
443
443
  /**
444
444
  * Protocol version this payload conforms to. Same enum as a batch: every published minor of v0 stays acceptable.
445
445
  */
446
- protocol: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.7.0";
446
+ protocol: "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "0.5.0" | "0.6.0" | "0.7.0" | "0.8.0";
447
447
  /**
448
448
  * Which process observed this. Several instances of one deployment get the same order on purpose (ADR 0071), so the cloud has to be able to tell two answers apart.
449
449
  */
@@ -502,6 +502,10 @@ interface CapturedRequest {
502
502
  */
503
503
  startedAt: string;
504
504
  durationMs: number;
505
+ /**
506
+ * How long this request waited for a connection from a pool before it could talk to the dependency at all. **Absent means this request asked no pool**, which is not a wait of zero: zero is a request that asked and was served at once. The pool-saturation trigger compares wait per request, so a route that never queues must not read as one that queues for nothing (invariant 14).
507
+ */
508
+ poolWaitMs?: number;
505
509
  /**
506
510
  * What it ran, in the order it started them. Empty means it ran nothing — unless `detailLost` says the list was overwritten, which is why that flag is on the request and not only in the totals.
507
511
  *
@@ -616,9 +620,9 @@ interface PendingCapture {
616
620
  //#endregion
617
621
  //#region src/generated/versions.d.ts
618
622
  /** Every published minor of v0, oldest first. The cloud never stops accepting one it published (ADR 0008). */
619
- declare const ACCEPTED_PROTOCOL_VERSIONS_V0: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0"];
623
+ declare const ACCEPTED_PROTOCOL_VERSIONS_V0: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0", "0.8.0"];
620
624
  /** The newest published minor: what an up-to-date agent stamps on every batch. */
621
- declare const PROTOCOL_VERSION = "0.7.0";
625
+ declare const PROTOCOL_VERSION = "0.8.0";
622
626
  //#endregion
623
627
  //#region src/index.d.ts
624
628
  /** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
@@ -1519,6 +1523,11 @@ declare const CAPTURE_EVIDENCE_SCHEMA_V0: {
1519
1523
  type: string;
1520
1524
  minimum: number;
1521
1525
  };
1526
+ poolWaitMs: {
1527
+ type: string;
1528
+ minimum: number;
1529
+ description: string;
1530
+ };
1522
1531
  operations: {
1523
1532
  type: string;
1524
1533
  maxItems: number;
package/dist/index.js CHANGED
@@ -24,7 +24,8 @@ var aggregates_schema_default = {
24
24
  "0.4.0",
25
25
  "0.5.0",
26
26
  "0.6.0",
27
- "0.7.0"
27
+ "0.7.0",
28
+ "0.8.0"
28
29
  ],
29
30
  "description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
30
31
  },
@@ -824,7 +825,8 @@ var capture_evidence_schema_default = {
824
825
  "0.4.0",
825
826
  "0.5.0",
826
827
  "0.6.0",
827
- "0.7.0"
828
+ "0.7.0",
829
+ "0.8.0"
828
830
  ]
829
831
  },
830
832
  "instance": {
@@ -938,6 +940,11 @@ var capture_evidence_schema_default = {
938
940
  "type": "number",
939
941
  "minimum": 0
940
942
  },
943
+ "poolWaitMs": {
944
+ "type": "number",
945
+ "minimum": 0,
946
+ "description": "How long this request waited for a connection from a pool before it could talk to the dependency at all. **Absent means this request asked no pool**, which is not a wait of zero: zero is a request that asked and was served at once. The pool-saturation trigger compares wait per request, so a route that never queues must not read as one that queues for nothing (invariant 14)."
947
+ },
941
948
  "operations": {
942
949
  "type": "array",
943
950
  "maxItems": 256,
@@ -1178,10 +1185,11 @@ const ACCEPTED_PROTOCOL_VERSIONS_V0 = [
1178
1185
  "0.4.0",
1179
1186
  "0.5.0",
1180
1187
  "0.6.0",
1181
- "0.7.0"
1188
+ "0.7.0",
1189
+ "0.8.0"
1182
1190
  ];
1183
1191
  /** The newest published minor: what an up-to-date agent stamps on every batch. */
1184
- const PROTOCOL_VERSION = "0.7.0";
1192
+ const PROTOCOL_VERSION = "0.8.0";
1185
1193
  //#endregion
1186
1194
  //#region src/index.ts
1187
1195
  /** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@downtrace/protocol",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Downtrace ingestion protocol: JSON Schema, fixtures and generated TypeScript types",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,7 +10,7 @@
10
10
  "properties": {
11
11
  "protocol": {
12
12
  "type": "string",
13
- "enum": ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0"],
13
+ "enum": ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0", "0.8.0"],
14
14
  "description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
15
15
  },
16
16
  "agent": {
@@ -11,7 +11,7 @@
11
11
  "protocol": {
12
12
  "type": "string",
13
13
  "description": "Protocol version this payload conforms to. Same enum as a batch: every published minor of v0 stays acceptable.",
14
- "enum": ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0"]
14
+ "enum": ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0", "0.8.0"]
15
15
  },
16
16
  "instance": {
17
17
  "type": "object",
@@ -118,6 +118,11 @@
118
118
  "type": "number",
119
119
  "minimum": 0
120
120
  },
121
+ "poolWaitMs": {
122
+ "type": "number",
123
+ "minimum": 0,
124
+ "description": "How long this request waited for a connection from a pool before it could talk to the dependency at all. **Absent means this request asked no pool**, which is not a wait of zero: zero is a request that asked and was served at once. The pool-saturation trigger compares wait per request, so a route that never queues must not read as one that queues for nothing (invariant 14)."
125
+ },
121
126
  "operations": {
122
127
  "type": "array",
123
128
  "maxItems": 256,