@downtrace/protocol 0.4.0 → 0.5.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
@@ -4,7 +4,7 @@ The ingestion contract between Downtrace agents and the Downtrace cloud, as a JS
4
4
 
5
5
  - `schema/v0/aggregates.schema.json` — the contract. Everything else derives from it.
6
6
  - `schema/v0/fixtures/{valid,invalid}/` — examples every implementation must accept and reject.
7
- - Exports: `PROTOCOL_VERSION`, `AGGREGATES_PATH`, `AGGREGATES_SCHEMA_V0`, `LATENCY_BOUNDARIES_V0`, `LATENCY_BUCKETS_V0`, `latencyBucket()`, `CALLS_PER_REQUEST_BOUNDARIES_V0`, `CALLS_PER_REQUEST_BUCKETS_V0`, `callsPerRequestBucket()`, and the types `AggregatesBatch`, `Interval`, `Endpoint`, `LatencyHistogram`, `Dependency`, `PostgresStats`, …
7
+ - Exports: `PROTOCOL_VERSION`, `ACCEPTED_PROTOCOL_VERSIONS_V0`, `AGGREGATES_PATH`, `AGGREGATES_SCHEMA_V0`, `LATENCY_BOUNDARIES_V0`, `LATENCY_BUCKETS_V0`, `latencyBucket()`, `CALLS_PER_REQUEST_BOUNDARIES_V0`, `CALLS_PER_REQUEST_BUCKETS_V0`, `callsPerRequestBucket()`, and the types `AggregatesBatch`, `Interval`, `Endpoint`, `LatencyHistogram`, `Dependency`, `PostgresStats`, …
8
8
 
9
9
  ## v0 in one sentence
10
10
 
@@ -16,7 +16,9 @@ Since **0.2.0** an endpoint may also carry `postgres`: how many queries each req
16
16
 
17
17
  ## How the protocol changes
18
18
 
