@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.17
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 +111 -101
- package/app_meta.ts +56 -54
- package/config/config.ts +60 -57
- package/config/secrets.ts +45 -52
- package/config/value.ts +23 -26
- package/cron/mod.ts +28 -29
- package/dist/app_meta.d.ts +52 -50
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +2 -2
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -55
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +8 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +45 -52
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +8 -9
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +20 -23
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +20 -23
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +26 -27
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -14
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +20 -19
- package/dist/frontends/mod.d.ts.map +1 -1
- package/dist/frontends/mod.js +20 -19
- package/dist/frontends/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +28 -30
- package/dist/gateway/errors.d.ts.map +1 -1
- package/dist/gateway/errors.js +29 -31
- package/dist/gateway/errors.js.map +1 -1
- package/dist/gateway/match.d.ts +54 -54
- package/dist/gateway/match.d.ts.map +1 -1
- package/dist/gateway/match.js +56 -56
- package/dist/gateway/match.js.map +1 -1
- package/dist/gateway/middleware.d.ts +62 -64
- package/dist/gateway/middleware.d.ts.map +1 -1
- package/dist/gateway/middleware.js +1 -1
- package/dist/gateway/middleware.js.map +1 -1
- package/dist/gateway/mod.d.ts +64 -67
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +72 -76
- package/dist/gateway/mod.js.map +1 -1
- package/dist/gateway/request.d.ts +138 -134
- package/dist/gateway/request.d.ts.map +1 -1
- package/dist/gateway/request.js +117 -108
- package/dist/gateway/request.js.map +1 -1
- package/dist/gateway/serve.d.ts +29 -34
- package/dist/gateway/serve.d.ts.map +1 -1
- package/dist/gateway/serve.js +51 -56
- package/dist/gateway/serve.js.map +1 -1
- package/dist/gateways/mod.d.ts +23 -21
- package/dist/gateways/mod.d.ts.map +1 -1
- package/dist/gateways/mod.js +25 -23
- package/dist/gateways/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +10 -3
- package/dist/internal/runtime/shutdown.d.ts +75 -57
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +88 -84
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/log/logger.d.ts +43 -37
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +26 -25
- package/dist/log/logger.js.map +1 -1
- package/dist/metrics/mod.d.ts +133 -114
- package/dist/metrics/mod.d.ts.map +1 -1
- package/dist/metrics/mod.js +109 -101
- package/dist/metrics/mod.js.map +1 -1
- package/dist/otel.d.ts +6 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +6 -3
- package/dist/otel.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +88 -116
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js +14 -17
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +86 -113
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +68 -82
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +83 -86
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +39 -41
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +76 -75
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +73 -71
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +26 -25
- package/dist/shutdown/mod.d.ts.map +1 -1
- package/dist/shutdown/mod.js +26 -25
- package/dist/shutdown/mod.js.map +1 -1
- package/dist/storage/clickhouse/database.d.ts +113 -115
- package/dist/storage/clickhouse/database.d.ts.map +1 -1
- package/dist/storage/clickhouse/database.js +65 -79
- package/dist/storage/clickhouse/database.js.map +1 -1
- package/dist/storage/clickhouse/errors.d.ts +25 -26
- package/dist/storage/clickhouse/errors.d.ts.map +1 -1
- package/dist/storage/clickhouse/errors.js +15 -17
- package/dist/storage/clickhouse/errors.js.map +1 -1
- package/dist/storage/clickhouse/mod.d.ts +10 -10
- package/dist/storage/clickhouse/mod.js +10 -10
- package/dist/storage/objects/bucket.d.ts +196 -225
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +71 -84
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +4 -4
- package/dist/storage/objects/error.js +4 -4
- package/dist/storage/postgres/database.d.ts +124 -149
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +98 -135
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +42 -48
- package/dist/storage/postgres/errors.d.ts.map +1 -1
- package/dist/storage/postgres/errors.js +44 -51
- package/dist/storage/postgres/errors.js.map +1 -1
- package/dist/storage/postgres/interval.d.ts +19 -19
- package/dist/storage/postgres/interval.d.ts.map +1 -1
- package/dist/storage/postgres/interval.js +21 -21
- package/dist/storage/postgres/interval.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +48 -23
- package/dist/storage/redis/bitfield.d.ts.map +1 -1
- package/dist/storage/redis/bitfield.js +38 -19
- package/dist/storage/redis/bitfield.js.map +1 -1
- package/dist/storage/redis/command.d.ts +16 -12
- package/dist/storage/redis/command.d.ts.map +1 -1
- package/dist/storage/redis/command.js +16 -12
- package/dist/storage/redis/command.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +99 -100
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +84 -85
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +138 -122
- package/dist/storage/redis/database.d.ts.map +1 -1
- package/dist/storage/redis/database.js +120 -101
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +52 -48
- package/dist/storage/redis/mod.d.ts.map +1 -1
- package/dist/storage/redis/mod.js +52 -48
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/options.d.ts +26 -24
- package/dist/storage/redis/options.d.ts.map +1 -1
- package/dist/storage/redis/options.js.map +1 -1
- package/dist/storage/redis/pubsub.d.ts +16 -16
- package/dist/storage/redis/pubsub.d.ts.map +1 -1
- package/dist/storage/redis/pubsub.js +14 -14
- package/dist/storage/redis/pubsub.js.map +1 -1
- package/dist/storage/redis/reply.d.ts +80 -72
- package/dist/storage/redis/reply.d.ts.map +1 -1
- package/dist/storage/redis/reply.js +53 -46
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +4 -4
- package/dist/storage/redis/scan.d.ts.map +1 -1
- package/dist/storage/redis/scan.js +6 -6
- package/dist/storage/redis/scan.js.map +1 -1
- package/dist/storage/redis/script.d.ts +28 -21
- package/dist/storage/redis/script.d.ts.map +1 -1
- package/dist/storage/redis/script.js +29 -22
- package/dist/storage/redis/script.js.map +1 -1
- package/dist/storage/redis/target.d.ts +17 -1
- package/dist/storage/redis/target.d.ts.map +1 -1
- package/dist/storage/redis/target.js +30 -1
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +6 -6
- package/dist/storage/redis/wire.d.ts.map +1 -1
- package/dist/storage/redis/wire.js +6 -6
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/mod.d.ts +83 -88
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +75 -81
- package/dist/testing/mod.js.map +1 -1
- package/dist/testing/playwright.d.ts +28 -32
- package/dist/testing/playwright.d.ts.map +1 -1
- package/dist/testing/playwright.js +22 -27
- package/dist/testing/playwright.js.map +1 -1
- package/dist/testing/puppeteer.d.ts +11 -12
- package/dist/testing/puppeteer.d.ts.map +1 -1
- package/dist/testing/puppeteer.js +17 -18
- package/dist/testing/puppeteer.js.map +1 -1
- package/dist/testing/system.d.ts +72 -90
- package/dist/testing/system.d.ts.map +1 -1
- package/dist/testing/system.js +90 -107
- package/dist/testing/system.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/frontends/mod.test.ts +6 -2
- package/frontends/mod.ts +20 -19
- package/gateway/errors.ts +30 -32
- package/gateway/match.ts +61 -57
- package/gateway/middleware.ts +62 -64
- package/gateway/mod.ts +73 -76
- package/gateway/request.ts +143 -140
- package/gateway/serve.ts +58 -63
- package/gateways/mod.ts +25 -23
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +10 -3
- package/internal/runtime/shutdown.ts +113 -101
- package/log/logger.test.ts +8 -0
- package/log/logger.ts +48 -45
- package/metrics/mod.ts +138 -122
- package/otel.ts +6 -3
- package/package.json +1 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/reqctx/mod.ts +83 -86
- package/services/index.ts +78 -78
- package/shutdown/mod.ts +26 -25
- package/storage/clickhouse/database.ts +115 -129
- package/storage/clickhouse/errors.ts +27 -29
- package/storage/clickhouse/mod.ts +10 -10
- package/storage/objects/bucket.ts +209 -239
- package/storage/objects/error.ts +4 -4
- package/storage/postgres/database.ts +131 -164
- package/storage/postgres/errors.ts +45 -52
- package/storage/postgres/interval.ts +21 -21
- package/storage/redis/bitfield.ts +51 -26
- package/storage/redis/command.ts +16 -12
- package/storage/redis/commands.ts +99 -100
- package/storage/redis/database.ts +145 -123
- package/storage/redis/mod.ts +52 -48
- package/storage/redis/options.ts +26 -24
- package/storage/redis/pubsub.ts +14 -14
- package/storage/redis/redis.test.ts +17 -2
- package/storage/redis/reply.ts +85 -77
- package/storage/redis/scan.ts +6 -6
- package/storage/redis/script.ts +29 -22
- package/storage/redis/target.ts +34 -1
- package/storage/redis/wire.ts +8 -8
- package/testing/mod.ts +99 -105
- package/testing/playwright.ts +32 -37
- package/testing/puppeteer.ts +22 -23
- package/testing/system.ts +117 -133
package/dist/metrics/mod.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* does.
|
|
2
|
+
* Application metrics: counters, up-down counters, histograms, and gauges.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Declare metrics at module level and record to them wherever the measured
|
|
5
|
+
* event occurs. A metric's JSDoc comment is used as its description (falling
|
|
6
|
+
* back to the `description` option):
|
|
8
7
|
*
|
|
9
8
|
* ```typescript
|
|
10
9
|
* import { Counter, Histogram } from "@encore.dev/sdk/metrics";
|
|
@@ -19,28 +18,25 @@
|
|
|
19
18
|
* uploadSize.record(2048);
|
|
20
19
|
* ```
|
|
21
20
|
*
|
|
22
|
-
* Each is
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* any code, untracked. It is written as a string literal, for Encore to
|
|
36
|
-
* read:
|
|
21
|
+
* Each metric is backed by an OpenTelemetry Metrics API (`@opentelemetry/api`)
|
|
22
|
+
* instrument on the `encore` meter, created lazily on first use and exported
|
|
23
|
+
* through Encore's meter provider regardless of any global provider.
|
|
24
|
+
* Service-scoped metrics are exported with their service name as a prefix
|
|
25
|
+
* (e.g. `orders_placed` in service `shop` is exported as `shop.orders_placed`).
|
|
26
|
+
* Custom OpenTelemetry instruments created via `meterProvider().getMeter(...)`
|
|
27
|
+
* — such as observable instruments — are exported alongside Encore metrics.
|
|
28
|
+
*
|
|
29
|
+
* Use the `scope` option (as a string literal) to control which services can
|
|
30
|
+
* record to a metric:
|
|
31
|
+
* - `"service"` (default): owned by the declaring service alone.
|
|
32
|
+
* - `"shared"`: shared across services, with each recording service tracked.
|
|
33
|
+
* - `"global"`: app-wide and recordable from any code without usage tracking.
|
|
37
34
|
*
|
|
38
35
|
* ```typescript
|
|
39
36
|
* export const signups = new Counter("signups", { scope: "shared" });
|
|
40
37
|
* ```
|
|
41
38
|
*
|
|
42
|
-
*
|
|
43
|
-
* what is recorded:
|
|
39
|
+
* Use the `*Group` classes to attach typed labels as metric attributes:
|
|
44
40
|
*
|
|
45
41
|
* ```typescript
|
|
46
42
|
* import { CounterGroup } from "@encore.dev/sdk/metrics";
|
|
@@ -55,12 +51,11 @@
|
|
|
55
51
|
* requests.with({ method: "GET", status: 200 }).increment();
|
|
56
52
|
* ```
|
|
57
53
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* declared, never prefixed.
|
|
54
|
+
* Like shared secrets, a shared or global metric is declared once in the app.
|
|
55
|
+
* Other services record to it by importing the declaration, or (for example,
|
|
56
|
+
* across languages) by binding it by name with `named(...)`, which inherits the
|
|
57
|
+
* declaration's scope, unit, description, and buckets. Bound metrics are
|
|
58
|
+
* exported as declared without a service prefix:
|
|
64
59
|
*
|
|
65
60
|
* ```typescript
|
|
66
61
|
* import { CounterGroup } from "@encore.dev/sdk/metrics";
|
|
@@ -68,8 +63,8 @@
|
|
|
68
63
|
* const served = CounterGroup.named<Served>("greetings.served");
|
|
69
64
|
* ```
|
|
70
65
|
*
|
|
71
|
-
* To
|
|
72
|
-
* to
|
|
66
|
+
* To pass a metric handle to helper functions or other modules, pass `ref()`
|
|
67
|
+
* (calling `ref()` counts as recording to the metric).
|
|
73
68
|
*
|
|
74
69
|
* @module
|
|
75
70
|
*/
|
|
@@ -77,166 +72,190 @@ import { meterProvider } from '../internal/runtime/meter.js';
|
|
|
77
72
|
import { StringLiteral } from '../internal/utils/constraints.js';
|
|
78
73
|
export { meterProvider };
|
|
79
74
|
export type { MeterProvider } from '../internal/otel/meter.js';
|
|
80
|
-
/**
|
|
75
|
+
/** Common options for declaring a metric. */
|
|
81
76
|
export interface MetricOptions {
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
77
|
+
/**
|
|
78
|
+
* Controls which services can record to this metric. Must be a string
|
|
79
|
+
* literal:
|
|
80
|
+
* - `"service"` (default): only the declaring service; exported as
|
|
81
|
+
* `<service>.<name>`.
|
|
82
|
+
* - `"shared"`: any service, with each recording service tracked; exported
|
|
83
|
+
* as declared.
|
|
84
|
+
* - `"global"`: any code, untracked; exported as declared.
|
|
85
|
+
*/
|
|
87
86
|
scope?: 'service' | 'shared' | 'global';
|
|
88
|
-
/**
|
|
89
|
-
* `"{request}"` ([UCUM](https://ucum.org/ucum)). */
|
|
87
|
+
/** Unit of measurement using [UCUM](https://ucum.org/ucum) syntax (e.g. `"s"`, `"By"`, `"{request}"`). */
|
|
90
88
|
unit?: string;
|
|
91
|
-
/**
|
|
89
|
+
/** Human-readable description used when the declaration has no JSDoc comment. */
|
|
92
90
|
description?: string;
|
|
93
91
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
92
|
+
* Static string-literal tags that classify the metric for policy checks
|
|
93
|
+
* (e.g. `{data: "pci"}`). Keys and values may contain lowercase letters,
|
|
94
|
+
* digits, `_`, and `-`, up to 63 characters. Keys must start with a letter
|
|
95
|
+
* and cannot start with the reserved prefix `encore`. At most 32 tags.
|
|
98
96
|
*/
|
|
99
97
|
tags?: Record<string, string>;
|
|
100
98
|
}
|
|
101
|
-
/**
|
|
99
|
+
/** Options for declaring a histogram metric. */
|
|
102
100
|
export interface HistogramOptions extends MetricOptions {
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
101
|
+
/**
|
|
102
|
+
* Strictly increasing upper bounds for histogram buckets. Each recorded value
|
|
103
|
+
* falls into the first bucket whose bound is greater than or equal to it (or
|
|
104
|
+
* the overflow bucket above the last bound). Uses OpenTelemetry defaults when
|
|
105
|
+
* omitted.
|
|
106
|
+
*/
|
|
106
107
|
buckets?: number[];
|
|
107
108
|
}
|
|
108
|
-
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* (`Math.floor
|
|
109
|
+
/**
|
|
110
|
+
* Label type for a metric group: an interface or type whose fields are strings,
|
|
111
|
+
* numbers, or booleans. Field names are converted to `snake_case` attribute
|
|
112
|
+
* keys, and numbers are floored to integers (`Math.floor`, so `200.7` becomes
|
|
113
|
+
* `200`).
|
|
114
|
+
*/
|
|
112
115
|
export type Labels<L> = {
|
|
113
116
|
[K in keyof L]: string | number | boolean;
|
|
114
117
|
};
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
+
/**
|
|
119
|
+
* A monotonically increasing metric for counting occurrences or totals.
|
|
120
|
+
* Scoped to the declaring service by default.
|
|
121
|
+
*/
|
|
118
122
|
export declare class Counter {
|
|
119
123
|
private readonly inst;
|
|
120
124
|
private readonly attrs?;
|
|
121
|
-
/** Declares
|
|
125
|
+
/** Declares a counter named `name`. */
|
|
122
126
|
constructor(name: string, opts?: MetricOptions);
|
|
123
|
-
/** Binds
|
|
127
|
+
/** Binds to a shared or global counter declared elsewhere. */
|
|
124
128
|
static named<N extends string>(name: StringLiteral<N>): Counter;
|
|
125
|
-
/**
|
|
129
|
+
/** Increments the counter by 1. */
|
|
126
130
|
increment(): void;
|
|
127
|
-
/** Adds `n
|
|
128
|
-
* ignored. */
|
|
131
|
+
/** Adds `n` to the counter. Negative values are ignored. */
|
|
129
132
|
add(n: number): void;
|
|
130
|
-
/**
|
|
133
|
+
/** Returns this counter handle so it can be passed to other code. */
|
|
131
134
|
ref(): this;
|
|
132
135
|
}
|
|
133
|
-
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
+
/**
|
|
137
|
+
* A metric that can increase or decrease by arbitrary deltas, such as
|
|
138
|
+
* in-flight requests or queued jobs. Scoped to the declaring service by
|
|
139
|
+
* default.
|
|
140
|
+
*/
|
|
136
141
|
export declare class UpDownCounter {
|
|
137
142
|
private readonly inst;
|
|
138
143
|
private readonly attrs?;
|
|
139
|
-
/** Declares
|
|
144
|
+
/** Declares an up-down counter named `name`. */
|
|
140
145
|
constructor(name: string, opts?: MetricOptions);
|
|
141
|
-
/** Binds
|
|
146
|
+
/** Binds to a shared or global up-down counter declared elsewhere. */
|
|
142
147
|
static named<N extends string>(name: StringLiteral<N>): UpDownCounter;
|
|
143
|
-
/** Adds `n
|
|
148
|
+
/** Adds `n` (positive or negative) to the counter. */
|
|
144
149
|
add(n: number): void;
|
|
145
|
-
/**
|
|
150
|
+
/** Increments the counter by 1. */
|
|
146
151
|
increment(): void;
|
|
147
|
-
/**
|
|
152
|
+
/** Decrements the counter by 1. */
|
|
148
153
|
decrement(): void;
|
|
149
|
-
/**
|
|
154
|
+
/** Returns this up-down counter handle so it can be passed to other code. */
|
|
150
155
|
ref(): this;
|
|
151
156
|
}
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
157
|
+
/**
|
|
158
|
+
* A metric that records the latest instantaneous value of something. Scoped to
|
|
159
|
+
* the declaring service by default.
|
|
160
|
+
*/
|
|
155
161
|
export declare class Gauge {
|
|
156
162
|
private readonly inst;
|
|
157
163
|
private readonly attrs?;
|
|
158
|
-
/** Declares
|
|
164
|
+
/** Declares a gauge named `name`. */
|
|
159
165
|
constructor(name: string, opts?: MetricOptions);
|
|
160
|
-
/** Binds
|
|
166
|
+
/** Binds to a shared or global gauge declared elsewhere. */
|
|
161
167
|
static named<N extends string>(name: StringLiteral<N>): Gauge;
|
|
162
168
|
/** Sets the gauge to `value`. */
|
|
163
169
|
set(value: number): void;
|
|
164
|
-
/**
|
|
170
|
+
/** Returns this gauge handle so it can be passed to other code. */
|
|
165
171
|
ref(): this;
|
|
166
172
|
}
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
173
|
+
/**
|
|
174
|
+
* A metric that records the distribution of values, such as request latencies
|
|
175
|
+
* or upload sizes. Scoped to the declaring service by default.
|
|
176
|
+
*/
|
|
170
177
|
export declare class Histogram {
|
|
171
178
|
private readonly inst;
|
|
172
179
|
private readonly attrs?;
|
|
173
|
-
/** Declares
|
|
180
|
+
/** Declares a histogram named `name`. */
|
|
174
181
|
constructor(name: string, opts?: HistogramOptions);
|
|
175
|
-
/** Binds
|
|
182
|
+
/** Binds to a shared or global histogram declared elsewhere. */
|
|
176
183
|
static named<N extends string>(name: StringLiteral<N>): Histogram;
|
|
177
|
-
/** Records `value
|
|
184
|
+
/** Records `value` in the histogram. */
|
|
178
185
|
record(value: number): void;
|
|
179
|
-
/**
|
|
186
|
+
/** Returns this histogram handle so it can be passed to other code. */
|
|
180
187
|
ref(): this;
|
|
181
188
|
}
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
189
|
+
/**
|
|
190
|
+
* A labeled group of {@link Counter} metrics keyed by `L`. Scoped to the
|
|
191
|
+
* declaring service by default.
|
|
192
|
+
*/
|
|
184
193
|
export declare class CounterGroup<L extends Labels<L>> {
|
|
185
194
|
private readonly inst;
|
|
186
|
-
/** Declares
|
|
195
|
+
/** Declares a counter group named `name`. */
|
|
187
196
|
constructor(name: string, opts?: MetricOptions);
|
|
188
|
-
/** Binds
|
|
189
|
-
* whose labels are `L`. */
|
|
197
|
+
/** Binds to a shared or global counter group declared elsewhere with labels `L`. */
|
|
190
198
|
static named<L extends Labels<L>>(name: string): CounterGroup<L>;
|
|
191
|
-
/**
|
|
192
|
-
*
|
|
199
|
+
/**
|
|
200
|
+
* Returns a {@link Counter} bound to `labels`. Cache the returned handle on
|
|
201
|
+
* hot paths to avoid re-encoding the label attributes.
|
|
202
|
+
*/
|
|
193
203
|
with(labels: L): Counter;
|
|
194
|
-
/**
|
|
204
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
195
205
|
ref(): this;
|
|
196
206
|
}
|
|
197
|
-
/**
|
|
198
|
-
*
|
|
207
|
+
/**
|
|
208
|
+
* A labeled group of {@link UpDownCounter} metrics keyed by `L`. Scoped to the
|
|
209
|
+
* declaring service by default.
|
|
210
|
+
*/
|
|
199
211
|
export declare class UpDownCounterGroup<L extends Labels<L>> {
|
|
200
212
|
private readonly inst;
|
|
201
|
-
/** Declares
|
|
213
|
+
/** Declares an up-down counter group named `name`. */
|
|
202
214
|
constructor(name: string, opts?: MetricOptions);
|
|
203
|
-
/** Binds
|
|
204
|
-
* whose labels are `L`. */
|
|
215
|
+
/** Binds to a shared or global up-down counter group declared elsewhere with labels `L`. */
|
|
205
216
|
static named<L extends Labels<L>>(name: string): UpDownCounterGroup<L>;
|
|
206
|
-
/**
|
|
207
|
-
*
|
|
217
|
+
/**
|
|
218
|
+
* Returns an {@link UpDownCounter} bound to `labels`. Cache the returned
|
|
219
|
+
* handle on hot paths to avoid re-encoding the label attributes.
|
|
220
|
+
*/
|
|
208
221
|
with(labels: L): UpDownCounter;
|
|
209
|
-
/**
|
|
222
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
210
223
|
ref(): this;
|
|
211
224
|
}
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
225
|
+
/**
|
|
226
|
+
* A labeled group of {@link Gauge} metrics keyed by `L`. Scoped to the
|
|
227
|
+
* declaring service by default.
|
|
228
|
+
*/
|
|
214
229
|
export declare class GaugeGroup<L extends Labels<L>> {
|
|
215
230
|
private readonly inst;
|
|
216
|
-
/** Declares
|
|
231
|
+
/** Declares a gauge group named `name`. */
|
|
217
232
|
constructor(name: string, opts?: MetricOptions);
|
|
218
|
-
/** Binds
|
|
219
|
-
* whose labels are `L`. */
|
|
233
|
+
/** Binds to a shared or global gauge group declared elsewhere with labels `L`. */
|
|
220
234
|
static named<L extends Labels<L>>(name: string): GaugeGroup<L>;
|
|
221
|
-
/**
|
|
222
|
-
*
|
|
235
|
+
/**
|
|
236
|
+
* Returns a {@link Gauge} bound to `labels`. Cache the returned handle on
|
|
237
|
+
* hot paths to avoid re-encoding the label attributes.
|
|
238
|
+
*/
|
|
223
239
|
with(labels: L): Gauge;
|
|
224
|
-
/**
|
|
240
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
225
241
|
ref(): this;
|
|
226
242
|
}
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
243
|
+
/**
|
|
244
|
+
* A labeled group of {@link Histogram} metrics keyed by `L`. Scoped to the
|
|
245
|
+
* declaring service by default.
|
|
246
|
+
*/
|
|
229
247
|
export declare class HistogramGroup<L extends Labels<L>> {
|
|
230
248
|
private readonly inst;
|
|
231
|
-
/** Declares
|
|
249
|
+
/** Declares a histogram group named `name`. */
|
|
232
250
|
constructor(name: string, opts?: HistogramOptions);
|
|
233
|
-
/** Binds
|
|
234
|
-
* whose labels are `L`. */
|
|
251
|
+
/** Binds to a shared or global histogram group declared elsewhere with labels `L`. */
|
|
235
252
|
static named<L extends Labels<L>>(name: string): HistogramGroup<L>;
|
|
236
|
-
/**
|
|
237
|
-
*
|
|
253
|
+
/**
|
|
254
|
+
* Returns a {@link Histogram} bound to `labels`. Cache the returned handle
|
|
255
|
+
* on hot paths to avoid re-encoding the label attributes.
|
|
256
|
+
*/
|
|
238
257
|
with(labels: L): Histogram;
|
|
239
|
-
/**
|
|
258
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
240
259
|
ref(): this;
|
|
241
260
|
}
|
|
242
261
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../metrics/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"m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