@downtrace/protocol 0.10.0 → 0.11.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 +2 -0
- package/dist/index.d.ts +34 -7
- package/dist/index.js +22 -5
- package/package.json +1 -1
- package/schema/v0/aggregates.schema.json +15 -3
- package/schema/v0/capture-evidence.schema.json +1 -1
package/README.md
CHANGED
|
@@ -62,6 +62,8 @@ And still protocol **0.9.0**, an operation may be an **outgoing HTTP call** or a
|
|
|
62
62
|
|
|
63
63
|
And since **0.10.0** a dependency may be of kind **`mongodb`**: a MongoDB database, one dependency with an empty `target` whatever the members of its replica set, as Postgres reached through postgres.js is. Its commands are operations of kind `query`, labelled by two words, the command's name and the collection it names — `find users`, `insert orders`, `aggregate events` — and never the filter, the documents, the pipeline or the update; a collection whose name looks like a value is `?`.
|
|
64
64
|
|
|
65
|
+
And since **0.11.0** a dependency may be of kind **`sqlite`**: a SQLite database the process opens itself, through `better-sqlite3`, `libsql` or `@libsql/client` on a file, one dependency with an empty `target` whatever file it is, as MongoDB is. Its statements are operations of kind `query`, normalised as SQLite reads them: a double quote, a backtick and a bracket delimit a name, a single quote a value, and a backslash escapes nothing. The same minor lets `observers` name every switch of `DOWNTRACE_INSTRUMENT`: `mysql`, `sqlite` and `mongodb` beside `pg`, `http`, `redis` and `runtime`, so an observer of those three that is watching is said; the instrumentation leaves the key out when no driver of it resolved, which is «did not say».
|
|
66
|
+
|
|
65
67
|
Fields are only ever **added**, and always optional. Each addition bumps the minor version, and the batch's `protocol` field is an enum of every published minor, so a cloud that speaks 0.2 still accepts an agent that speaks 0.1. Removing or renaming a field, or moving a histogram's bucket bounds, would be a major version on a new path. Bucket bounds are declared in the schema itself (`x-latency-boundaries-ms`, `x-calls-per-request-boundaries`), and so are the versions themselves and the ingestion path (`x-ingest-path`), so they are part of the generated contract rather than a constant someone has to keep in sync. So is the first minor that carries each kind of operation and of process exception (`x-since`, beside each `kind` enum), which is how a consumer tells a kind of error a sender cannot send from one it did not send, and whether each kind of operation is an error (`x-error`). A validator in strict mode has to be told these annotations are keywords.
|
|
66
68
|
|
|
67
69
|
## Source
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,18 @@ declare function captureEvidencePath(id: string): string;
|
|
|
11
11
|
* Whether an observer is attached (`on`), was not asked for (`off`), or was asked for and could not attach (`unavailable`) — a driver that is not resolvable from the application's root, for instance. The third one is the point: without it, a service that is not being watched looks exactly like a service that has nothing to watch (COB-01, invariant 14).
|
|
12
12
|
*/
|
|
13
13
|
type ObserverState = "on" | "off" | "unavailable";
|
|
14
|
+
/**
|
|
15
|
+
* Whether an observer is attached (`on`), was not asked for (`off`), or was asked for and could not attach (`unavailable`) — a driver that is not resolvable from the application's root, for instance. The third one is the point: without it, a service that is not being watched looks exactly like a service that has nothing to watch (COB-01, invariant 14).
|
|
16
|
+
*/
|
|
17
|
+
type ObserverState1 = "on" | "off" | "unavailable";
|
|
18
|
+
/**
|
|
19
|
+
* Whether an observer is attached (`on`), was not asked for (`off`), or was asked for and could not attach (`unavailable`) — a driver that is not resolvable from the application's root, for instance. The third one is the point: without it, a service that is not being watched looks exactly like a service that has nothing to watch (COB-01, invariant 14).
|
|
20
|
+
*/
|
|
21
|
+
type ObserverState2 = "on" | "off" | "unavailable";
|
|
22
|
+
/**
|
|
23
|
+
* Whether an observer is attached (`on`), was not asked for (`off`), or was asked for and could not attach (`unavailable`) — a driver that is not resolvable from the application's root, for instance. The third one is the point: without it, a service that is not being watched looks exactly like a service that has nothing to watch (COB-01, invariant 14).
|
|
24
|
+
*/
|
|
25
|
+
type ObserverState3 = "on" | "off" | "unavailable";
|
|
14
26
|
/**
|
|
15
27
|
* A value of `Operation.kind` that its `x-error` marks as an error: the ways an error inside a request arrives, and so the sources that can produce one. A query, an outgoing call and a Redis command are things a route ran, never a source of error.
|
|
16
28
|
*/
|
|
@@ -26,7 +38,7 @@ interface AggregatesBatch {
|
|
|
26
38
|
/**
|
|
27
39
|
* Protocol version this batch conforms to. Every published minor of v0 stays acceptable.
|
|
28
40
|
*/
|
|
29
|
-
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" | "0.9.0" | "0.10.0";
|
|
41
|
+
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" | "0.9.0" | "0.10.0" | "0.11.0";
|
|
30
42
|
agent: AgentInfo;
|
|
31
43
|
instance: InstanceInfo;
|
|
32
44
|
deploy: DeployInfo;
|
|
@@ -76,6 +88,9 @@ interface AgentInfo {
|
|
|
76
88
|
*/
|
|
77
89
|
interface Observers {
|
|
78
90
|
pg?: ObserverState;
|
|
91
|
+
mysql?: ObserverState1;
|
|
92
|
+
sqlite?: ObserverState2;
|
|
93
|
+
mongodb?: ObserverState3;
|
|
79
94
|
http?: ObserverState;
|
|
80
95
|
redis?: ObserverState;
|
|
81
96
|
runtime?: ObserverState;
|
|
@@ -260,9 +275,9 @@ interface PostgresStats {
|
|
|
260
275
|
*/
|
|
261
276
|
interface Dependency {
|
|
262
277
|
/**
|
|
263
|
-
* What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`).
|
|
278
|
+
* What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`). `sqlite` since 0.11.0: a SQLite database in the process, one dependency with an empty `target`, whose statements are operations of kind `query`.
|
|
264
279
|
*/
|
|
265
|
-
kind: "postgres" | "mysql" | "mongodb" | "redis" | "http";
|
|
280
|
+
kind: "postgres" | "mysql" | "sqlite" | "mongodb" | "redis" | "http";
|
|
266
281
|
/**
|
|
267
282
|
* Host for outgoing HTTP (`api.stripe.com`); empty when the dependency is a single one, like the application's own database.
|
|
268
283
|
*/
|
|
@@ -483,7 +498,7 @@ declare const DEPENDENCIES_MAX_ITEMS_V0 = 64;
|
|
|
483
498
|
/** The most requests a capture's evidence may carry: the ring is sized as this minus the reserves' room (gh-901). */
|
|
484
499
|
declare const EVIDENCE_REQUESTS_MAX_ITEMS_V0 = 4096;
|
|
485
500
|
/** The dependency kinds the schema names, in the order it names them. */
|
|
486
|
-
declare const DEPENDENCY_KINDS_V0: readonly ["postgres", "mysql", "mongodb", "redis", "http"];
|
|
501
|
+
declare const DEPENDENCY_KINDS_V0: readonly ["postgres", "mysql", "sqlite", "mongodb", "redis", "http"];
|
|
487
502
|
//#endregion
|
|
488
503
|
//#region src/generated/capture-evidence.d.ts
|
|
489
504
|
/**
|
|
@@ -493,7 +508,7 @@ interface CaptureEvidence {
|
|
|
493
508
|
/**
|
|
494
509
|
* Protocol version this payload conforms to. Same enum as a batch: every published minor of v0 stays acceptable.
|
|
495
510
|
*/
|
|
496
|
-
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" | "0.9.0" | "0.10.0";
|
|
511
|
+
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" | "0.9.0" | "0.10.0" | "0.11.0";
|
|
497
512
|
/**
|
|
498
513
|
* 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.
|
|
499
514
|
*/
|
|
@@ -766,9 +781,9 @@ interface PendingCapture {
|
|
|
766
781
|
//#endregion
|
|
767
782
|
//#region src/generated/versions.d.ts
|
|
768
783
|
/** Every published minor of v0, oldest first. The cloud never stops accepting one it published (ADR 0008). */
|
|
769
|
-
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", "0.9.0", "0.10.0"];
|
|
784
|
+
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", "0.9.0", "0.10.0", "0.11.0"];
|
|
770
785
|
/** The newest published minor: what an up-to-date agent stamps on every batch. */
|
|
771
|
-
declare const PROTOCOL_VERSION = "0.
|
|
786
|
+
declare const PROTOCOL_VERSION = "0.11.0";
|
|
772
787
|
//#endregion
|
|
773
788
|
//#region src/index.d.ts
|
|
774
789
|
/** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
|
|
@@ -1370,6 +1385,18 @@ declare const AGGREGATES_SCHEMA_V0: {
|
|
|
1370
1385
|
pg: {
|
|
1371
1386
|
$ref: string;
|
|
1372
1387
|
};
|
|
1388
|
+
mysql: {
|
|
1389
|
+
$ref: string;
|
|
1390
|
+
description: string;
|
|
1391
|
+
};
|
|
1392
|
+
sqlite: {
|
|
1393
|
+
$ref: string;
|
|
1394
|
+
description: string;
|
|
1395
|
+
};
|
|
1396
|
+
mongodb: {
|
|
1397
|
+
$ref: string;
|
|
1398
|
+
description: string;
|
|
1399
|
+
};
|
|
1373
1400
|
http: {
|
|
1374
1401
|
$ref: string;
|
|
1375
1402
|
};
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,8 @@ var aggregates_schema_default = {
|
|
|
27
27
|
"0.7.0",
|
|
28
28
|
"0.8.0",
|
|
29
29
|
"0.9.0",
|
|
30
|
-
"0.10.0"
|
|
30
|
+
"0.10.0",
|
|
31
|
+
"0.11.0"
|
|
31
32
|
],
|
|
32
33
|
"description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
|
|
33
34
|
},
|
|
@@ -501,11 +502,12 @@ var aggregates_schema_default = {
|
|
|
501
502
|
"enum": [
|
|
502
503
|
"postgres",
|
|
503
504
|
"mysql",
|
|
505
|
+
"sqlite",
|
|
504
506
|
"mongodb",
|
|
505
507
|
"redis",
|
|
506
508
|
"http"
|
|
507
509
|
],
|
|
508
|
-
"description": "What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`)."
|
|
510
|
+
"description": "What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`). `sqlite` since 0.11.0: a SQLite database in the process, one dependency with an empty `target`, whose statements are operations of kind `query`."
|
|
509
511
|
},
|
|
510
512
|
"target": {
|
|
511
513
|
"type": "string",
|
|
@@ -712,6 +714,18 @@ var aggregates_schema_default = {
|
|
|
712
714
|
"description": "What the instrumentation is watching, by switch. The keys are the switches of `DOWNTRACE_INSTRUMENT`, so this says `pg` where a dependency says `postgres`: one is the switch and the other is the thing observed.",
|
|
713
715
|
"properties": {
|
|
714
716
|
"pg": { "$ref": "#/$defs/ObserverState" },
|
|
717
|
+
"mysql": {
|
|
718
|
+
"$ref": "#/$defs/ObserverState",
|
|
719
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
720
|
+
},
|
|
721
|
+
"sqlite": {
|
|
722
|
+
"$ref": "#/$defs/ObserverState",
|
|
723
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
724
|
+
},
|
|
725
|
+
"mongodb": {
|
|
726
|
+
"$ref": "#/$defs/ObserverState",
|
|
727
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
728
|
+
},
|
|
715
729
|
"http": { "$ref": "#/$defs/ObserverState" },
|
|
716
730
|
"redis": { "$ref": "#/$defs/ObserverState" },
|
|
717
731
|
"runtime": { "$ref": "#/$defs/ObserverState" }
|
|
@@ -946,7 +960,8 @@ var capture_evidence_schema_default = {
|
|
|
946
960
|
"0.7.0",
|
|
947
961
|
"0.8.0",
|
|
948
962
|
"0.9.0",
|
|
949
|
-
"0.10.0"
|
|
963
|
+
"0.10.0",
|
|
964
|
+
"0.11.0"
|
|
950
965
|
]
|
|
951
966
|
},
|
|
952
967
|
"instance": {
|
|
@@ -1468,6 +1483,7 @@ const EVIDENCE_REQUESTS_MAX_ITEMS_V0 = 4096;
|
|
|
1468
1483
|
const DEPENDENCY_KINDS_V0 = [
|
|
1469
1484
|
"postgres",
|
|
1470
1485
|
"mysql",
|
|
1486
|
+
"sqlite",
|
|
1471
1487
|
"mongodb",
|
|
1472
1488
|
"redis",
|
|
1473
1489
|
"http"
|
|
@@ -1485,10 +1501,11 @@ const ACCEPTED_PROTOCOL_VERSIONS_V0 = [
|
|
|
1485
1501
|
"0.7.0",
|
|
1486
1502
|
"0.8.0",
|
|
1487
1503
|
"0.9.0",
|
|
1488
|
-
"0.10.0"
|
|
1504
|
+
"0.10.0",
|
|
1505
|
+
"0.11.0"
|
|
1489
1506
|
];
|
|
1490
1507
|
/** The newest published minor: what an up-to-date agent stamps on every batch. */
|
|
1491
|
-
const PROTOCOL_VERSION = "0.
|
|
1508
|
+
const PROTOCOL_VERSION = "0.11.0";
|
|
1492
1509
|
//#endregion
|
|
1493
1510
|
//#region src/index.ts
|
|
1494
1511
|
/** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
|
package/package.json
CHANGED
|
@@ -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", "0.8.0", "0.9.0", "0.10.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", "0.9.0", "0.10.0", "0.11.0"],
|
|
14
14
|
"description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
|
|
15
15
|
},
|
|
16
16
|
"agent": {
|
|
@@ -410,8 +410,8 @@
|
|
|
410
410
|
"x-calls-per-request-boundaries": [0, 1, 2, 5, 10, 20, 50],
|
|
411
411
|
"properties": {
|
|
412
412
|
"kind": {
|
|
413
|
-
"enum": ["postgres", "mysql", "mongodb", "redis", "http"],
|
|
414
|
-
"description": "What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`)."
|
|
413
|
+
"enum": ["postgres", "mysql", "sqlite", "mongodb", "redis", "http"],
|
|
414
|
+
"description": "What kind of dependency this is. `mongodb` since 0.10.0: a MongoDB database, whose commands are operations of kind `query` named by the command and the collection (`find users`). `sqlite` since 0.11.0: a SQLite database in the process, one dependency with an empty `target`, whose statements are operations of kind `query`."
|
|
415
415
|
},
|
|
416
416
|
"target": {
|
|
417
417
|
"type": "string",
|
|
@@ -594,6 +594,18 @@
|
|
|
594
594
|
"pg": {
|
|
595
595
|
"$ref": "#/$defs/ObserverState"
|
|
596
596
|
},
|
|
597
|
+
"mysql": {
|
|
598
|
+
"$ref": "#/$defs/ObserverState",
|
|
599
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
600
|
+
},
|
|
601
|
+
"sqlite": {
|
|
602
|
+
"$ref": "#/$defs/ObserverState",
|
|
603
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
604
|
+
},
|
|
605
|
+
"mongodb": {
|
|
606
|
+
"$ref": "#/$defs/ObserverState",
|
|
607
|
+
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
608
|
+
},
|
|
597
609
|
"http": {
|
|
598
610
|
"$ref": "#/$defs/ObserverState"
|
|
599
611
|
},
|
|
@@ -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", "0.8.0", "0.9.0", "0.10.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", "0.9.0", "0.10.0", "0.11.0"]
|
|
15
15
|
},
|
|
16
16
|
"instance": {
|
|
17
17
|
"type": "object",
|