@downtrace/protocol 0.6.0 → 0.7.1

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.
Files changed (37) hide show
  1. package/README.md +18 -2
  2. package/dist/index.d.ts +867 -14
  3. package/dist/index.js +570 -17
  4. package/package.json +1 -1
  5. package/schema/v0/aggregates.schema.json +233 -6
  6. package/schema/v0/capture-evidence.schema.json +200 -0
  7. package/schema/v0/fixtures/evidence/invalid/half-a-coverage.json +8 -0
  8. package/schema/v0/fixtures/evidence/invalid/no-coverage.json +7 -0
  9. package/schema/v0/fixtures/evidence/invalid/no-instance.json +7 -0
  10. package/schema/v0/fixtures/evidence/invalid/operation-with-text.json +17 -0
  11. package/schema/v0/fixtures/evidence/invalid/operation-without-hash.json +17 -0
  12. package/schema/v0/fixtures/evidence/invalid/reference-without-selection.json +49 -0
  13. package/schema/v0/fixtures/evidence/invalid/unknown-protocol.json +8 -0
  14. package/schema/v0/fixtures/evidence/valid/complete.json +28 -0
  15. package/schema/v0/fixtures/evidence/valid/no-requests.json +8 -0
  16. package/schema/v0/fixtures/evidence/valid/partial.json +27 -0
  17. package/schema/v0/fixtures/evidence/valid/with-reference.json +75 -0
  18. package/schema/v0/fixtures/invalid/capture-without-a-start.json +50 -0
  19. package/schema/v0/fixtures/invalid/exception-that-did-not-happen.json +52 -0
  20. package/schema/v0/fixtures/invalid/operation-with-class-and-text.json +87 -0
  21. package/schema/v0/fixtures/invalid/runtime-with-nothing-in-it.json +51 -0
  22. package/schema/v0/fixtures/invalid/withholding-with-nothing-in-it.json +46 -0
  23. package/schema/v0/fixtures/response/invalid/capture-without-deadline.json +5 -0
  24. package/schema/v0/fixtures/response/invalid/capture-without-id.json +5 -0
  25. package/schema/v0/fixtures/response/invalid/missing-accepted.json +1 -0
  26. package/schema/v0/fixtures/response/invalid/unknown-field.json +1 -0
  27. package/schema/v0/fixtures/response/invalid/window-of-no-time.json +5 -0
  28. package/schema/v0/fixtures/response/valid/nothing-pending.json +1 -0
  29. package/schema/v0/fixtures/response/valid/one-capture.json +16 -0
  30. package/schema/v0/fixtures/response/valid/re-sent-batch.json +1 -0
  31. package/schema/v0/fixtures/valid/capture-started.json +51 -0
  32. package/schema/v0/fixtures/valid/operation-omitted-with-class.json +86 -0
  33. package/schema/v0/fixtures/valid/process-exceptions.json +58 -0
  34. package/schema/v0/fixtures/valid/profile-without-intervals.json +60 -0
  35. package/schema/v0/fixtures/{invalid/runtime-missing-rss.json → valid/runtime-without-an-event-loop.json} +2 -7
  36. package/schema/v0/fixtures/valid/withholding.json +49 -0
  37. package/schema/v0/ingest-response.schema.json +71 -0
@@ -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"],
13
+ "enum": ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0"],
14
14
  "description": "Protocol version this batch conforms to. Every published minor of v0 stays acceptable."
15
15
  },
16
16
  "agent": {
@@ -24,14 +24,39 @@
24
24
  },
25
25
  "intervals": {
26
26
  "type": "array",
27
- "minItems": 1,
27
+ "minItems": 0,
28
28
  "maxItems": 6,
29
29
  "items": {
30
30
  "$ref": "#/$defs/Interval"
31
- }
31
+ },
32
+ "description": "The intervals this batch carries. May be empty when the batch carries a profile: the profile has a cadence of its own and hangs off the batch, not off an interval (ADR 0017), so tying its delivery to one meant it was lost whenever a window closed with no traffic — at shutdown, always (gh-375). A batch with neither is refused by the cloud with a reason, which the schema cannot say without making the generated types unusable."
32
33
  },
