@downtrace/protocol 0.9.0 → 0.10.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
@@ -56,10 +56,12 @@ And still protocol **0.9.0**, a capture's `coverage` may carry `shed`: `{ "ms":
56
56
 
57
57
  And still protocol **0.9.0**, `agent` may carry `errorSources`: `{ "inRequest": [...], "outsideRequest": [...] }` — which of the sources of error the process has **connected**, as of the moment the batch is sealed. `inRequest` holds the values of `Operation.kind` that are errors — `error`, `framework`, `explicit` — and `outsideRequest` the values of `ProcessException.kind` — `uncaught`, `unhandled-rejection`, `framework`, `explicit`. A value is on its list when the process has, at that moment, the instrumentation that produces it installed; the application calling `captureException` does not make it one without the hook connected. Both lists are required when the field is present, and no value appears twice. **Absent is «did not declare»**, exactly as with `observers`: an older sender says nothing, and that is not the same as the two lists left empty, which are a statement — the sender says it has connected no source of error. It exists because the protocol only bounds what a batch can carry from above: an instrumentation that speaks a protocol and does not send everything it carries has no other way to say so, and a reader that attributed to it the kinds its protocol allows would be saying what it does not send.
58
58
 
59
- And still protocol **0.9.0**, a captured request may carry `dependenciesTruncated`: its list of dependencies did not fit and was truncated to what the register keeps per request, and the capture's `coverage` counts such rows in its own `dependenciesTruncated`, beside `truncated` and `detailLost`. It is the mark that keeps a row that entered a capture of a dependency because its list did not fit from reading as a complete one: a dependency that is not in the list is not proven not to have been used, and `truncated` means operations, so the row says it in a field of its own. Absent means false, as with the other two: a sender older than the field sends nothing, and an evidence without the mark is as valid as it was.
59
+ And still protocol **0.9.0**, a captured request may carry `dependenciesTruncated`: its list of dependencies did not fit and was truncated to what the register keeps per request, and the capture's `coverage` counts such rows in its own `dependenciesTruncated`, beside `truncated` and `detailLost`. It is the mark that keeps a row that entered a capture of a dependency because its list did not fit from reading as a complete one: a dependency that is not in the list is not proven not to have been used, and `truncated` means operations, so the row says it in a field of its own. Absent means false, as with the other two: a sender older than the field sends nothing, and an evidence without the mark is as valid as it was. The count is said at zero too; an evidence of protocol 0.9.0 or later without it counts zero, because `@downtrace/agent` 0.9.0 omitted it at zero, and one of an earlier protocol did not say.
60
60
 
61
61
  And still protocol **0.9.0**, an operation may be an **outgoing HTTP call** or a **Redis command**: `Operation.kind` gains `call`, identified by its method and its host, and `command`, identified by its name and its server, beside `query` as the things a route ran. Their text is a word and the place it went — `POST api.stripe.com`, `HGETALL cache:6379` — and never a path, a query string, a key or an argument: the schema refuses a label with anything after the place, or a slash, a question mark or a hash in it, and the text is absent in minimal mode or when the dependency's name is withheld, with the hash still the identity. Which kinds are errors is said beside the enum as `x-error`, one boolean per value: `error`, `framework` and `explicit` are, the three things a route ran are not, and `errorSources.inRequest` takes exactly the ones that are. A captured operation may say its `kind` too, from the same enum. **Absent there means the sender did not say**, never a query: an instrumentation older than this wrote every operation it recorded into the black box without one, the error signature beside a failed query among them, so a reader that took them for queries would be naming what it was not told.
62
62
 
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
+
63
65
  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.
64
66
 
