@encore.dev/sdk 0.0.0 → 2.0.0-beta.5
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/LICENSE +362 -0
- package/README.md +122 -2
- package/app_meta.test.ts +134 -0
- package/app_meta.ts +186 -0
- package/config/config.test.ts +381 -0
- package/config/config.ts +178 -0
- package/config/mod.ts +14 -0
- package/config/secrets.ts +147 -0
- package/config/value.ts +243 -0
- package/cron/mod.ts +23 -0
- package/dist/app_meta.d.ts +93 -0
- package/dist/app_meta.js +65 -0
- package/dist/app_meta.js.map +1 -0
- package/dist/config/config.d.ts +105 -0
- package/dist/config/config.js +87 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/mod.d.ts +4 -0
- package/dist/config/mod.js +3 -0
- package/dist/config/mod.js.map +1 -0
- package/dist/config/secrets.d.ts +92 -0
- package/dist/config/secrets.js +80 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/config/value.d.ts +51 -0
- package/dist/config/value.js +178 -0
- package/dist/config/value.js.map +1 -0
- package/dist/cron/mod.d.ts +22 -0
- package/dist/cron/mod.js +9 -0
- package/dist/cron/mod.js.map +1 -0
- package/dist/internal/otel/backend.d.ts +50 -0
- package/dist/internal/otel/backend.js +2 -0
- package/dist/internal/otel/backend.js.map +1 -0
- package/dist/internal/otel/context.d.ts +10 -0
- package/dist/internal/otel/context.js +34 -0
- package/dist/internal/otel/context.js.map +1 -0
- package/dist/internal/otel/context_manager.d.ts +22 -0
- package/dist/internal/otel/context_manager.js +120 -0
- package/dist/internal/otel/context_manager.js.map +1 -0
- package/dist/internal/otel/encode.d.ts +112 -0
- package/dist/internal/otel/encode.js +290 -0
- package/dist/internal/otel/encode.js.map +1 -0
- package/dist/internal/otel/index.d.ts +9 -0
- package/dist/internal/otel/index.js +9 -0
- package/dist/internal/otel/index.js.map +1 -0
- package/dist/internal/otel/meter.d.ts +73 -0
- package/dist/internal/otel/meter.js +265 -0
- package/dist/internal/otel/meter.js.map +1 -0
- package/dist/internal/otel/propagator.d.ts +14 -0
- package/dist/internal/otel/propagator.js +61 -0
- package/dist/internal/otel/propagator.js.map +1 -0
- package/dist/internal/otel/provider.d.ts +9 -0
- package/dist/internal/otel/provider.js +19 -0
- package/dist/internal/otel/provider.js.map +1 -0
- package/dist/internal/otel/request_context.d.ts +11 -0
- package/dist/internal/otel/request_context.js +20 -0
- package/dist/internal/otel/request_context.js.map +1 -0
- package/dist/internal/otel/span.d.ts +61 -0
- package/dist/internal/otel/span.js +206 -0
- package/dist/internal/otel/span.js.map +1 -0
- package/dist/internal/otel/tracer.d.ts +15 -0
- package/dist/internal/otel/tracer.js +65 -0
- package/dist/internal/otel/tracer.js.map +1 -0
- package/dist/internal/reqtrack/mod.d.ts +6 -0
- package/dist/internal/reqtrack/mod.js +28 -0
- package/dist/internal/reqtrack/mod.js.map +1 -0
- package/dist/internal/runtime/meter.d.ts +11 -0
- package/dist/internal/runtime/meter.js +22 -0
- package/dist/internal/runtime/meter.js.map +1 -0
- package/dist/internal/runtime/mod.d.ts +12 -0
- package/dist/internal/runtime/mod.js +28 -0
- package/dist/internal/runtime/mod.js.map +1 -0
- package/dist/internal/runtime/napi/napi.cjs +122 -0
- package/dist/internal/runtime/napi/napi.d.cts +601 -0
- package/dist/internal/runtime/shutdown.d.ts +13 -0
- package/dist/internal/runtime/shutdown.js +56 -0
- package/dist/internal/runtime/shutdown.js.map +1 -0
- package/dist/internal/utils/constraints.d.ts +9 -0
- package/dist/internal/utils/constraints.js +2 -0
- package/dist/internal/utils/constraints.js.map +1 -0
- package/dist/log/index.d.ts +39 -0
- package/dist/log/index.js +44 -0
- package/dist/log/index.js.map +1 -0
- package/dist/log/logger.d.ts +123 -0
- package/dist/log/logger.js +203 -0
- package/dist/log/logger.js.map +1 -0
- package/dist/log/runtime.d.ts +19 -0
- package/dist/log/runtime.js +22 -0
- package/dist/log/runtime.js.map +1 -0
- package/dist/log/stderr.d.ts +9 -0
- package/dist/log/stderr.js +25 -0
- package/dist/log/stderr.js.map +1 -0
- package/dist/metrics/mod.d.ts +315 -0
- package/dist/metrics/mod.js +488 -0
- package/dist/metrics/mod.js.map +1 -0
- package/dist/mod.d.ts +6 -0
- package/dist/mod.js +4 -0
- package/dist/mod.js.map +1 -0
- package/dist/otel.d.ts +9 -0
- package/dist/otel.js +13 -0
- package/dist/otel.js.map +1 -0
- package/dist/pubsub/encoding.d.ts +3 -0
- package/dist/pubsub/encoding.js +10 -0
- package/dist/pubsub/encoding.js.map +1 -0
- package/dist/pubsub/mod.d.ts +6 -0
- package/dist/pubsub/mod.js +3 -0
- package/dist/pubsub/mod.js.map +1 -0
- package/dist/pubsub/refs.d.ts +12 -0
- package/dist/pubsub/refs.js +11 -0
- package/dist/pubsub/refs.js.map +1 -0
- package/dist/pubsub/subscription.d.ts +128 -0
- package/dist/pubsub/subscription.js +39 -0
- package/dist/pubsub/subscription.js.map +1 -0
- package/dist/pubsub/topic.d.ts +148 -0
- package/dist/pubsub/topic.js +164 -0
- package/dist/pubsub/topic.js.map +1 -0
- package/dist/req_meta.d.ts +47 -0
- package/dist/req_meta.js +26 -0
- package/dist/req_meta.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.js +22 -0
- package/dist/services/index.js.map +1 -0
- package/dist/shutdown/mod.d.ts +23 -0
- package/dist/shutdown/mod.js +24 -0
- package/dist/shutdown/mod.js.map +1 -0
- package/dist/storage/objects/bucket.d.ts +216 -0
- package/dist/storage/objects/bucket.js +123 -0
- package/dist/storage/objects/bucket.js.map +1 -0
- package/dist/storage/objects/error.d.ts +14 -0
- package/dist/storage/objects/error.js +81 -0
- package/dist/storage/objects/error.js.map +1 -0
- package/dist/storage/objects/mod.d.ts +4 -0
- package/dist/storage/objects/mod.js +3 -0
- package/dist/storage/objects/mod.js.map +1 -0
- package/dist/storage/objects/refs.d.ts +31 -0
- package/dist/storage/objects/refs.js +20 -0
- package/dist/storage/objects/refs.js.map +1 -0
- package/dist/storage/postgres/database.d.ts +295 -0
- package/dist/storage/postgres/database.js +378 -0
- package/dist/storage/postgres/database.js.map +1 -0
- package/dist/storage/postgres/mod.d.ts +2 -0
- package/dist/storage/postgres/mod.js +2 -0
- package/dist/storage/postgres/mod.js.map +1 -0
- package/dist/storage/redis/commands.d.ts +573 -0
- package/dist/storage/redis/commands.js +637 -0
- package/dist/storage/redis/commands.js.map +1 -0
- package/dist/storage/redis/database.d.ts +302 -0
- package/dist/storage/redis/database.js +336 -0
- package/dist/storage/redis/database.js.map +1 -0
- package/dist/storage/redis/mod.d.ts +88 -0
- package/dist/storage/redis/mod.js +84 -0
- package/dist/storage/redis/mod.js.map +1 -0
- package/dist/storage/redis/native.d.ts +8 -0
- package/dist/storage/redis/native.js +11 -0
- package/dist/storage/redis/native.js.map +1 -0
- package/dist/storage/redis/options.d.ts +89 -0
- package/dist/storage/redis/options.js +53 -0
- package/dist/storage/redis/options.js.map +1 -0
- package/dist/storage/redis/pubsub.d.ts +53 -0
- package/dist/storage/redis/pubsub.js +88 -0
- package/dist/storage/redis/pubsub.js.map +1 -0
- package/dist/storage/redis/reply.d.ts +256 -0
- package/dist/storage/redis/reply.js +572 -0
- package/dist/storage/redis/reply.js.map +1 -0
- package/dist/storage/redis/scan.d.ts +11 -0
- package/dist/storage/redis/scan.js +76 -0
- package/dist/storage/redis/scan.js.map +1 -0
- package/dist/storage/redis/script.d.ts +91 -0
- package/dist/storage/redis/script.js +143 -0
- package/dist/storage/redis/script.js.map +1 -0
- package/dist/storage/redis/target.d.ts +47 -0
- package/dist/storage/redis/target.js +82 -0
- package/dist/storage/redis/target.js.map +1 -0
- package/dist/storage/redis/wire.d.ts +105 -0
- package/dist/storage/redis/wire.js +333 -0
- package/dist/storage/redis/wire.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/mod.d.ts +42 -0
- package/dist/types/mod.js +65 -0
- package/dist/types/mod.js.map +1 -0
- package/internal/otel/backend.ts +60 -0
- package/internal/otel/context.test.ts +70 -0
- package/internal/otel/context.ts +48 -0
- package/internal/otel/context_manager.test.ts +154 -0
- package/internal/otel/context_manager.ts +141 -0
- package/internal/otel/encode.test.ts +266 -0
- package/internal/otel/encode.ts +408 -0
- package/internal/otel/index.ts +20 -0
- package/internal/otel/meter.test.ts +231 -0
- package/internal/otel/meter.ts +332 -0
- package/internal/otel/propagator.test.ts +105 -0
- package/internal/otel/propagator.ts +68 -0
- package/internal/otel/provider.ts +23 -0
- package/internal/otel/request_context.ts +32 -0
- package/internal/otel/span.ts +252 -0
- package/internal/otel/tracer.test.ts +352 -0
- package/internal/otel/tracer.ts +104 -0
- package/internal/reqtrack/mod.ts +39 -0
- package/internal/runtime/meter.ts +26 -0
- package/internal/runtime/mod.ts +41 -0
- package/internal/runtime/napi/napi.cjs +122 -0
- package/internal/runtime/napi/napi.d.cts +601 -0
- package/internal/runtime/shutdown.test.ts +248 -0
- package/internal/runtime/shutdown.ts +64 -0
- package/internal/utils/constraints.ts +12 -0
- package/log/index.ts +107 -0
- package/log/logger.test.ts +194 -0
- package/log/logger.ts +308 -0
- package/log/runtime.test.ts +65 -0
- package/log/runtime.ts +40 -0
- package/log/stderr.test.ts +23 -0
- package/log/stderr.ts +24 -0
- package/metrics/export.test.ts +337 -0
- package/metrics/mod.test.ts +180 -0
- package/metrics/mod.ts +619 -0
- package/mod.ts +22 -0
- package/otel.test.ts +84 -0
- package/otel.ts +17 -0
- package/package.json +121 -5
- package/pubsub/encoding.ts +8 -0
- package/pubsub/mod.ts +14 -0
- package/pubsub/pubsub.test.ts +186 -0
- package/pubsub/refs.ts +22 -0
- package/pubsub/subscription.ts +180 -0
- package/pubsub/topic.test.ts +121 -0
- package/pubsub/topic.ts +212 -0
- package/req_meta.ts +75 -0
- package/services/index.test.ts +30 -0
- package/services/index.ts +21 -0
- package/shutdown/mod.ts +24 -0
- package/storage/objects/bucket.ts +338 -0
- package/storage/objects/error.ts +94 -0
- package/storage/objects/mod.ts +35 -0
- package/storage/objects/refs.ts +69 -0
- package/storage/postgres/database.integration.test.ts +175 -0
- package/storage/postgres/database.test.ts +241 -0
- package/storage/postgres/database.ts +497 -0
- package/storage/postgres/mod.ts +15 -0
- package/storage/redis/commands.ts +1221 -0
- package/storage/redis/database.ts +466 -0
- package/storage/redis/mod.ts +135 -0
- package/storage/redis/native.ts +11 -0
- package/storage/redis/options.ts +119 -0
- package/storage/redis/pubsub.ts +92 -0
- package/storage/redis/redis.test.ts +706 -0
- package/storage/redis/reply.ts +705 -0
- package/storage/redis/runtime.test.ts +233 -0
- package/storage/redis/scan.ts +125 -0
- package/storage/redis/script.ts +162 -0
- package/storage/redis/target.ts +131 -0
- package/storage/redis/wire.ts +369 -0
- package/types/mod.ts +92 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics: counters, up-down counters, histograms and gauges of what an app
|
|
3
|
+
* does.
|
|
4
|
+
*
|
|
5
|
+
* A metric is declared at module level and used wherever the thing it
|
|
6
|
+
* measures happens. Its JSDoc comment, else its `description` option, is
|
|
7
|
+
* its description:
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { Counter, Histogram } from "@encore.dev/sdk/metrics";
|
|
11
|
+
*
|
|
12
|
+
* export const ordersPlaced = new Counter("orders_placed", { unit: "{order}" });
|
|
13
|
+
* export const uploadSize = new Histogram("upload_size", {
|
|
14
|
+
* unit: "By",
|
|
15
|
+
* buckets: [1024, 65536, 1048576]
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* ordersPlaced.increment();
|
|
19
|
+
* uploadSize.record(2048);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Each is an instrument of the OpenTelemetry Metrics API
|
|
23
|
+
* (`@opentelemetry/api`), of the meter `encore`, named as declared, a
|
|
24
|
+
* service's own prefixed with its service's name (`orders_placed` of the
|
|
25
|
+
* service `shop` is exported as `shop.orders_placed`), created when it is
|
|
26
|
+
* first recorded to, recording through Encore's meter provider whatever the
|
|
27
|
+
* global one is. Instruments of the API itself made with it
|
|
28
|
+
* (`meterProvider().getMeter(…)`) are exported alongside: observable
|
|
29
|
+
* instruments are made with it.
|
|
30
|
+
*
|
|
31
|
+
* Which class declares a metric says who records to it: a `Counter`
|
|
32
|
+
* belongs to the declaring service, which alone records to it; a
|
|
33
|
+
* `SharedCounter` is shared between services, each that records to it
|
|
34
|
+
* tracked as using it; a `GlobalCounter` is the whole app's, recorded to
|
|
35
|
+
* from any code, untracked. `SharedCounter` and `GlobalCounter` extend
|
|
36
|
+
* `Counter`, so code taking a `Counter` takes one of any scope. The
|
|
37
|
+
* `…Group` classes take a label type, whose fields are the attributes of
|
|
38
|
+
* what is recorded:
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { CounterGroup } from "@encore.dev/sdk/metrics";
|
|
42
|
+
*
|
|
43
|
+
* interface Outcome {
|
|
44
|
+
* method: string;
|
|
45
|
+
* status: number;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* export const requests = new CounterGroup<Outcome>("requests_handled");
|
|
49
|
+
*
|
|
50
|
+
* requests.with({ method: "GET", status: 200 }).increment();
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* A shared or global metric is declared once in the app, as a shared
|
|
54
|
+
* secret is. Other code records to it by importing the declaration, or,
|
|
55
|
+
* from another service in another language, binds it by name with
|
|
56
|
+
* `named`, which states the declaration's kind and labels and takes its
|
|
57
|
+
* scope, unit, description and buckets. Every scope's class has it and
|
|
58
|
+
* binds alike: `SharedCounter.named` is `Counter.named`. A bound metric is
|
|
59
|
+
* exported as declared, never prefixed.
|
|
60
|
+
*
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { CounterGroup } from "@encore.dev/sdk/metrics";
|
|
63
|
+
*
|
|
64
|
+
* const served = CounterGroup.named<Served>("greetings.served");
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* To hand a metric to other code, pass its `ref()`: it counts as recording
|
|
68
|
+
* to it.
|
|
69
|
+
*
|
|
70
|
+
* @module
|
|
71
|
+
*/
|
|
72
|
+
import { meterProvider } from '../internal/runtime/meter.js';
|
|
73
|
+
import { StringLiteral } from '../internal/utils/constraints.js';
|
|
74
|
+
export { meterProvider };
|
|
75
|
+
export type { MeterProvider } from '../internal/otel/meter.js';
|
|
76
|
+
/** The options every metric is declared with. */
|
|
77
|
+
export interface MetricOptions {
|
|
78
|
+
/** What the metric measures in, as exported: `"s"`, `"By"`,
|
|
79
|
+
* `"{request}"` ([UCUM](https://ucum.org/ucum)). */
|
|
80
|
+
unit?: string;
|
|
81
|
+
/** What the metric measures, for one without a JSDoc comment. */
|
|
82
|
+
description?: string;
|
|
83
|
+
}
|
|
84
|
+
/** The options a histogram is declared with. */
|
|
85
|
+
export interface HistogramOptions extends MetricOptions {
|
|
86
|
+
/** The upper bounds of the buckets, increasing: what is recorded is
|
|
87
|
+
* counted in the first it is no greater than, or one past the last.
|
|
88
|
+
* Without them, the OpenTelemetry defaults. */
|
|
89
|
+
buckets?: number[];
|
|
90
|
+
}
|
|
91
|
+
/** A metric group's labels: an interface or type whose fields are strings,
|
|
92
|
+
* numbers or booleans. Each field is a label, named as the field in
|
|
93
|
+
* snake_case. A number is recorded as an integer, its value floored
|
|
94
|
+
* (`Math.floor`): `200.7` is `200`. */
|
|
95
|
+
export type Labels<L> = {
|
|
96
|
+
[K in keyof L]: string | number | boolean;
|
|
97
|
+
};
|
|
98
|
+
/** A number that only goes up: how many times something happened, or how
|
|
99
|
+
* much of something there has been. Belongs to the declaring service: only it records to it. */
|
|
100
|
+
export declare class Counter {
|
|
101
|
+
private readonly inst;
|
|
102
|
+
private readonly attrs?;
|
|
103
|
+
/** Declares the counter `name`. */
|
|
104
|
+
constructor(name: string, opts?: MetricOptions);
|
|
105
|
+
/** Binds the shared or global counter `name`, declared elsewhere. */
|
|
106
|
+
static named<N extends string>(name: StringLiteral<N>): Counter;
|
|
107
|
+
/** Adds one. */
|
|
108
|
+
increment(): void;
|
|
109
|
+
/** Adds `n`. A counter does not go down: an amount below zero is
|
|
110
|
+
* ignored. */
|
|
111
|
+
add(n: number): void;
|
|
112
|
+
/** The counter itself, to hand to other code. */
|
|
113
|
+
ref(): this;
|
|
114
|
+
}
|
|
115
|
+
/** A counter shared between services: each that records to it is tracked as
|
|
116
|
+
* using it. */
|
|
117
|
+
export declare class SharedCounter extends Counter {
|
|
118
|
+
/** Declares the shared counter `name`. */
|
|
119
|
+
constructor(name: string, opts?: MetricOptions);
|
|
120
|
+
}
|
|
121
|
+
/** A counter of the whole app: any code may record to it. */
|
|
122
|
+
export declare class GlobalCounter extends Counter {
|
|
123
|
+
/** Declares the global counter `name`. */
|
|
124
|
+
constructor(name: string, opts?: MetricOptions);
|
|
125
|
+
}
|
|
126
|
+
/** A number that goes up and down by what is added to it: how many
|
|
127
|
+
* requests are in flight, how many jobs are queued. Belongs to the declaring service: only it records to it. */
|
|
128
|
+
export declare class UpDownCounter {
|
|
129
|
+
private readonly inst;
|
|
130
|
+
private readonly attrs?;
|
|
131
|
+
/** Declares the up-down counter `name`. */
|
|
132
|
+
constructor(name: string, opts?: MetricOptions);
|
|
133
|
+
/** Binds the shared or global up-down counter `name`, declared elsewhere. */
|
|
134
|
+
static named<N extends string>(name: StringLiteral<N>): UpDownCounter;
|
|
135
|
+
/** Adds `n`, which may be below zero. */
|
|
136
|
+
add(n: number): void;
|
|
137
|
+
/** Adds one. */
|
|
138
|
+
increment(): void;
|
|
139
|
+
/** Takes away one. */
|
|
140
|
+
decrement(): void;
|
|
141
|
+
/** The up-down counter itself, to hand to other code. */
|
|
142
|
+
ref(): this;
|
|
143
|
+
}
|
|
144
|
+
/** An up-down counter shared between services: each that records to it is tracked as
|
|
145
|
+
* using it. */
|
|
146
|
+
export declare class SharedUpDownCounter extends UpDownCounter {
|
|
147
|
+
/** Declares the shared up-down counter `name`. */
|
|
148
|
+
constructor(name: string, opts?: MetricOptions);
|
|
149
|
+
}
|
|
150
|
+
/** An up-down counter of the whole app: any code may record to it. */
|
|
151
|
+
export declare class GlobalUpDownCounter extends UpDownCounter {
|
|
152
|
+
/** Declares the global up-down counter `name`. */
|
|
153
|
+
constructor(name: string, opts?: MetricOptions);
|
|
154
|
+
}
|
|
155
|
+
/** A number that is what it was last set to: what something is right now. Belongs to the declaring service: only it records to it. */
|
|
156
|
+
export declare class Gauge {
|
|
157
|
+
private readonly inst;
|
|
158
|
+
private readonly attrs?;
|
|
159
|
+
/** Declares the gauge `name`. */
|
|
160
|
+
constructor(name: string, opts?: MetricOptions);
|
|
161
|
+
/** Binds the shared or global gauge `name`, declared elsewhere. */
|
|
162
|
+
static named<N extends string>(name: StringLiteral<N>): Gauge;
|
|
163
|
+
/** Sets the gauge to `value`. */
|
|
164
|
+
set(value: number): void;
|
|
165
|
+
/** The gauge itself, to hand to other code. */
|
|
166
|
+
ref(): this;
|
|
167
|
+
}
|
|
168
|
+
/** A gauge shared between services: each that records to it is tracked as
|
|
169
|
+
* using it. */
|
|
170
|
+
export declare class SharedGauge extends Gauge {
|
|
171
|
+
/** Declares the shared gauge `name`. */
|
|
172
|
+
constructor(name: string, opts?: MetricOptions);
|
|
173
|
+
}
|
|
174
|
+
/** A gauge of the whole app: any code may record to it. */
|
|
175
|
+
export declare class GlobalGauge extends Gauge {
|
|
176
|
+
/** Declares the global gauge `name`. */
|
|
177
|
+
constructor(name: string, opts?: MetricOptions);
|
|
178
|
+
}
|
|
179
|
+
/** How what is recorded is distributed: how long requests take, how large
|
|
180
|
+
* uploads are. Belongs to the declaring service: only it records to it. */
|
|
181
|
+
export declare class Histogram {
|
|
182
|
+
private readonly inst;
|
|
183
|
+
private readonly attrs?;
|
|
184
|
+
/** Declares the histogram `name`. */
|
|
185
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
186
|
+
/** Binds the shared or global histogram `name`, declared elsewhere. */
|
|
187
|
+
static named<N extends string>(name: StringLiteral<N>): Histogram;
|
|
188
|
+
/** Records `value`. */
|
|
189
|
+
record(value: number): void;
|
|
190
|
+
/** The histogram itself, to hand to other code. */
|
|
191
|
+
ref(): this;
|
|
192
|
+
}
|
|
193
|
+
/** A histogram shared between services: each that records to it is tracked as
|
|
194
|
+
* using it. */
|
|
195
|
+
export declare class SharedHistogram extends Histogram {
|
|
196
|
+
/** Declares the shared histogram `name`. */
|
|
197
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
198
|
+
}
|
|
199
|
+
/** A histogram of the whole app: any code may record to it. */
|
|
200
|
+
export declare class GlobalHistogram extends Histogram {
|
|
201
|
+
/** Declares the global histogram `name`. */
|
|
202
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
203
|
+
}
|
|
204
|
+
/** A counter for each combination of the labels `L`. Belongs to the
|
|
205
|
+
* declaring service: only it records to it. */
|
|
206
|
+
export declare class CounterGroup<L extends Labels<L>> {
|
|
207
|
+
private readonly inst;
|
|
208
|
+
/** Declares the counter group `name`. */
|
|
209
|
+
constructor(name: string, opts?: MetricOptions);
|
|
210
|
+
/** Binds the shared or global counter group `name`, declared elsewhere,
|
|
211
|
+
* whose labels are `L`. */
|
|
212
|
+
static named<L extends Labels<L>>(name: string): CounterGroup<L>;
|
|
213
|
+
/** The counter for `labels`. Worth keeping where it is used often:
|
|
214
|
+
* making it encodes the labels' attributes. */
|
|
215
|
+
with(labels: L): Counter;
|
|
216
|
+
/** The group itself, to hand to other code. */
|
|
217
|
+
ref(): this;
|
|
218
|
+
}
|
|
219
|
+
/** A counter group shared between services: each that records to it is tracked
|
|
220
|
+
* as using it. */
|
|
221
|
+
export declare class SharedCounterGroup<L extends Labels<L>> extends CounterGroup<L> {
|
|
222
|
+
/** Declares the shared counter group `name`. */
|
|
223
|
+
constructor(name: string, opts?: MetricOptions);
|
|
224
|
+
with(labels: L): SharedCounter;
|
|
225
|
+
}
|
|
226
|
+
/** A counter group of the whole app: any code may record to it. */
|
|
227
|
+
export declare class GlobalCounterGroup<L extends Labels<L>> extends CounterGroup<L> {
|
|
228
|
+
/** Declares the global counter group `name`. */
|
|
229
|
+
constructor(name: string, opts?: MetricOptions);
|
|
230
|
+
with(labels: L): GlobalCounter;
|
|
231
|
+
}
|
|
232
|
+
/** An up-down counter for each combination of the labels `L`. Belongs to the
|
|
233
|
+
* declaring service: only it records to it. */
|
|
234
|
+
export declare class UpDownCounterGroup<L extends Labels<L>> {
|
|
235
|
+
private readonly inst;
|
|
236
|
+
/** Declares the up-down counter group `name`. */
|
|
237
|
+
constructor(name: string, opts?: MetricOptions);
|
|
238
|
+
/** Binds the shared or global up-down counter group `name`, declared elsewhere,
|
|
239
|
+
* whose labels are `L`. */
|
|
240
|
+
static named<L extends Labels<L>>(name: string): UpDownCounterGroup<L>;
|
|
241
|
+
/** The up-down counter for `labels`. Worth keeping where it is used often:
|
|
242
|
+
* making it encodes the labels' attributes. */
|
|
243
|
+
with(labels: L): UpDownCounter;
|
|
244
|
+
/** The group itself, to hand to other code. */
|
|
245
|
+
ref(): this;
|
|
246
|
+
}
|
|
247
|
+
/** An up-down counter group shared between services: each that records to it is tracked
|
|
248
|
+
* as using it. */
|
|
249
|
+
export declare class SharedUpDownCounterGroup<L extends Labels<L>> extends UpDownCounterGroup<L> {
|
|
250
|
+
/** Declares the shared up-down counter group `name`. */
|
|
251
|
+
constructor(name: string, opts?: MetricOptions);
|
|
252
|
+
with(labels: L): SharedUpDownCounter;
|
|
253
|
+
}
|
|
254
|
+
/** An up-down counter group of the whole app: any code may record to it. */
|
|
255
|
+
export declare class GlobalUpDownCounterGroup<L extends Labels<L>> extends UpDownCounterGroup<L> {
|
|
256
|
+
/** Declares the global up-down counter group `name`. */
|
|
257
|
+
constructor(name: string, opts?: MetricOptions);
|
|
258
|
+
with(labels: L): GlobalUpDownCounter;
|
|
259
|
+
}
|
|
260
|
+
/** A gauge for each combination of the labels `L`. Belongs to the
|
|
261
|
+
* declaring service: only it records to it. */
|
|
262
|
+
export declare class GaugeGroup<L extends Labels<L>> {
|
|
263
|
+
private readonly inst;
|
|
264
|
+
/** Declares the gauge group `name`. */
|
|
265
|
+
constructor(name: string, opts?: MetricOptions);
|
|
266
|
+
/** Binds the shared or global gauge group `name`, declared elsewhere,
|
|
267
|
+
* whose labels are `L`. */
|
|
268
|
+
static named<L extends Labels<L>>(name: string): GaugeGroup<L>;
|
|
269
|
+
/** The gauge for `labels`. Worth keeping where it is used often:
|
|
270
|
+
* making it encodes the labels' attributes. */
|
|
271
|
+
with(labels: L): Gauge;
|
|
272
|
+
/** The group itself, to hand to other code. */
|
|
273
|
+
ref(): this;
|
|
274
|
+
}
|
|
275
|
+
/** A gauge group shared between services: each that records to it is tracked
|
|
276
|
+
* as using it. */
|
|
277
|
+
export declare class SharedGaugeGroup<L extends Labels<L>> extends GaugeGroup<L> {
|
|
278
|
+
/** Declares the shared gauge group `name`. */
|
|
279
|
+
constructor(name: string, opts?: MetricOptions);
|
|
280
|
+
with(labels: L): SharedGauge;
|
|
281
|
+
}
|
|
282
|
+
/** A gauge group of the whole app: any code may record to it. */
|
|
283
|
+
export declare class GlobalGaugeGroup<L extends Labels<L>> extends GaugeGroup<L> {
|
|
284
|
+
/** Declares the global gauge group `name`. */
|
|
285
|
+
constructor(name: string, opts?: MetricOptions);
|
|
286
|
+
with(labels: L): GlobalGauge;
|
|
287
|
+
}
|
|
288
|
+
/** A histogram for each combination of the labels `L`. Belongs to the
|
|
289
|
+
* declaring service: only it records to it. */
|
|
290
|
+
export declare class HistogramGroup<L extends Labels<L>> {
|
|
291
|
+
private readonly inst;
|
|
292
|
+
/** Declares the histogram group `name`. */
|
|
293
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
294
|
+
/** Binds the shared or global histogram group `name`, declared elsewhere,
|
|
295
|
+
* whose labels are `L`. */
|
|
296
|
+
static named<L extends Labels<L>>(name: string): HistogramGroup<L>;
|
|
297
|
+
/** The histogram for `labels`. Worth keeping where it is used often:
|
|
298
|
+
* making it encodes the labels' attributes. */
|
|
299
|
+
with(labels: L): Histogram;
|
|
300
|
+
/** The group itself, to hand to other code. */
|
|
301
|
+
ref(): this;
|
|
302
|
+
}
|
|
303
|
+
/** A histogram group shared between services: each that records to it is tracked
|
|
304
|
+
* as using it. */
|
|
305
|
+
export declare class SharedHistogramGroup<L extends Labels<L>> extends HistogramGroup<L> {
|
|
306
|
+
/** Declares the shared histogram group `name`. */
|
|
307
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
308
|
+
with(labels: L): SharedHistogram;
|
|
309
|
+
}
|
|
310
|
+
/** A histogram group of the whole app: any code may record to it. */
|
|
311
|
+
export declare class GlobalHistogramGroup<L extends Labels<L>> extends HistogramGroup<L> {
|
|
312
|
+
/** Declares the global histogram group `name`. */
|
|
313
|
+
constructor(name: string, opts?: HistogramOptions);
|
|
314
|
+
with(labels: L): GlobalHistogram;
|
|
315
|
+
}
|