33
34
  "profile": {
34
35
  "$ref": "#/$defs/Profile"
36
+ },
37
+ "captures": {
38
+ "type": "array",
39
+ "maxItems": 16,
40
+ "items": {
41
+ "$ref": "#/$defs/CaptureProgress"
42
+ },
43
+ "description": "Progress on the captures this sender was asked for. Absent from every sender that predates it, and from every batch with nothing to report. Bounded like the answer that carries the orders."
44
+ },
45
+ "exceptions": {
46
+ "type": "array",
47
+ "maxItems": 32,
48
+ "items": {
49
+ "$ref": "#/$defs/ProcessException"
50
+ },
51
+ "description": "Distinct exception signatures this process saw outside any request. Absent from every sender that predates it and from every batch with none. Bounded: a process crashing in a loop must not become an unbounded batch."
52
+ },
53
+ "triggers": {
54
+ "type": "array",
55
+ "maxItems": 4,
56
+ "items": {
57
+ "$ref": "#/$defs/LocalTrigger"
58
+ },
59
+ "description": "Local signals that ask for a capture. `product.md:124` gives the instrumentation «disparar por señales locales»: it sees a process in trouble before any aggregate crosses the cloud, and asking in the batch costs no channel of its own — the answer already carries the orders (ADR 0071). Absent from every sender that predates it and from every batch with nothing to ask. The cloud decides: the same budget, cooldown and concurrency as any other capture (`product.md:122`), and a refusal is silence, because there is nothing the instrumentation would do differently."
35
60
  }
36
61
  },
37
62
  "$defs": {
@@ -58,6 +83,18 @@
58
83
  "type": "string",
59
84
  "minLength": 1,
60
85
  "maxLength": 64
86
+ },
87
+ "observers": {
88
+ "$ref": "#/$defs/Observers",
89
+ "description": "Absent from an instrumentation older than protocol 0.7.0. Absent is not 'nothing is observed': it is 'this one did not say', and the two must not be shown alike."
90
+ },
91
+ "withholding": {
92
+ "$ref": "#/$defs/Withholding",
93
+ "description": "Absent means **this sender did not say**, not that it withholds nothing — the same reading as `observers`, and for the same reason."
94
+ },
95
+ "resources": {
96
+ "$ref": "#/$defs/AgentResources",
97
+ "description": "What the instrumentation costs and what it has lost, measured by itself. Absent means **this sender did not say**, the same reading as `observers` and `withholding`. `product.md:239` asks for it by name: «recursos internos medidos»."
61
98
  }
62
99
  }
63
100
  },
@@ -265,10 +302,9 @@
265
302
  },
266
303
  "RuntimeHealth": {
267
304
  "title": "RuntimeHealth",
268
- "description": "Health of the agent's own process during the interval. Optional: an agent that does not measure it omits it. Per interval, not per route, because it belongs to the process.",
305
+ "description": "What the runtime itself was doing. Every field is optional and at least one has to be there: `product.md:251` says the protocol is independent of the language, and a Go runtime has garbage collection, a heap and a resident set but no event loop. Requiring the six of them meant it could either invent an event loop or send none of the three it does have. An empty object is not a reading, hence the minimum of one (gh-285).",
269
306
  "type": "object",
270
307
  "additionalProperties": false,
271
- "required": ["eventLoopDelayMs", "gcPauseMs", "gcCount", "heapUsedMb", "rssMb", "inFlightMax"],
272
308
  "properties": {
273
309
  "eventLoopDelayMs": {
274
310
  "type": "object",
@@ -318,7 +354,8 @@
318
354
  "minimum": 0,
319
355
  "description": "Peak concurrent in-flight requests during the interval."
320
356
  }
321
- }
357
+ },
358
+ "minProperties": 1
322
359
  },