19
- 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-queries-per-request-boundaries`), so they are part of the generated contract rather than a constant someone has to keep in sync.
19
+ **The package version is the protocol version.** `@downtrace/protocol@0.5.0` speaks protocol `0.5.0`, and CI refuses to publish a release where the two disagree, so you can read the contract off the version in your lockfile. A release that changes the package without touching the contract moves the patch segment only.
20
+
21
+ 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, so they are part of the generated contract rather than a constant someone has to keep in sync.
20
22
 
21
23
  ## Source
22
24
 
package/dist/index.d.ts CHANGED
@@ -215,12 +215,13 @@ declare const CALLS_PER_REQUEST_BOUNDARIES_V0: readonly number[];
215
215
  /** Number of calls-per-request buckets: boundaries + 1 open-ended bucket. */
216
216
  declare const CALLS_PER_REQUEST_BUCKETS_V0 = 8;
217
217
  //#endregion
218
- //#region src/index.d.ts
219
- /**
220
- * Version of the ingestion protocol this package speaks. Every published minor of v0 stays acceptable to the
221
- * cloud, so an agent on an older minor keeps working: fields are only ever added, and always optional (ADR 0008).
222
- */
218
+ //#region src/generated/versions.d.ts
219
+ /** Every published minor of v0, oldest first. The cloud never stops accepting one it published (ADR 0008). */
220
+ declare const ACCEPTED_PROTOCOL_VERSIONS_V0: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0"];
221
+ /** The newest published minor: what an up-to-date agent stamps on every batch. */
223
222
  declare const PROTOCOL_VERSION = "0.5.0";
223
+ //#endregion
224
+ //#region src/index.d.ts
224
225
  /** Path, relative to the ingest URL, that receives AggregatesBatch payloads. */
225
226
  declare const AGGREGATES_PATH = "/v0/aggregates";
226
227
  /** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
@@ -595,4 +596,4 @@ declare function latencyBucket(ms: number): number;
595
596
  /** Index of the bucket a call count falls into: first boundary >= count, else the open-ended last bucket. */
596
597
  declare function callsPerRequestBucket(calls: number): number;
597
598
  //#endregion
598
- export { AGGREGATES_PATH, AGGREGATES_SCHEMA_V0, type AgentInfo, type AggregatesBatch, CALLS_PER_REQUEST_BOUNDARIES_V0, CALLS_PER_REQUEST_BUCKETS_V0, type Dependency, type DeployInfo, type Endpoint, type InstanceInfo, type Interval, LATENCY_BOUNDARIES_V0, LATENCY_BUCKETS_V0, type LatencyHistogram, PROTOCOL_VERSION, type PostgresStats, type RuntimeHealth, type StatusClasses, callsPerRequestBucket, latencyBucket };
599
+ export { ACCEPTED_PROTOCOL_VERSIONS_V0, AGGREGATES_PATH, AGGREGATES_SCHEMA_V0, type AgentInfo, type AggregatesBatch, CALLS_PER_REQUEST_BOUNDARIES_V0, CALLS_PER_REQUEST_BUCKETS_V0, type Dependency, type DeployInfo, type Endpoint, type InstanceInfo, type Interval, LATENCY_BOUNDARIES_V0, LATENCY_BUCKETS_V0, type LatencyHistogram, PROTOCOL_VERSION, type PostgresStats, type RuntimeHealth, type StatusClasses, callsPerRequestBucket, latencyBucket };
package/dist/index.js CHANGED
@@ -515,12 +515,19 @@ const CALLS_PER_REQUEST_BOUNDARIES_V0 = [
515
515
  /** Number of calls-per-request buckets: boundaries + 1 open-ended bucket. */
516
516
  const CALLS_PER_REQUEST_BUCKETS_V0 = 8;
517
517
  //#endregion
518
- //#region src/index.ts
519
- /**
520
- * Version of the ingestion protocol this package speaks. Every published minor of v0 stays acceptable to the
521
- * cloud, so an agent on an older minor keeps working: fields are only ever added, and always optional (ADR 0008).
522
- */
518
+ //#region src/generated/versions.ts
519
+ /** Every published minor of v0, oldest first. The cloud never stops accepting one it published (ADR 0008). */
520
+ const ACCEPTED_PROTOCOL_VERSIONS_V0 = [
521
+ "0.1.0",
522
+ "0.2.0",
523
+ "0.3.0",
524
+ "0.4.0",
525
+ "0.5.0"
526
+ ];
527
+ /** The newest published minor: what an up-to-date agent stamps on every batch. */
523
528
  const PROTOCOL_VERSION = "0.5.0";
529
+ //#endregion
530
+ //#region src/index.ts
524
531
  /** Path, relative to the ingest URL, that receives AggregatesBatch payloads. */
525
532
  const AGGREGATES_PATH = "/v0/aggregates";
526
533
  /** The JSON Schema (draft 2020-12) for AggregatesBatch, for validators on either side. */
@@ -544,4 +551,4 @@ function callsPerRequestBucket(calls) {
544
551
  return n;
545
552
  }
546
553
  //#endregion
547
- export { AGGREGATES_PATH, AGGREGATES_SCHEMA_V0, CALLS_PER_REQUEST_BOUNDARIES_V0, CALLS_PER_REQUEST_BUCKETS_V0, LATENCY_BOUNDARIES_V0, LATENCY_BUCKETS_V0, PROTOCOL_VERSION, callsPerRequestBucket, latencyBucket };
554
+ export { ACCEPTED_PROTOCOL_VERSIONS_V0, AGGREGATES_PATH, AGGREGATES_SCHEMA_V0, CALLS_PER_REQUEST_BOUNDARIES_V0, CALLS_PER_REQUEST_BUCKETS_V0, LATENCY_BOUNDARIES_V0, LATENCY_BUCKETS_V0, PROTOCOL_VERSION, callsPerRequestBucket, latencyBucket };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@downtrace/protocol",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Downtrace ingestion protocol: JSON Schema, fixtures and generated TypeScript types",
5
5
  "type": "module",
6
6
  "exports": {