@tinyshed/tinystore 0.2.0-rc.1 → 0.3.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 -2
- package/dist/index.d.ts +1 -1
- package/dist/metrics.d.ts +34 -3
- package/dist/metrics.js +106 -15
- package/dist/wire/protocol.d.ts +44 -3
- package/dist/wire/protocol.js +176 -5
- package/package.json +8 -8
- package/src/index.ts +2 -0
- package/src/metrics.ts +174 -20
- package/src/wire/protocol.ts +186 -5
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ one. Every call, by engine, is in docs/reference/bun.md.
|
|
|
13
13
|
|
|
14
14
|
<!-- /landing:headline -->
|
|
15
15
|
|
|
16
|
-
> **Version 0.
|
|
17
|
-
>
|
|
16
|
+
> **Version 0.3.** Until `1.0`, a minor release may still change the API,
|
|
17
|
+
> and its notes say what changed.
|
|
18
18
|
|
|
19
19
|
The SDK starts a small `tinystore` server next to your program, called the
|
|
20
20
|
sidecar, and talks to it over a local connection, so that several processes
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { Bucket, BucketOptions, Counters, CountersOptions, Entry, Page as K
|
|
|
13
13
|
export type { Allowance, Quota, Rate, RateLimit, RateLimitOptions, WindowUse } from './limits.ts';
|
|
14
14
|
export type { HoldOptions, Lease, Lock, LockOptions, Permit, Semaphore, SemaphoreOptions, Tried, } from './locks.ts';
|
|
15
15
|
export { type ConsoleOut, type Logger, type LoggerOptions, logger } from './logger.ts';
|
|
16
|
-
export { type Aggregate, type AggregateQuery, type Bucket as MetricsBucket, type Buckets, type Condition as MetricsCondition, type Counter, type Damage as MetricsDamage, type Description as MetricsDescription, exponentialBuckets, type Gauge, type GaugeFuncOptions, type Histogram, type HistogramOptions, type InstrumentLabels, type InstrumentOptions, type LabelPage, type Labels, type LabelValue, type Metrics, type NameInfo, type NamePage, type Newest, type Op as MetricsOp, type PageOptions, type Percentile, type PercentileBucket, type Plan, type PrometheusOptions, type Query as MetricsQuery, type Series, type SeriesInput, type SeriesKind, type Timer, type TimerOptions, type Timing, type ValueBucket, type ValuePage, } from './metrics.ts';
|
|
16
|
+
export { type Aggregate, type AggregatePage, type AggregateQuery, type Bucket as MetricsBucket, type Buckets, type Condition as MetricsCondition, type Counter, type Damage as MetricsDamage, type Description as MetricsDescription, exponentialBuckets, type Gauge, type GaugeFuncOptions, type Histogram, type HistogramOptions, type InstrumentLabels, type InstrumentOptions, type LabelPage, type Labels, type LabelValue, type Metrics, type NameInfo, type NamePage, type Newest, type Op as MetricsOp, type PageOptions, type Percentile, type PercentileBucket, type Plan, type PrometheusOptions, type Query as MetricsQuery, type Series, type SeriesInput, type SeriesKind, type SeriesPage, type Timer, type TimerOptions, type Timing, type ValueBucket, type ValuePage, } from './metrics.ts';
|
|
17
17
|
export type { Once, OnceOptions } from './once.ts';
|
|
18
18
|
export type { ColumnType, Query, RowPage, Table, TableOptions, UpsertOptions } from './query.ts';
|
|
19
19
|
export type { Aggregate as EventsAggregate, AllEvents, AppendOptions, Counted, Damage, Event, EventLevel, Events, EventsOptions, Fields, Level, Levels, Lines, NewEvent, Page as EventsPage, PollBatch, Query as EventsQuery, Row as EventsRow, Stats, StoreLoggerOptions, StreamInfo, TailBatch, TailQuery, Top, } from './records.ts';
|
package/dist/metrics.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface Query {
|
|
|
30
30
|
from?: Time | undefined;
|
|
31
31
|
/** the range's end, excluded; now, a sample taken now in the range, unless given */
|
|
32
32
|
to?: Time | undefined;
|
|
33
|
+
/** a page of read or aggregate: this many samples or buckets at most, 100,000 at most; without it, the whole answer or a limit error */
|
|
34
|
+
limit?: number | undefined;
|
|
35
|
+
/** the page after the one whose next this is, read with the same query and limit */
|
|
36
|
+
after?: string | undefined;
|
|
33
37
|
}
|
|
34
38
|
/** A series to write: its samples as [time, value] pairs, or as times and values columns. */
|
|
35
39
|
export interface SeriesInput {
|
|
@@ -60,6 +64,18 @@ export interface Series {
|
|
|
60
64
|
times: Float64Array;
|
|
61
65
|
/** the values, whose bytes keep each one's bits: -0 and a NaN's payload survive */
|
|
62
66
|
values: Float64Array;
|
|
67
|
+
/** a page cut the series here: the page its next reads begins with the rest of it */
|
|
68
|
+
more: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One page of a read: its series, and next while there is more. Walking it
|
|
72
|
+
* with for await gives its series, then those of each page after it, one
|
|
73
|
+
* page held at a time. Without limit it is the whole answer.
|
|
74
|
+
*/
|
|
75
|
+
export interface SeriesPage extends AsyncIterable<Series> {
|
|
76
|
+
series: Series[];
|
|
77
|
+
/** where the page after it begins; absent on the last */
|
|
78
|
+
next?: string;
|
|
63
79
|
}
|
|
64
80
|
/** p and a rank: 'p95', 'p99.9'. The ranks offered are those asked most; any other is written the same way. */
|
|
65
81
|
export type Percentile = 'p50' | 'p75' | 'p90' | 'p95' | 'p99' | 'p99.9' | (`p${number}` & Record<never, never>);
|
|
@@ -117,6 +133,17 @@ export interface Aggregate<O extends Op = Op> {
|
|
|
117
133
|
labels: Labels;
|
|
118
134
|
/** a bucket without samples is left out */
|
|
119
135
|
buckets: Bucket<O>[];
|
|
136
|
+
/** a page cut the group here: the page its next reads begins with the rest of its buckets */
|
|
137
|
+
more: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* One page of an aggregate: its groups, and next while there is more,
|
|
141
|
+
* walked as a SeriesPage is. A page ends between two whole buckets.
|
|
142
|
+
*/
|
|
143
|
+
export interface AggregatePage<O extends Op = Op> extends AsyncIterable<Aggregate<O>> {
|
|
144
|
+
groups: Aggregate<O>[];
|
|
145
|
+
/** where the page after it begins; absent on the last */
|
|
146
|
+
next?: string;
|
|
120
147
|
}
|
|
121
148
|
/** A series' newest sample in the range. */
|
|
122
149
|
export interface Newest {
|
|
@@ -200,15 +227,19 @@ export declare class Metrics {
|
|
|
200
227
|
* await store.metrics.ingestPrometheus(text, { labels: { instance: 'web-1' } })
|
|
201
228
|
*/
|
|
202
229
|
ingestPrometheus(text: string | Uint8Array, options?: PrometheusOptions): Promise<void>;
|
|
203
|
-
/**
|
|
204
|
-
|
|
230
|
+
/**
|
|
231
|
+
* The samples of each series the query finds, in its range: without limit
|
|
232
|
+
* the whole answer, or a limit error naming its bound; with limit a page,
|
|
233
|
+
* which may hold fewer samples than limit and still have next.
|
|
234
|
+
*/
|
|
235
|
+
read(query: Query): Promise<SeriesPage>;
|
|
205
236
|
/** The newest sample of each series the query finds, when it has one in the range. */
|
|
206
237
|
latest(query: Query): Promise<Newest[]>;
|
|
207
238
|
/**
|
|
208
239
|
* The buckets of each group of the series the query finds, each one exact
|
|
209
240
|
* value of op, rounded once; a bucket of count … last has its value.
|
|
210
241
|
*/
|
|
211
|
-
aggregate<O extends Op>(query: AggregateQuery<O>): Promise<
|
|
242
|
+
aggregate<O extends Op>(query: AggregateQuery<O>): Promise<AggregatePage<O>>;
|
|
212
243
|
/** What a read, or an aggregate when given its op, would spend of each bound; it decodes no sample. */
|
|
213
244
|
explain(query: Query & Partial<Omit<AggregateQuery, keyof Query>>): Promise<Plan>;
|
|
214
245
|
/** A page of the names the store holds samples of, in the byte order of their text. */
|
package/dist/metrics.js
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// holds of them; and a program's instruments, whose totals the store keeps.
|
|
5
5
|
// A series' samples travel as two columns, an int64 time and a float64 value
|
|
6
6
|
// a sample, so that every value's bits come back as they were written.
|
|
7
|
-
import { download } from './connection.js';
|
|
8
|
-
import { InvalidError } from './errors.js';
|
|
7
|
+
import { download, pieceOf } from './connection.js';
|
|
8
|
+
import { InvalidError, OutcomeUnknownError } from './errors.js';
|
|
9
9
|
import { Counter, Gauge, Histogram, labelsOf, Timer, } from './instruments.js';
|
|
10
|
+
import { ConnectionLostError } from './session.js';
|
|
10
11
|
import { ms, unixMs } from './time.js';
|
|
11
|
-
import { Empty, MetricsAggregateAsked, MetricsAggregates, MetricsDamages, MetricsDeleted, MetricsDescription, MetricsExposition, MetricsIngest, MetricsLatest, MetricsNameAsked, MetricsNamePage, MetricsPageAsked, MetricsPlan, MetricsQuery, MetricsRead, MetricsSeriesNamed, MetricsTextPage, methods, } from './wire/protocol.js';
|
|
12
|
+
import { Empty, MetricsAggregateAsked, MetricsAggregates, MetricsDamages, MetricsDeleted, MetricsDescription, MetricsExposition, MetricsIngest, MetricsLatest, MetricsNameAsked, MetricsNamePage, MetricsPageAsked, MetricsPiece, MetricsPlan, MetricsQuery, MetricsRead, MetricsSeriesNamed, MetricsTextPage, MetricsUpload, methods, } from './wire/protocol.js';
|
|
12
13
|
export { Counter, exponentialBuckets, Gauge, Histogram, Timer, Timing, } from './instruments.js';
|
|
13
14
|
/**
|
|
14
15
|
* A store's metrics: series by name and labels, their reads and aggregates,
|
|
@@ -43,34 +44,58 @@ export class Metrics {
|
|
|
43
44
|
for (const [label, value] of Object.entries(options.labels ?? {})) {
|
|
44
45
|
labels[label] = String(value);
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
-
text: typeof text === 'string' ? new TextEncoder().encode(text) : text,
|
|
47
|
+
const given = {
|
|
48
48
|
labels,
|
|
49
49
|
at: options.at === undefined ? undefined : unixMs(options.at),
|
|
50
50
|
keep: options.keep === undefined ? undefined : ms(options.keep),
|
|
51
|
+
};
|
|
52
|
+
const bytes = typeof text === 'string' ? new TextEncoder().encode(text) : text;
|
|
53
|
+
await this.#link.run('write', async (connection) => {
|
|
54
|
+
const body = oneMessage(connection, bytes, given);
|
|
55
|
+
if (body !== undefined) {
|
|
56
|
+
await connection.session.call(methods['metrics.ingestPrometheus'], body);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const asked = MetricsUpload.encode({ size: bytes.length, ...given });
|
|
60
|
+
const stream = await connection.session.open(methods['metrics.uploadPrometheus'], asked, false);
|
|
61
|
+
await uploaded(stream, bytes, pieceOf(connection));
|
|
51
62
|
});
|
|
52
|
-
await this.#link.run('write', connection => connection.session.call(methods['metrics.ingestPrometheus'], body));
|
|
53
63
|
}
|
|
54
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The samples of each series the query finds, in its range: without limit
|
|
66
|
+
* the whole answer, or a limit error naming its bound; with limit a page,
|
|
67
|
+
* which may hold fewer samples than limit and still have next.
|
|
68
|
+
*/
|
|
55
69
|
async read(query) {
|
|
56
|
-
const parts = await this.#download('metrics.read', MetricsQuery.encode(queryOf(query)));
|
|
70
|
+
const parts = (await this.#download('metrics.read', MetricsQuery.encode(queryOf(query)))).map(part => MetricsRead.decode(part));
|
|
57
71
|
const series = [];
|
|
58
72
|
let more = false;
|
|
59
|
-
for (const piece of parts.flatMap(part =>
|
|
73
|
+
for (const piece of parts.flatMap(part => part.series ?? [])) {
|
|
60
74
|
const times = timesOf(piece.times ?? new Uint8Array(0));
|
|
61
75
|
const values = valuesOf(piece.values ?? new Uint8Array(0));
|
|
62
76
|
const last = series.at(-1);
|
|
63
77
|
if (more && last !== undefined) {
|
|
64
78
|
last.times = joined(last.times, times);
|
|
65
79
|
last.values = joined(last.values, values);
|
|
80
|
+
last.more = piece.more === true;
|
|
66
81
|
}
|
|
67
82
|
else {
|
|
68
83
|
const kind = (piece.kind ?? 'gauge');
|
|
69
|
-
|
|
84
|
+
const labels = piece.labels ?? {};
|
|
85
|
+
series.push({
|
|
86
|
+
name: piece.name ?? '',
|
|
87
|
+
kind,
|
|
88
|
+
labels,
|
|
89
|
+
times,
|
|
90
|
+
values,
|
|
91
|
+
more: piece.more === true,
|
|
92
|
+
});
|
|
70
93
|
}
|
|
71
94
|
more = piece.more === true;
|
|
72
95
|
}
|
|
73
|
-
|
|
96
|
+
const next = parts.at(-1)?.next;
|
|
97
|
+
const page = next === undefined ? { series } : { series, next };
|
|
98
|
+
return walked(page, at => at.series, after => this.read({ ...query, after }));
|
|
74
99
|
}
|
|
75
100
|
/** The newest sample of each series the query finds, when it has one in the range. */
|
|
76
101
|
async latest(query) {
|
|
@@ -87,21 +112,30 @@ export class Metrics {
|
|
|
87
112
|
* value of op, rounded once; a bucket of count … last has its value.
|
|
88
113
|
*/
|
|
89
114
|
async aggregate(query) {
|
|
90
|
-
const
|
|
115
|
+
const asked = MetricsAggregateAsked.encode(aggregateOf(query));
|
|
116
|
+
const parts = (await this.#download('metrics.aggregate', asked)).map(part => MetricsAggregates.decode(part));
|
|
91
117
|
const groups = [];
|
|
92
118
|
let more = false;
|
|
93
|
-
for (const piece of parts.flatMap(part =>
|
|
119
|
+
for (const piece of parts.flatMap(part => part.groups ?? [])) {
|
|
94
120
|
const buckets = (piece.buckets ?? []).map(bucket => bucketOf(bucket));
|
|
95
121
|
const last = groups.at(-1);
|
|
96
122
|
if (more && last !== undefined) {
|
|
97
123
|
last.buckets.push(...buckets);
|
|
124
|
+
last.more = piece.more === true;
|
|
98
125
|
}
|
|
99
126
|
else {
|
|
100
|
-
groups.push({
|
|
127
|
+
groups.push({
|
|
128
|
+
name: piece.name ?? '',
|
|
129
|
+
labels: piece.labels ?? {},
|
|
130
|
+
buckets,
|
|
131
|
+
more: piece.more === true,
|
|
132
|
+
});
|
|
101
133
|
}
|
|
102
134
|
more = piece.more === true;
|
|
103
135
|
}
|
|
104
|
-
|
|
136
|
+
const next = parts.at(-1)?.next;
|
|
137
|
+
const page = next === undefined ? { groups } : { groups, next };
|
|
138
|
+
return walked(page, at => at.groups, after => this.aggregate({ ...query, after }));
|
|
105
139
|
}
|
|
106
140
|
/** What a read, or an aggregate when given its op, would spend of each bound; it decodes no sample. */
|
|
107
141
|
async explain(query) {
|
|
@@ -248,6 +282,23 @@ export class Metrics {
|
|
|
248
282
|
return got.items.length === 0 ? [got.trailer] : [...got.items, got.trailer];
|
|
249
283
|
}
|
|
250
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* A page that for await walks: its items, then those of each page after it,
|
|
287
|
+
* the next page read only once the walk reaches the end of the one it holds.
|
|
288
|
+
*/
|
|
289
|
+
function walked(page, items, readOn) {
|
|
290
|
+
return Object.assign(page, {
|
|
291
|
+
async *[Symbol.asyncIterator]() {
|
|
292
|
+
for (let at = page;;) {
|
|
293
|
+
yield* items(at);
|
|
294
|
+
if (at.next === undefined) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
at = await readOn(at.next);
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
}
|
|
251
302
|
/** A query as the wire carries it; a condition given as undefined is refused, never left out. */
|
|
252
303
|
function queryOf(query) {
|
|
253
304
|
const where = {};
|
|
@@ -263,6 +314,8 @@ function queryOf(query) {
|
|
|
263
314
|
since: query.since === undefined ? undefined : ms(query.since),
|
|
264
315
|
from: query.from === undefined ? undefined : unixMs(query.from),
|
|
265
316
|
to: query.to === undefined ? undefined : unixMs(query.to),
|
|
317
|
+
limit: query.limit,
|
|
318
|
+
after: query.after,
|
|
266
319
|
};
|
|
267
320
|
}
|
|
268
321
|
function conditionOf(label, condition) {
|
|
@@ -342,6 +395,44 @@ function newSeries(given) {
|
|
|
342
395
|
keep: given.keep === undefined ? undefined : ms(given.keep),
|
|
343
396
|
};
|
|
344
397
|
}
|
|
398
|
+
/** A text's one message, when it fits the body the connection agreed; a longer text goes in pieces. */
|
|
399
|
+
function oneMessage(connection, text, given) {
|
|
400
|
+
const most = connection.session.agreed?.maxBody ?? 0;
|
|
401
|
+
if (text.length > most) {
|
|
402
|
+
return undefined;
|
|
403
|
+
}
|
|
404
|
+
const body = MetricsExposition.encode({ text, ...given });
|
|
405
|
+
return body.length <= most ? body : undefined;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Sends a text's pieces as DATA within the stream's credit, the last ending
|
|
409
|
+
* them, and waits for the store to write it. A connection lost before that
|
|
410
|
+
* last DATA left nothing written, so the text goes again on the next one;
|
|
411
|
+
* lost after it, whether the text was written is unknown.
|
|
412
|
+
*/
|
|
413
|
+
async function uploaded(stream, text, piece) {
|
|
414
|
+
let ending = false;
|
|
415
|
+
try {
|
|
416
|
+
for (let at = 0; !ending; at += piece) {
|
|
417
|
+
ending = at + piece >= text.length;
|
|
418
|
+
await stream.send(MetricsPiece.encode({ bytes: text.subarray(at, at + piece) }), ending);
|
|
419
|
+
}
|
|
420
|
+
// the RESPONSE that began it, then the answer to its last piece
|
|
421
|
+
await stream.next();
|
|
422
|
+
await stream.next();
|
|
423
|
+
}
|
|
424
|
+
catch (err) {
|
|
425
|
+
if (err instanceof ConnectionLostError && !ending) {
|
|
426
|
+
// the store let go of what came and wrote nothing, so the whole text goes again
|
|
427
|
+
throw new ConnectionLostError(err.message, false);
|
|
428
|
+
}
|
|
429
|
+
stream.cancel();
|
|
430
|
+
if (err instanceof ConnectionLostError) {
|
|
431
|
+
throw new OutcomeUnknownError(`the connection was lost as the text was written: ${err.message}`);
|
|
432
|
+
}
|
|
433
|
+
throw err;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
345
436
|
function columnsOf(given) {
|
|
346
437
|
if (given.samples !== undefined) {
|
|
347
438
|
if (given.times !== undefined || given.values !== undefined) {
|
package/dist/wire/protocol.d.ts
CHANGED
|
@@ -97,6 +97,13 @@ export declare const methods: {
|
|
|
97
97
|
readonly 'metrics.flush': 1549;
|
|
98
98
|
readonly 'metrics.instruments': 1550;
|
|
99
99
|
readonly 'metrics.ingestPrometheus': 1551;
|
|
100
|
+
/**
|
|
101
|
+
* Answers its RESPONSE at once; the store's memory for the whole text is
|
|
102
|
+
* taken before a piece is kept, and the last piece is answered once the text
|
|
103
|
+
* is written, every series or none. A cancel or a lost connection leaves
|
|
104
|
+
* nothing written and lets go of what came.
|
|
105
|
+
*/
|
|
106
|
+
readonly 'metrics.uploadPrometheus': 1552;
|
|
100
107
|
readonly 'records.open': 1281;
|
|
101
108
|
readonly 'records.append': 1282;
|
|
102
109
|
readonly 'records.list': 1283;
|
|
@@ -399,6 +406,8 @@ export declare const ConfigOpen: import("./codec.ts").Message<{
|
|
|
399
406
|
readonly layers: readonly [3, import("./codec.ts").Codec<string, string>];
|
|
400
407
|
/** a kept change that no longer fits refuses the open */
|
|
401
408
|
readonly strict: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
|
|
409
|
+
/** as kv.db keeps it, for a command: the last declaration a program opened it with, */
|
|
410
|
+
readonly kept: readonly [5, import("./codec.ts").Codec<boolean, boolean>];
|
|
402
411
|
}>;
|
|
403
412
|
/**
|
|
404
413
|
* Where a value came from: its kind, and only the fields that kind names.
|
|
@@ -1291,6 +1300,10 @@ export declare const MetricsQuery: import("./codec.ts").Message<{
|
|
|
1291
1300
|
readonly from: readonly [4, import("./codec.ts").Codec<number, number>];
|
|
1292
1301
|
/** excluded; now, a sample taken now in the range, unless given */
|
|
1293
1302
|
readonly to: readonly [5, import("./codec.ts").Codec<number, number>];
|
|
1303
|
+
/** a page's samples or buckets at most, 100,000 at most: a page, which read and aggregate take */
|
|
1304
|
+
readonly limit: readonly [6, import("./codec.ts").Codec<number, number>];
|
|
1305
|
+
/** a page's next, with limit */
|
|
1306
|
+
readonly after: readonly [7, import("./codec.ts").Codec<string, string>];
|
|
1294
1307
|
}>;
|
|
1295
1308
|
/**
|
|
1296
1309
|
* A series and its samples, or a part of them: a series longer than a body
|
|
@@ -1305,7 +1318,7 @@ export declare const MetricsSeries: import("./codec.ts").Message<{
|
|
|
1305
1318
|
readonly times: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1306
1319
|
/** a float64 a sample */
|
|
1307
1320
|
readonly values: readonly [5, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1308
|
-
/** the next part goes on with this series */
|
|
1321
|
+
/** the next part goes on with this series; on a page's last, the next page's first */
|
|
1309
1322
|
readonly more: readonly [6, import("./codec.ts").Codec<boolean, boolean>];
|
|
1310
1323
|
}>;
|
|
1311
1324
|
export declare const MetricsRead: import("./codec.ts").Message<{
|
|
@@ -1318,7 +1331,7 @@ export declare const MetricsRead: import("./codec.ts").Message<{
|
|
|
1318
1331
|
readonly times: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1319
1332
|
/** a float64 a sample */
|
|
1320
1333
|
readonly values: readonly [5, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1321
|
-
/** the next part goes on with this series */
|
|
1334
|
+
/** the next part goes on with this series; on a page's last, the next page's first */
|
|
1322
1335
|
readonly more: readonly [6, import("./codec.ts").Codec<boolean, boolean>];
|
|
1323
1336
|
}>[], readonly import("./codec.ts").Written<{
|
|
1324
1337
|
readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
|
|
@@ -1329,9 +1342,11 @@ export declare const MetricsRead: import("./codec.ts").Message<{
|
|
|
1329
1342
|
readonly times: readonly [4, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1330
1343
|
/** a float64 a sample */
|
|
1331
1344
|
readonly values: readonly [5, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1332
|
-
/** the next part goes on with this series */
|
|
1345
|
+
/** the next part goes on with this series; on a page's last, the next page's first */
|
|
1333
1346
|
readonly more: readonly [6, import("./codec.ts").Codec<boolean, boolean>];
|
|
1334
1347
|
}>[]>];
|
|
1348
|
+
/** on the last part of a page that has more, to a request that gave limit */
|
|
1349
|
+
readonly next: readonly [2, import("./codec.ts").Codec<string, string>];
|
|
1335
1350
|
}>;
|
|
1336
1351
|
/**
|
|
1337
1352
|
* A series' newest sample in the range.
|
|
@@ -1376,6 +1391,10 @@ export declare const MetricsAggregateAsked: import("./codec.ts").Message<{
|
|
|
1376
1391
|
readonly from: readonly [4, import("./codec.ts").Codec<number, number>];
|
|
1377
1392
|
/** excluded; now, a sample taken now in the range, unless given */
|
|
1378
1393
|
readonly to: readonly [5, import("./codec.ts").Codec<number, number>];
|
|
1394
|
+
/** a page's samples or buckets at most, 100,000 at most: a page, which read and aggregate take */
|
|
1395
|
+
readonly limit: readonly [6, import("./codec.ts").Codec<number, number>];
|
|
1396
|
+
/** a page's next, with limit */
|
|
1397
|
+
readonly after: readonly [7, import("./codec.ts").Codec<string, string>];
|
|
1379
1398
|
}>];
|
|
1380
1399
|
readonly every: readonly [2, import("./codec.ts").Codec<number, number>];
|
|
1381
1400
|
/** count, sum, avg, min, max, increase, rate, delta, first, last, or p and a rank; none for a read's plan */
|
|
@@ -1446,6 +1465,7 @@ export declare const MetricsGroup: import("./codec.ts").Message<{
|
|
|
1446
1465
|
/** its first step began before the bucket before it */
|
|
1447
1466
|
readonly gap: readonly [9, import("./codec.ts").Codec<boolean, boolean>];
|
|
1448
1467
|
}>[]>];
|
|
1468
|
+
/** the next part goes on with this group; on a page's last, the next page's first */
|
|
1449
1469
|
readonly more: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
|
|
1450
1470
|
}>;
|
|
1451
1471
|
export declare const MetricsAggregates: import("./codec.ts").Message<{
|
|
@@ -1483,6 +1503,7 @@ export declare const MetricsAggregates: import("./codec.ts").Message<{
|
|
|
1483
1503
|
/** its first step began before the bucket before it */
|
|
1484
1504
|
readonly gap: readonly [9, import("./codec.ts").Codec<boolean, boolean>];
|
|
1485
1505
|
}>[]>];
|
|
1506
|
+
/** the next part goes on with this group; on a page's last, the next page's first */
|
|
1486
1507
|
readonly more: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
|
|
1487
1508
|
}>[], readonly import("./codec.ts").Written<{
|
|
1488
1509
|
readonly name: readonly [1, import("./codec.ts").Codec<string, string>];
|
|
@@ -1518,8 +1539,11 @@ export declare const MetricsAggregates: import("./codec.ts").Message<{
|
|
|
1518
1539
|
/** its first step began before the bucket before it */
|
|
1519
1540
|
readonly gap: readonly [9, import("./codec.ts").Codec<boolean, boolean>];
|
|
1520
1541
|
}>[]>];
|
|
1542
|
+
/** the next part goes on with this group; on a page's last, the next page's first */
|
|
1521
1543
|
readonly more: readonly [4, import("./codec.ts").Codec<boolean, boolean>];
|
|
1522
1544
|
}>[]>];
|
|
1545
|
+
/** on the last part of a page that has more, to a request that gave limit */
|
|
1546
|
+
readonly next: readonly [2, import("./codec.ts").Codec<string, string>];
|
|
1523
1547
|
}>;
|
|
1524
1548
|
export declare const MetricsExceeds: import("./codec.ts").Message<{
|
|
1525
1549
|
/** series, bytes read, samples decoded or answer */
|
|
@@ -1583,6 +1607,23 @@ export declare const MetricsExposition: import("./codec.ts").Message<{
|
|
|
1583
1607
|
/** how long each name of the text keeps its samples */
|
|
1584
1608
|
readonly keep: readonly [4, import("./codec.ts").Codec<number, number>];
|
|
1585
1609
|
}>;
|
|
1610
|
+
/**
|
|
1611
|
+
* A text past what one message holds: what metrics.Exposition carries but
|
|
1612
|
+
* the text, whose bytes follow as the client's DATA, a metrics.Piece each.
|
|
1613
|
+
*/
|
|
1614
|
+
export declare const MetricsUpload: import("./codec.ts").Message<{
|
|
1615
|
+
/** the text's bytes, 32 MiB at most: pieces that come to more or fewer are refused */
|
|
1616
|
+
readonly size: readonly [1, import("./codec.ts").Codec<number, number>];
|
|
1617
|
+
readonly labels: readonly [2, import("./codec.ts").Codec<Record<string, string>, Record<string, string>>];
|
|
1618
|
+
readonly at: readonly [3, import("./codec.ts").Codec<number, number>];
|
|
1619
|
+
readonly keep: readonly [4, import("./codec.ts").Codec<number, number>];
|
|
1620
|
+
}>;
|
|
1621
|
+
/**
|
|
1622
|
+
* A piece of an uploaded text, cut anywhere.
|
|
1623
|
+
*/
|
|
1624
|
+
export declare const MetricsPiece: import("./codec.ts").Message<{
|
|
1625
|
+
readonly bytes: readonly [1, import("./codec.ts").Codec<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>];
|
|
1626
|
+
}>;
|
|
1586
1627
|
/**
|
|
1587
1628
|
* A page of names, of a name's labels or of a label's values.
|
|
1588
1629
|
*/
|