323
360
  "Dependency": {
324
361
  "title": "Dependency",
@@ -456,6 +493,196 @@
456
493
  "type": "integer",
457
494
  "minimum": 0,
458
495
  "description": "Only on the `(other)` bucket: how many distinct operations it merges, so a cap does not become a lie by omission."
496
+ },
497
+ "class": {
498
+ "enum": ["select", "insert", "update", "delete", "other"],
499
+ "description": "What kind of statement this is, when the sender could not normalise it safely. Its presence is the reason the text is absent: `product.md:104` says a query the normaliser does not understand travels «solo como hash y clase», and this is the class. Never sent together with `text` — they are two answers to the same question. Our word and not the service's: it is decided from the first keyword, which is all that can be told without understanding the rest (gh-344)."
500
+ }
501
+ },
502
+ "not": {
503
+ "required": ["class", "text"],
504
+ "properties": {
505
+ "class": {},
506
+ "text": {}
507
+ }
508
+ }
509
+ },
510
+ "ObserverState": {
511
+ "title": "ObserverState",
512
+ "enum": ["on", "off", "unavailable"],
513
+ "description": "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)."
514
+ },
515
+ "Observers": {
516
+ "title": "Observers",
517
+ "type": "object",
518
+ "additionalProperties": false,
519
+ "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.",
520
+ "properties": {
521
+ "pg": {
522
+ "$ref": "#/$defs/ObserverState"
523
+ },
524
+ "http": {
525
+ "$ref": "#/$defs/ObserverState"
526
+ },
527
+ "redis": {
528
+ "$ref": "#/$defs/ObserverState"
529
+ },
530
+ "runtime": {
531
+ "$ref": "#/$defs/ObserverState"
532
+ }
533
+ }
534
+ },
535
+ "Withholding": {
536
+ "title": "Withholding",
537
+ "type": "object",
538
+ "additionalProperties": false,
539
+ "minProperties": 1,
540
+ "description": "What this sender is deliberately not sending, so that less arriving can be read as a choice rather than as a fault (invariant 14, COB-01). Counts and never names: the name of an excluded endpoint is exactly what the user asked not to send. The cloud cannot verify any of this and does not try — it is what the sender says, and it is shown as such.",
541
+ "properties": {
542
+ "freeText": {
543
+ "type": "boolean",
544
+ "description": "True when the sender is in minimal mode: no query text, no route templates, no dependency hosts, no error messages. Only ever true — a sender that is not in minimal mode leaves it out.",
545
+ "const": true
546
+ },
547
+ "endpoints": {
548
+ "type": "integer",
549
+ "minimum": 1,
550
+ "description": "How many endpoints are excluded. Absent means none are."
551
+ },
552
+ "dependencies": {
553
+ "type": "integer",
554
+ "minimum": 1,
555
+ "description": "How many dependencies are excluded. Absent means none are."
556
+ }
557
+ }
558
+ },
559
+ "CaptureProgress": {
560
+ "title": "CaptureProgress",
561
+ "type": "object",
562
+ "additionalProperties": false,
563
+ "required": ["id", "startedAt"],
564
+ "description": "What the instrumentation has to say about a capture the cloud asked it for. The order travels in the ingest response (ADR 0071) and the answer travels here, on the same cadence and at the same cost: a path of its own would be one more call per capture, and one more thing to authenticate, for a fact that fits in the batch that is already going (gh-378).",
565
+ "properties": {
566
+ "id": {
567
+ "type": "string",
568
+ "minLength": 1,
569
+ "maxLength": 64,
570
+ "description": "The capture's id, as the ingest response gave it. Carries nothing the service wrote."
571
+ },
572
+ "startedAt": {
573
+ "type": "integer",
574
+ "description": "Unix milliseconds when observation **really** started, which CAP-01 keeps apart from when the capture was accepted."
575
+ }
576
+ }
577
+ },
578
+ "ProcessException": {
579
+ "title": "ProcessException",
580
+ "type": "object",
581
+ "additionalProperties": false,
582
+ "required": ["kind", "hash", "count"],
583
+ "description": "Something thrown outside any instrumented operation: an exception nobody caught, or a promise rejected with no `catch`. `product.md:77` asks for «errores **y excepciones**», and these are the two the word «excepciones» names. They live on the batch and not in the profile because they have **no route** — they happen outside a request's life, or after it ended — and filing them under a route that is not theirs would be worse than not having them (gh-341, ADR 0102).",
584
+ "properties": {
585
+ "kind": {
586
+ "enum": ["uncaught", "unhandled-rejection"],
587
+ "description": "Which of the two. Two different failures with two different fixes: counting them together hides which one is happening."
588
+ },
589
+ "hash": {
590
+ "type": "string",
591
+ "minLength": 1,
592
+ "maxLength": 64,
593
+ "description": "Stable identity of the signature, the same shape a query's or an operation error's has (ADR 0017)."
594
+ },
595
+ "text": {
596
+ "type": "string",
597
+ "maxLength": 512,
598
+ "description": "Type, sanitised message and stack signature. Optional and for the same reason as everywhere else: when nothing recognisable survives the sanitising, only the type and the signature travel (ADR 0084). Its absence is not the absence of an exception."
599
+ },
600
+ "count": {
601
+ "type": "integer",
602
+ "minimum": 1,
603
+ "description": "How many times this signature happened. An instant per occurrence would be a row per crash of a process that crashes in a loop; what a reader asks is how many."
604
+ }
605
+ }
606
+ },
607
+ "LocalTrigger": {
608
+ "type": "object",
609
+ "title": "LocalTrigger",
610
+ "additionalProperties": false,
611
+ "required": ["signal", "observedAt"],
612
+ "description": "One local signal, sustained past its threshold. It asks for detail; it does not claim a cause (invariant 7).",
613
+ "properties": {
614
+ "signal": {
615
+ "type": "string",
616
+ "enum": ["event-loop-delay"],
617
+ "description": "Which signal fired. An enum and not free text: the cloud files findings by footprint, and a trigger type nobody can compare is a footprint that never matches. `product.md:114` names the absolute-threshold signals; this is the first of them."
618
+ },
619
+ "observedAt": {
620
+ "type": "integer",
621
+ "minimum": 0,
622
+ "description": "Unix milliseconds when the signal was last seen over its threshold. Milliseconds and not a date string because that is how this contract writes an instant —an interval's `start`, a capture's `startedAt`— and the evidence, which writes dates, is a different payload with different readers."
623
+ },
624
+ "valueMs": {
625
+ "type": "number",
626
+ "minimum": 0,
627
+ "description": "What was measured: the p99 of the event loop delay over the interval that fired."
628
+ },
629
+ "thresholdMs": {
630
+ "type": "number",
631
+ "minimum": 0,
632
+ "description": "The threshold it passed, sent with the value because a number without its threshold cannot be read by anyone who does not have this version of the instrumentation in front of them."
633
+ },
634
+ "intervals": {
635
+ "type": "integer",
636
+ "minimum": 1,
637
+ "description": "How many consecutive intervals it stayed over. More than one is what makes it sustained rather than a spike (`product.md:114`)."
638
+ }
639
+ }
640
+ },
641
+ "AgentResources": {
642
+ "title": "AgentResources",
643
+ "type": "object",
644
+ "additionalProperties": false,
645
+ "description": "The instrumentation's own resources. Every field is optional and **absent is not zero**: an older sender says nothing, and a cloud that read that as «nothing was lost» would be inventing the one answer this exists to stop it inventing (invariant 14). The counters are differences since the previous batch, like everything else here; the two that are instants say so.",
646
+ "properties": {
647
+ "droppedBatches": {
648
+ "type": "integer",
649
+ "minimum": 0,
650
+ "description": "Batches the instrumentation threw away because its queue was full, since the previous batch. This is telemetry that existed and is gone: the number that separates «nothing happened» from «nothing arrived»."
651
+ },
652
+ "rejectedBatches": {
653
+ "type": "integer",
654
+ "minimum": 0,
655
+ "description": "Batches the cloud refused as invalid, since the previous batch. Nothing broke: something was sent wrong."
656
+ },
657
+ "failedBatches": {
658
+ "type": "integer",
659
+ "minimum": 0,
660
+ "description": "Batches that could not be sent —network, timeout, a cloud that was not there— since the previous batch. Not the same as dropped: these are retried, and only become loss if the queue fills."
661
+ },
662
+ "internalErrors": {
663
+ "type": "integer",
664
+ "minimum": 0,
665
+ "description": "Errors inside the instrumentation itself, since the previous batch. It disables itself after enough of them, and a sender that has gone quiet with these climbing is not a quiet service."
666
+ },
667
+ "bufferBytes": {
668
+ "type": "integer",
669
+ "minimum": 0,
670
+ "description": "What the black box's registers have allocated, right now. An instant, and arithmetic rather than a measurement: the rings are preallocated."
671
+ },
672
+ "hookMsPerRequest": {
673
+ "type": "number",
674
+ "minimum": 0,
675
+ "description": "Estimated milliseconds of the instrumentation's own hooks per request. **An estimate**, sampled, and named as one: it is what invariant 3 budgets, and reporting it as an exact measurement would claim a precision the sampling does not have."
676
+ },
677
+ "shed": {
678
+ "type": "string",
679
+ "enum": ["nothing", "fine", "profile"],
680
+ "description": "What the instrumentation has given up because it was costing too much, cheapest loss first. `product.md:241` asks for both halves —«se autolimita» and «lo registra como pérdida de cobertura»— and this is the second. An enum and not free text: it is ours, and it has to be comparable between senders."
681
+ },
682
+ "shedReason": {
683
+ "type": "string",
684
+ "enum": ["latency", "memory"],
685
+ "description": "Why it gave ground. Absent when nothing was given up."
459
686
  }
460
687
  }
461
688
  }
