@hue-run/sdk 0.18.1 → 0.19.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.
@@ -11,9 +11,11 @@ export type RecordValue = ReadableSpan | ReadableLogRecord;
11
11
  * them, reported like any refused request.
12
12
  */
13
13
  export declare const MAX_RATE_LIMIT_HOLD_MILLIS = 60000;
14
- /** How long one export may take with requests of `timeoutMillis` each: its uploads of values over
14
+ /** How long one export may take with requests of `timeoutMillis` each: hashing its values over
15
15
  * the inline limit, its requests, and a hold for a rate-limited receiver on top. Processors and
16
- * providers wait this long for a drain. */
16
+ * providers wait this long for a drain. A drain also waits for the uploads its exports queued,
17
+ * which run beside the requests and end within six timeouts and a minute of being queued, so they
18
+ * fit within the same budget. */
17
19
  export declare function exportBudgetMillis(timeoutMillis: number): number;
18
20
  /**
19
21
  * Rejection of {@link HueClient.flush} and {@link HueClient.shutdown}: telemetry was not fully
@@ -67,7 +69,11 @@ export declare class HueTransport {
67
69
  private logExporter;
68
70
  private closed;
69
71
  private shutdownPromise?;
70
- private flushPromise?;
72
+ /** The latest flush's send of its records; the next flush's send starts after it. */
73
+ private sendPromise?;
74
+ /** Set while a flush sends its records: the processors leave the uploads to that flush, which
75
+ * waits for them after its send, so no flush's send waits behind another's uploads. */
76
+ private sendingRecords;
71
77
  private live;
72
78
  private liveTimer?;
73
79
  private liveSpans;
@@ -83,11 +89,16 @@ export declare class HueTransport {
83
89
  private admissionCuts;
84
90
  private admissionDigests;
85
91
  private admissionInspected;
92
+ private admissionLarge;
86
93
  /** Uploads values over the inline limit apart from their spans; absent when disabled. */
87
94
  private uploader?;
88
95
  /** Bytes of values over the inline limit queued spans hold whole for upload, and each span's. */
89
96
  private heldBytes;
90
97
  private held;
98
+ /** Bytes of each record's charge (its own held values and its staged files) that its queued
99
+ * uploads took over before the record was finished: charged to the uploads alone until they
100
+ * settle or the record is finished. */
101
+ private heldByUploads;
91
102
  private mediaMemo;
92
103
  private media;
93
104
  private logParts;
@@ -97,6 +108,11 @@ export declare class HueTransport {
97
108
  private mediaFinalizer;
98
109
  private uploaded;
99
110
  private uploadFallbacks;
111
+ /** Each export's queued uploads, until they all settle and are reported. */
112
+ private uploadReports;
113
+ /** Settles once every upload report registered so far has: each drain awaits this one promise,
114
+ * so a drain costs the same however many uploads are pending. */
115
+ private uploadsSettled;
100
116
  constructor(options: HueOptions);
101
117
  /**
102
118
  * Advisory records (placeholders) are admitted only while the queue is under a quarter of its
@@ -112,6 +128,15 @@ export declare class HueTransport {
112
128
  /** Holds the staged attachments of a log record being admitted with the queued record, within
113
129
  * the held-value budget; those the budget refuses are counted as not uploaded. */
114
130
  private admitLogParts;
131
+ /** What the held-value budget has room for: values queued records hold and bytes unsettled
132
+ * uploads hold share it. */
133
+ private heldRoom;
134
+ /** An upload `record`'s export queued, as it is queued: flushes and the processors wait for it
135
+ * from now on, and the `shared` bytes it holds of the record's own are charged to the upload
136
+ * alone, so the held-value budget never counts them twice while the export goes on. A charge
137
+ * `released` before the record is finished is handed back to the record, which still holds
138
+ * them. */
139
+ private uploadQueued;
115
140
  /** Registers a span whose staged files are released if it is never exported. */
116
141
  private ownMedia;
117
142
  private mediaIdentity;
@@ -135,15 +160,22 @@ export declare class HueTransport {
135
160
  private endedSpans;
136
161
  private countEnded;
137
162
  /**
138
- * Waits for the processors' and exporters' in-flight work; drain the providers first.
163
+ * Waits for the processors' and exporters' in-flight work, then for the uploads their exports
164
+ * queued; drain the providers first. Only the sends are serialized: a flush sends its records
165
+ * once an earlier flush sent its own, never after that flush's uploads.
139
166
  *
140
167
  * @throws HueExportError when a new non-warning issue was recorded since the previous observation.
141
168
  */
142
169
  flush(): Promise<ExportReport>;
143
- private flushOnce;
170
+ /** Sends what the processors and exporters hold, once the previous flush's send ended. */
171
+ private sendRecords;
172
+ /** Waits for the uploads queued so far; each ends within its lifetime, so this is bounded. */
173
+ private drainUploads;
174
+ private flushReport;
144
175
  /**
145
- * Flushes and stops the processors; records emitted afterwards are dropped and counted. In attach
146
- * mode call it after shutting down the application's providers.
176
+ * Flushes and stops the processors, waits for queued uploads, then ends the uploader; records
177
+ * emitted afterwards are dropped and counted. In attach mode call it after shutting down the
178
+ * application's providers.
147
179
  *
148
180
  * @throws HueExportError when the final flush observed new failures.
149
181
  */