65
67
  ## Source
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ interface AggregatesBatch {
26
26
  /**
27
27
  * Protocol version this batch conforms to. Every published minor of v0 stays acceptable.
28
28
  */
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";
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";
30
30
  agent: AgentInfo;
31
31
  instance: InstanceInfo;
32
32
  deploy: DeployInfo;
@@ -181,7 +181,7 @@ interface Interval {
181
181
  interface Endpoint {
182
182
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "OTHER";
183
183
  /**
184
- * Normalised route template, e.g. /products/:id, or (other).
184
+ * Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56).
185
185
  */
186
186
  route: string;
187
187
  count: number;
@@ -260,9 +260,9 @@ interface PostgresStats {
260
260
  */
261
261
  interface Dependency {
262
262
  /**
263
- * What kind of dependency this is.
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`).
264
264
  */
265
- kind: "postgres" | "mysql" | "redis" | "http";
265
+ kind: "postgres" | "mysql" | "mongodb" | "redis" | "http";
266
266
  /**
267
267
  * Host for outgoing HTTP (`api.stripe.com`); empty when the dependency is a single one, like the application's own database.
268
268
  */
@@ -350,7 +350,7 @@ interface Profile {
350
350
  interface ProfileEndpoint {
351
351
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "OTHER";
352
352
  /**
353
- * Normalised route template, e.g. /products/:id, or (other).
353
+ * Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56).
354
354
  */
355
355
  route: string;
356
356
  /**
@@ -371,7 +371,7 @@ interface Operation {
371
371
  */
372
372
  hash: string;
373
373
  /**
374
- * Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none.
374
+ * Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `find users` for a MongoDB command — its name and its collection, never the filter or the documents —, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none.
375
375
  */
376
376
  text?: string;
377
377
  /**
@@ -483,7 +483,7 @@ declare const DEPENDENCIES_MAX_ITEMS_V0 = 64;
483
483
  /** The most requests a capture's evidence may carry: the ring is sized as this minus the reserves' room (gh-901). */
484
484
  declare const EVIDENCE_REQUESTS_MAX_ITEMS_V0 = 4096;
485
485
  /** The dependency kinds the schema names, in the order it names them. */
486
- declare const DEPENDENCY_KINDS_V0: readonly ["postgres", "mysql", "redis", "http"];
486
+ declare const DEPENDENCY_KINDS_V0: readonly ["postgres", "mysql", "mongodb", "redis", "http"];
487
487
  //#endregion
488
488
  //#region src/generated/capture-evidence.d.ts
489
489
  /**
@@ -493,7 +493,7 @@ interface CaptureEvidence {
493
493
  /**
494
494
  * Protocol version this payload conforms to. Same enum as a batch: every published minor of v0 stays acceptable.
495
495
  */
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";
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";
497
497
  /**
498
498
  * 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
499
  */
@@ -542,7 +542,7 @@ interface CaptureCoverage {
542
542
  truncated: number;
543
543
  shed?: Shed;
544
544
  /**
545
- * Requests whose list of dependencies was truncated. Their count is real and their list is not complete.
545
+ * Requests whose list of dependencies was truncated. Their count is real and their list is not complete. A sender that knows the field sends it, zero included. Absent in an evidence of protocol 0.9.0 or later is zero: @downtrace/agent 0.9.0 omitted it at zero. Absent in an earlier protocol is a sender older than the field, which did not say, and that is not none.
546
546
  */
547
547
  dependenciesTruncated?: number;
548
548
  }
@@ -766,9 +766,9 @@ interface PendingCapture {
766
766
  //#endregion
767
767
  //#region src/generated/versions.d.ts
768
768
  /** 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"];
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"];
770
770
  /** The newest published minor: what an up-to-date agent stamps on every batch. */
771
- declare const PROTOCOL_VERSION = "0.9.0";
771
+ declare const PROTOCOL_VERSION = "0.10.0";
772
772
  //#endregion
773
773
  //#region src/index.d.ts
774
774
  /** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
package/dist/index.js CHANGED
@@ -26,7 +26,8 @@ var aggregates_schema_default = {
26
26
  "0.6.0",
27
27
  "0.7.0",
28
28
  "0.8.0",
29
- "0.9.0"
29
+ "0.9.0",
30
+ "0.10.0"
30
31
  ],
31
32
  "description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
32
33
  },
@@ -256,7 +257,7 @@ var aggregates_schema_default = {
256
257
  "type": "string",
257
258
  "minLength": 1,
258
259
  "maxLength": 256,
259
- "description": "Normalised route template, e.g. /products/:id, or (other)."
260
+ "description": "Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56)."
260
261
  },
261
262
  "count": {
262
263
  "type": "integer",
@@ -500,10 +501,11 @@ var aggregates_schema_default = {
500
501
  "enum": [
501
502
  "postgres",
502
503
  "mysql",
504
+ "mongodb",
503
505
  "redis",
504
506
  "http"
505
507
  ],
506
- "description": "What kind of dependency this is."
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`)."
507
509
  },
508
510
  "target": {
509
511
  "type": "string",
@@ -591,7 +593,7 @@ var aggregates_schema_default = {
591
593
  "type": "string",
592
594
  "minLength": 1,
593
595
  "maxLength": 256,
594
- "description": "Normalised route template, e.g. /products/:id, or (other)."
596
+ "description": "Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56)."
595
597
  },
596
598
  "operations": {
597
599
  "type": "array",
@@ -647,7 +649,7 @@ var aggregates_schema_default = {
647
649
  "text": {
648
650
  "type": "string",
649
651
  "maxLength": 1024,
650
- "description": "Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none."
652
+ "description": "Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `find users` for a MongoDB command — its name and its collection, never the filter or the documents —, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none."
651
653
  },
652
654
  "count": {
653
655
  "type": "integer",
@@ -943,7 +945,8 @@ var capture_evidence_schema_default = {
943
945
  "0.6.0",
944
946
  "0.7.0",
945
947
  "0.8.0",
946
- "0.9.0"
948
+ "0.9.0",
949
+ "0.10.0"
947
950
  ]
948
951
  },
949
952
  "instance": {
@@ -1024,7 +1027,7 @@ var capture_evidence_schema_default = {
1024
1027
  "dependenciesTruncated": {
1025
1028
  "type": "integer",
1026
1029
  "minimum": 0,
1027
- "description": "Requests whose list of dependencies was truncated. Their count is real and their list is not complete."
1030
+ "description": "Requests whose list of dependencies was truncated. Their count is real and their list is not complete. A sender that knows the field sends it, zero included. Absent in an evidence of protocol 0.9.0 or later is zero: @downtrace/agent 0.9.0 omitted it at zero. Absent in an earlier protocol is a sender older than the field, which did not say, and that is not none."
1028
1031
  }
1029
1032
  }
1030
1033
  },
@@ -1465,6 +1468,7 @@ const EVIDENCE_REQUESTS_MAX_ITEMS_V0 = 4096;
1465
1468
  const DEPENDENCY_KINDS_V0 = [
1466
1469
  "postgres",
1467
1470
  "mysql",
1471
+ "mongodb",
1468
1472
  "redis",
1469
1473
  "http"
1470
1474
  ];
@@ -1480,10 +1484,11 @@ const ACCEPTED_PROTOCOL_VERSIONS_V0 = [
1480
1484
  "0.6.0",
1481
1485
  "0.7.0",
1482
1486
  "0.8.0",
1483
- "0.9.0"
1487
+ "0.9.0",
1488
+ "0.10.0"
1484
1489
  ];
1485
1490
  /** The newest published minor: what an up-to-date agent stamps on every batch. */
1486
- const PROTOCOL_VERSION = "0.9.0";
1491
+ const PROTOCOL_VERSION = "0.10.0";
1487
1492
  //#endregion
1488
1493
  //#region src/index.ts
1489
1494
  /** 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.9.0",
3
+ "version": "0.10.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", "0.8.0", "0.9.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"],
14
14
  "description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
15
15
  },
16
16
  "agent": {
@@ -225,7 +225,7 @@
225
225
  "type": "string",
226
226
  "minLength": 1,
227
227
  "maxLength": 256,
228
- "description": "Normalised route template, e.g. /products/:id, or (other)."
228
+ "description": "Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56)."
229
229
  },
230
230
  "count": {
231
231
  "type": "integer",
@@ -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", "redis", "http"],
414
- "description": "What kind of dependency this is."
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`)."
415
415
  },
416
416
  "target": {
417
417
  "type": "string",
@@ -486,7 +486,7 @@
486
486
  "type": "string",
487
487
  "minLength": 1,
488
488
  "maxLength": 256,
489
- "description": "Normalised route template, e.g. /products/:id, or (other)."
489
+ "description": "Normalised route template, e.g. /products/:id, or a name that is not a route: (other), what the interval's cap on routes left out, or (unmatched), the requests that no route of the framework named (DT-56)."
490
490
  },
491
491
  "operations": {
492
492
  "type": "array",
@@ -532,7 +532,7 @@
532
532
  "text": {
533
533
  "type": "string",
534
534
  "maxLength": 1024,
535
- "description": "Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none."
535
+ "description": "Normalised text, e.g. `SELECT id FROM products WHERE id = ?` for a query, `find users` for a MongoDB command — its name and its collection, never the filter or the documents —, `POST api.stripe.com` for a call and `HGETALL cache:6379` for a command. A call's and a command's are a word and the place it went — the method and the host, the command's name and its server — and never a path, a query string, a key or an argument (invariant 5): the schema refuses one with anything after the place, or a slash, a question mark or a hash in it. Optional: a user who would rather not send it keeps the whole analysis, only without the label, and a sender in minimal mode, or one withholding the name of the dependency, sends none."
536
536
  },
537
537
  "count": {
538
538
  "type": "integer",
@@ -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"]
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"]
15
15
  },
16
16
  "instance": {
17
17
  "type": "object",
@@ -96,7 +96,7 @@
96
96
  "dependenciesTruncated": {
97
97
  "type": "integer",
98
98
  "minimum": 0,
99
- "description": "Requests whose list of dependencies was truncated. Their count is real and their list is not complete."
99
+ "description": "Requests whose list of dependencies was truncated. Their count is real and their list is not complete. A sender that knows the field sends it, zero included. Absent in an evidence of protocol 0.9.0 or later is zero: @downtrace/agent 0.9.0 omitted it at zero. Absent in an earlier protocol is a sender older than the field, which did not say, and that is not none."
100
100
  }
101
101
  }
102
102
  },