@@ -0,0 +1,200 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://downtrace.io/schema/v0/capture-evidence.schema.json",
4
+ "title": "CaptureEvidence",
5
+ "description": "What an instrumentation sends back for a capture the cloud asked for (POST /v0/captures/{id}/evidence). It is the contents of the black box's fine register, frozen: requests with their operations, in order, with starts and ends. Hashes only — the text of a query never travels here (invariant 5). Its own path and not the aggregates batch, because a batch is what goes out every ten seconds and this is a rare event several orders of magnitude larger.",
6
+ "x-evidence-path": "/v0/captures/{id}/evidence",
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": ["protocol", "instance", "startedAt", "endedAt", "coverage", "requests"],
10
+ "properties": {
11
+ "protocol": {
12
+ "type": "string",
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"]
15
+ },
16
+ "instance": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["id"],
20
+ "description": "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.",
21
+ "properties": {
22
+ "id": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 128
26
+ },
27
+ "hostname": {
28
+ "type": "string",
29
+ "maxLength": 253
30
+ },
31
+ "pid": {
32
+ "type": "integer",
33
+ "minimum": 0
34
+ }
35
+ }
36
+ },
37
+ "startedAt": {
38
+ "type": "string",
39
+ "format": "date-time",
40
+ "description": "The **effective start of observation**, which is the instant CAP-01 insists on keeping apart from the acceptance. It travels with the evidence rather than in a call of its own: a capture that started and never finished should not cost two requests."
41
+ },
42
+ "endedAt": {
43
+ "type": "string",
44
+ "format": "date-time",
45
+ "description": "When the instrumentation stopped watching."
46
+ },
47
+ "coverage": {
48
+ "$ref": "#/$defs/Coverage"
49
+ },
50
+ "requests": {
51
+ "type": "array",
52
+ "maxItems": 4096,
53
+ "items": {
54
+ "$ref": "#/$defs/CapturedRequest"
55
+ },
56
+ "description": "The requests observed, oldest first. An empty array is a real answer and the commonest one: a route nobody called during the window. It means the capture is `empty`, and `product.md:192` is explicit that this must never read as an invitation to ask again unchanged."
57
+ },
58
+ "reference": {
59
+ "$ref": "#/$defs/Reference"
60
+ }
61
+ },
62
+ "$defs": {
63
+ "Coverage": {
64
+ "type": "object",
65
+ "title": "CaptureCoverage",
66
+ "additionalProperties": false,
67
+ "required": ["observedRequests", "attachedRequests", "detailLost", "truncated"],
68
+ "description": "`product.md:192` asks a capture to declare **both** coverages: what it attached from detail still retained, and what it observed from its effective start. Two numbers, never one — a total would hide that half of it is older than the capture.",
69
+ "properties": {
70
+ "observedRequests": {
71
+ "type": "integer",
72
+ "minimum": 0,
73
+ "description": "Requests seen from the effective start onwards."
74
+ },
75
+ "attachedRequests": {
76
+ "type": "integer",
77
+ "minimum": 0,
78
+ "description": "Requests that were already in the register when the capture started, and are attached. Zero is normal: the register may have wrapped, and nothing brings back what was not kept."
79
+ },
80
+ "detailLost": {
81
+ "type": "integer",
82
+ "minimum": 0,
83
+ "description": "Requests whose operations were overwritten before they could be read. Their timing is still true; what is gone is the detail. Reported rather than dropped, because a request with no operations reads as one that ran nothing (invariant 14)."
84
+ },
85
+ "truncated": {
86
+ "type": "integer",
87
+ "minimum": 0,
88
+ "description": "Requests that ran more operations than the register keeps per request. Their count is real and their list is not complete."
89
+ }
90
+ }
91
+ },
92
+ "CapturedRequest": {
93
+ "type": "object",
94
+ "title": "CapturedRequest",
95
+ "additionalProperties": false,
96
+ "required": ["method", "route", "status", "startedAt", "durationMs", "operations"],
97
+ "properties": {
98
+ "method": {
99
+ "type": "string",
100
+ "maxLength": 16
101
+ },
102
+ "route": {
103
+ "type": "string",
104
+ "maxLength": 512,
105
+ "description": "The route template, never the path with its values in it (invariant 5)."
106
+ },
107
+ "status": {
108
+ "type": "integer",
109
+ "minimum": 100,
110
+ "maximum": 599
111
+ },
112
+ "startedAt": {
113
+ "type": "string",
114
+ "format": "date-time",
115
+ "description": "When this request started. Absolute, so requests from two instances can be read side by side."
116
+ },
117
+ "durationMs": {
118
+ "type": "number",
119
+ "minimum": 0
120
+ },
121
+ "operations": {
122
+ "type": "array",
123
+ "maxItems": 256,
124
+ "items": {
125
+ "$ref": "#/$defs/CapturedOperation"
126
+ },
127
+ "description": "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."
128
+ },
129
+ "truncated": {
130
+ "type": "boolean",
131
+ "description": "This request ran more operations than the register keeps per request. Absent means false."
132
+ },
133
+ "detailLost": {
134
+ "type": "boolean",
135
+ "description": "This request's operations were overwritten before they were read. Absent means false. Its timing is still true."
136
+ }
137
+ }
138
+ },
139
+ "CapturedOperation": {
140
+ "type": "object",
141
+ "title": "CapturedOperation",
142
+ "additionalProperties": false,
143
+ "required": ["hash", "startMs", "endMs"],
144
+ "description": "One operation inside a request. Starts and ends and not durations, because the whole reason for capturing detail is order and overlap, which a duration cannot express (ADR 0068).",
145
+ "properties": {
146
+ "hash": {
147
+ "type": "string",
148
+ "minLength": 1,
149
+ "maxLength": 64,
150
+ "description": "The fingerprint's hash. Never the text: the profile is where a sender chooses whether to ship the text of its queries, and this path never carries it (invariant 5, ADR 0017)."
151
+ },
152
+ "startMs": {
153
+ "type": "number",
154
+ "minimum": 0,
155
+ "description": "Milliseconds from the start of its own request."
156
+ },
157
+ "endMs": {
158
+ "type": "number",
159
+ "minimum": 0
160
+ }
161
+ }
162
+ },
163
+ "Reference": {
164
+ "type": "object",
165
+ "title": "ReferenceSamples",
166
+ "additionalProperties": false,
167
+ "required": ["selection", "population", "samples"],
168
+ "description": "A few requests of each endpoint kept as something to compare the captured ones against. `product.md:100`: «Comparar requests degradadas con requests de referencia exige conservar ambas; el detalle fino de hace una hora ya no existe». Being earlier does not certify health, which is why every field here is about how they were chosen and none of them says «healthy».",
169
+ "properties": {
170
+ "selection": {
171
+ "type": "string",
172
+ "enum": ["uniform-reservoir"],
173
+ "description": "How they were chosen. Travels with them because a sample whose selection is unknown cannot support an attribution (ATR-01). `uniform-reservoir`: every request observed of that endpoint had the same chance of being kept, whatever it did — which is what «the fastest N» would not be."
174
+ },
175
+ "population": {
176
+ "type": "integer",
177
+ "minimum": 0,
178
+ "description": "How many requests they were drawn from, over the life of the sending process."
179
+ },
180
+ "routesDropped": {
181
+ "type": "integer",
182
+ "minimum": 0,
183
+ "description": "Endpoints seen that the register had no room for. Counted rather than silently absent: an endpoint with no samples is not an endpoint with no traffic (invariant 14)."
184
+ },
185
+ "renewalPaused": {
186
+ "type": "boolean",
187
+ "description": "True when requests were observed that the register deliberately did not consider. The instrumentation pauses renewal while it is watching a capture, which is the closest it can get to REF-01 from inside the process: it cannot know whether an incident is open, but it knows detail has been asked of it. Absent means false."
188
+ },
189
+ "samples": {
190
+ "type": "array",
191
+ "maxItems": 64,
192
+ "items": {
193
+ "$ref": "#/$defs/CapturedRequest"
194
+ },
195
+ "description": "The kept requests, in the same shape as the captured ones. An empty array is a real answer: a process that has just started has nothing to compare with yet."
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "i-1" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 3 },
7
+ "requests": []
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "i-1" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "requests": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "startedAt": "2026-09-10T10:00:00.000Z",
4
+ "endedAt": "2026-09-10T10:01:00.000Z",
5
+ "coverage": { "observedRequests": 0, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
6
+ "requests": []
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "i-1" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 1, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
7
+ "requests": [
8
+ {
9
+ "method": "GET",
10
+ "route": "/checkout",
11
+ "status": 200,
12
+ "startedAt": "2026-09-10T10:00:03.000Z",
13
+ "durationMs": 10,
14
+ "operations": [{ "hash": "9f2b1c", "text": "SELECT * FROM orders", "startMs": 0, "endMs": 5 }]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "i-1" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 1, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
7
+ "requests": [
8
+ {
9
+ "method": "GET",
10
+ "route": "/checkout",
11
+ "status": 200,
12
+ "startedAt": "2026-09-10T10:00:03.000Z",
13
+ "durationMs": 10,
14
+ "operations": [{ "startMs": 0, "endMs": 5 }]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": {
4
+ "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55",
5
+ "hostname": "web-1",
6
+ "pid": 4242
7
+ },
8
+ "startedAt": "2026-09-10T10:00:00.000Z",
9
+ "endedAt": "2026-09-10T10:01:00.000Z",
10
+ "coverage": {
11
+ "observedRequests": 2,
12
+ "attachedRequests": 0,
13
+ "detailLost": 0,
14
+ "truncated": 0
15
+ },
16
+ "requests": [
17
+ {
18
+ "method": "GET",
19
+ "route": "/checkout",
20
+ "status": 200,
21
+ "startedAt": "2026-09-10T10:00:03.120Z",
22
+ "durationMs": 412.5,
23
+ "operations": [
24
+ {
25
+ "hash": "9f2b1c",
26
+ "startMs": 1.2,
27
+ "endMs": 38.4
28
+ },
29
+ {
30
+ "hash": "9f2b1c",
31
+ "startMs": 38.9,
32
+ "endMs": 74.1
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "method": "GET",
38
+ "route": "/checkout",
39
+ "status": 500,
40
+ "startedAt": "2026-09-10T10:00:41.900Z",
41
+ "durationMs": 88,
42
+ "operations": []
43
+ }
44
+ ],
45
+ "reference": {
46
+ "population": 10,
47
+ "samples": []
48
+ }
49
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "protocol": "9.9.9",
3
+ "instance": { "id": "i-1" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 0, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
7
+ "requests": []
8
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55", "hostname": "web-1", "pid": 4242 },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 2, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
7
+ "requests": [
8
+ {
9
+ "method": "GET",
10
+ "route": "/checkout",
11
+ "status": 200,
12
+ "startedAt": "2026-09-10T10:00:03.120Z",
13
+ "durationMs": 412.5,
14
+ "operations": [
15
+ { "hash": "9f2b1c", "startMs": 1.2, "endMs": 38.4 },
16
+ { "hash": "9f2b1c", "startMs": 38.9, "endMs": 74.1 }
17
+ ]
18
+ },
19
+ {
20
+ "method": "GET",
21
+ "route": "/checkout",
22
+ "status": 500,
23
+ "startedAt": "2026-09-10T10:00:41.900Z",
24
+ "durationMs": 88,
25
+ "operations": []
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "protocol": "0.7.0",
3
+ "instance": { "id": "7d1e9c6a-4f2b-4c1e-9b0a-2f6d3e8a1c55" },
4
+ "startedAt": "2026-09-10T10:00:00.000Z",
5
+ "endedAt": "2026-09-10T10:01:00.000Z",
6
+ "coverage": { "observedRequests": 0, "attachedRequests": 0, "detailLost": 0, "truncated": 0 },
7
+ "requests": []
8
+ }