@downtrace/protocol 0.11.0 → 0.12.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 +14 -5
- package/dist/index.js +12 -5
- package/package.json +1 -1
- package/schema/v0/aggregates.schema.json +19 -2
- package/schema/v0/capture-evidence.schema.json +14 -1
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ And since **0.10.0** a dependency may be of kind **`mongodb`**: a MongoDB databa
|
|
|
64
64
|
|
|
65
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
66
|
|
|
67
|
+
And since **0.12.0** `observers` has a `prisma` switch: Prisma's client, observed through the client and not through a driver, for Prisma before 7 on its own engine. Its operations are operations of kind `query` of the dependency its datasource is — `postgres` for Postgres and CockroachDB, `mysql`, `sqlite`, `mongodb` — with an empty `target`, labelled by two words, the action and the model (`findMany Post`, `create User`), and never the arguments; a raw query is labelled by its SQL, normalised as that dependency's dialect reads it. A client given a driver adapter is not counted by it: its driver's observer counts the SQL.
|
|
68
|
+
|
|
67
69
|
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.
|
|
68
70
|
|
|
69
71
|
## Source
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ type ObserverState2 = "on" | "off" | "unavailable";
|
|
|
23
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
24
|
*/
|
|
25
25
|
type ObserverState3 = "on" | "off" | "unavailable";
|
|
26
|
+
/**
|
|
27
|
+
* 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).
|
|
28
|
+
*/
|
|
29
|
+
type ObserverState4 = "on" | "off" | "unavailable";
|
|
26
30
|
/**
|
|
27
31
|
* 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.
|
|
28
32
|
*/
|
|
@@ -38,7 +42,7 @@ interface AggregatesBatch {
|
|
|
38
42
|
/**
|
|
39
43
|
* Protocol version this batch conforms to. Every published minor of v0 stays acceptable.
|
|
40
44
|
*/
|
|
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";
|
|
45
|
+
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" | "0.12.0";
|
|
42
46
|
agent: AgentInfo;
|
|
43
47
|
instance: InstanceInfo;
|
|
44
48
|
deploy: DeployInfo;
|
|
@@ -91,6 +95,7 @@ interface Observers {
|
|
|
91
95
|
mysql?: ObserverState1;
|
|
92
96
|
sqlite?: ObserverState2;
|
|
93
97
|
mongodb?: ObserverState3;
|
|
98
|
+
prisma?: ObserverState4;
|
|
94
99
|
http?: ObserverState;
|
|
95
100
|
redis?: ObserverState;
|
|
96
101
|
runtime?: ObserverState;
|
|
@@ -275,7 +280,7 @@ interface PostgresStats {
|
|
|
275
280
|
*/
|
|
276
281
|
interface Dependency {
|
|
277
282
|
/**
|
|
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`.
|
|
283
|
+
* 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`. Since 0.12.0 a Prisma client's operation is an operation of kind `query` of the dependency its datasource is, with an empty `target`, named by the action and the model (`findMany Post`), or by its SQL for a raw query.
|
|
279
284
|
*/
|
|
280
285
|
kind: "postgres" | "mysql" | "sqlite" | "mongodb" | "redis" | "http";
|
|
281
286
|
/**
|
|
@@ -508,7 +513,7 @@ interface CaptureEvidence {
|
|
|
508
513
|
/**
|
|
509
514
|
* Protocol version this payload conforms to. Same enum as a batch: every published minor of v0 stays acceptable.
|
|
510
515
|
*/
|
|
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";
|
|
516
|
+
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" | "0.12.0";
|
|
512
517
|
/**
|
|
513
518
|
* 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.
|
|
514
519
|
*/
|
|
@@ -781,9 +786,9 @@ interface PendingCapture {
|
|
|
781
786
|
//#endregion
|
|
782
787
|
//#region src/generated/versions.d.ts
|
|
783
788
|
/** Every published minor of v0, oldest first. The cloud never stops accepting one it published (ADR 0008). */
|
|
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"];
|
|
789
|
+
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", "0.12.0"];
|
|
785
790
|
/** The newest published minor: what an up-to-date agent stamps on every batch. */
|
|
786
|
-
declare const PROTOCOL_VERSION = "0.
|
|
791
|
+
declare const PROTOCOL_VERSION = "0.12.0";
|
|
787
792
|
//#endregion
|
|
788
793
|
//#region src/index.d.ts
|
|
789
794
|
/** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
|
|
@@ -1397,6 +1402,10 @@ declare const AGGREGATES_SCHEMA_V0: {
|
|
|
1397
1402
|
$ref: string;
|
|
1398
1403
|
description: string;
|
|
1399
1404
|
};
|
|
1405
|
+
prisma: {
|
|
1406
|
+
$ref: string;
|
|
1407
|
+
description: string;
|
|
1408
|
+
};
|
|
1400
1409
|
http: {
|
|
1401
1410
|
$ref: string;
|
|
1402
1411
|
};
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,8 @@ var aggregates_schema_default = {
|
|
|
28
28
|
"0.8.0",
|
|
29
29
|
"0.9.0",
|
|
30
30
|
"0.10.0",
|
|
31
|
-
"0.11.0"
|
|
31
|
+
"0.11.0",
|
|
32
|
+
"0.12.0"
|
|
32
33
|
],
|
|
33
34
|
"description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
|
|
34
35
|
},
|
|
@@ -507,7 +508,7 @@ var aggregates_schema_default = {
|
|
|
507
508
|
"redis",
|
|
508
509
|
"http"
|
|
509
510
|
],
|
|
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`."
|
|
511
|
+
"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`. Since 0.12.0 a Prisma client's operation is an operation of kind `query` of the dependency its datasource is, with an empty `target`, named by the action and the model (`findMany Post`), or by its SQL for a raw query."
|
|
511
512
|
},
|
|
512
513
|
"target": {
|
|
513
514
|
"type": "string",
|
|
@@ -726,6 +727,10 @@ var aggregates_schema_default = {
|
|
|
726
727
|
"$ref": "#/$defs/ObserverState",
|
|
727
728
|
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
728
729
|
},
|
|
730
|
+
"prisma": {
|
|
731
|
+
"$ref": "#/$defs/ObserverState",
|
|
732
|
+
"description": "Since 0.12.0. Absent from an older sender, which had no word for it. Prisma's client, whose operations are queries of the dependency its datasource is: a switch of its own because it observes a client and not a driver."
|
|
733
|
+
},
|
|
729
734
|
"http": { "$ref": "#/$defs/ObserverState" },
|
|
730
735
|
"redis": { "$ref": "#/$defs/ObserverState" },
|
|
731
736
|
"runtime": { "$ref": "#/$defs/ObserverState" }
|
|
@@ -961,7 +966,8 @@ var capture_evidence_schema_default = {
|
|
|
961
966
|
"0.8.0",
|
|
962
967
|
"0.9.0",
|
|
963
968
|
"0.10.0",
|
|
964
|
-
"0.11.0"
|
|
969
|
+
"0.11.0",
|
|
970
|
+
"0.12.0"
|
|
965
971
|
]
|
|
966
972
|
},
|
|
967
973
|
"instance": {
|
|
@@ -1502,10 +1508,11 @@ const ACCEPTED_PROTOCOL_VERSIONS_V0 = [
|
|
|
1502
1508
|
"0.8.0",
|
|
1503
1509
|
"0.9.0",
|
|
1504
1510
|
"0.10.0",
|
|
1505
|
-
"0.11.0"
|
|
1511
|
+
"0.11.0",
|
|
1512
|
+
"0.12.0"
|
|
1506
1513
|
];
|
|
1507
1514
|
/** The newest published minor: what an up-to-date agent stamps on every batch. */
|
|
1508
|
-
const PROTOCOL_VERSION = "0.
|
|
1515
|
+
const PROTOCOL_VERSION = "0.12.0";
|
|
1509
1516
|
//#endregion
|
|
1510
1517
|
//#region src/index.ts
|
|
1511
1518
|
/** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
|
package/package.json
CHANGED
|
@@ -10,7 +10,20 @@
|
|
|
10
10
|
"properties": {
|
|
11
11
|
"protocol": {
|
|
12
12
|
"type": "string",
|
|
13
|
-
"enum": [
|
|
13
|
+
"enum": [
|
|
14
|
+
"0.1.0",
|
|
15
|
+
"0.2.0",
|
|
16
|
+
"0.3.0",
|
|
17
|
+
"0.4.0",
|
|
18
|
+
"0.5.0",
|
|
19
|
+
"0.6.0",
|
|
20
|
+
"0.7.0",
|
|
21
|
+
"0.8.0",
|
|
22
|
+
"0.9.0",
|
|
23
|
+
"0.10.0",
|
|
24
|
+
"0.11.0",
|
|
25
|
+
"0.12.0"
|
|
26
|
+
],
|
|
14
27
|
"description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
|
|
15
28
|
},
|
|
16
29
|
"agent": {
|
|
@@ -411,7 +424,7 @@
|
|
|
411
424
|
"properties": {
|
|
412
425
|
"kind": {
|
|
413
426
|
"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`."
|
|
427
|
+
"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`. Since 0.12.0 a Prisma client's operation is an operation of kind `query` of the dependency its datasource is, with an empty `target`, named by the action and the model (`findMany Post`), or by its SQL for a raw query."
|
|
415
428
|
},
|
|
416
429
|
"target": {
|
|
417
430
|
"type": "string",
|
|
@@ -606,6 +619,10 @@
|
|
|
606
619
|
"$ref": "#/$defs/ObserverState",
|
|
607
620
|
"description": "Since 0.11.0. Absent from an older sender, which had no word for it."
|
|
608
621
|
},
|
|
622
|
+
"prisma": {
|
|
623
|
+
"$ref": "#/$defs/ObserverState",
|
|
624
|
+
"description": "Since 0.12.0. Absent from an older sender, which had no word for it. Prisma's client, whose operations are queries of the dependency its datasource is: a switch of its own because it observes a client and not a driver."
|
|
625
|
+
},
|
|
609
626
|
"http": {
|
|
610
627
|
"$ref": "#/$defs/ObserverState"
|
|
611
628
|
},
|
|
@@ -11,7 +11,20 @@
|
|
|
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": [
|
|
14
|
+
"enum": [
|
|
15
|
+
"0.1.0",
|
|
16
|
+
"0.2.0",
|
|
17
|
+
"0.3.0",
|
|
18
|
+
"0.4.0",
|
|
19
|
+
"0.5.0",
|
|
20
|
+
"0.6.0",
|
|
21
|
+
"0.7.0",
|
|
22
|
+
"0.8.0",
|
|
23
|
+
"0.9.0",
|
|
24
|
+
"0.10.0",
|
|
25
|
+
"0.11.0",
|
|
26
|
+
"0.12.0"
|
|
27
|
+
]
|
|
15
28
|
},
|
|
16
29
|
"instance": {
|
|
17
30
|
"type": "object",
|