@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.16
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.js
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
|
-
* instruments are made with it.
|
|
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.
|
|
30
28
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* read:
|
|
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,22 +63,21 @@
|
|
|
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
|
*/
|
|
76
71
|
import { hostedService, meter, meterProvider } from '../internal/runtime/meter.js';
|
|
77
72
|
export { meterProvider };
|
|
78
|
-
/**
|
|
73
|
+
/** Lazily instantiated underlying OpenTelemetry instrument. */
|
|
79
74
|
class Lazy {
|
|
80
75
|
kind;
|
|
81
76
|
name;
|
|
82
77
|
opts;
|
|
83
78
|
own;
|
|
84
79
|
inst;
|
|
85
|
-
/** `own`: the declaring service
|
|
86
|
-
* `<service>.<name>`. */
|
|
80
|
+
/** `own`: belongs solely to the declaring service and is exported as `<service>.<name>`. */
|
|
87
81
|
constructor(kind, name, opts, own) {
|
|
88
82
|
this.kind = kind;
|
|
89
83
|
this.name = name;
|
|
@@ -116,20 +110,18 @@ class Lazy {
|
|
|
116
110
|
}
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
|
-
/**
|
|
120
|
-
* text, made without its constructor, which declares a metric. */
|
|
113
|
+
/** Creates an instance of `cls` bound to `inst` and pre-encoded `attrs` without invoking its declaring constructor. */
|
|
121
114
|
function bind(cls, inst, attrs) {
|
|
122
115
|
return Object.assign(Object.create(cls.prototype), {
|
|
123
116
|
inst,
|
|
124
117
|
attrs,
|
|
125
118
|
});
|
|
126
119
|
}
|
|
127
|
-
/**
|
|
120
|
+
/** Reports whether a metric declared with `opts` is service-scoped. */
|
|
128
121
|
function own(opts) {
|
|
129
122
|
return (opts?.scope ?? 'service') === 'service';
|
|
130
123
|
}
|
|
131
|
-
/** `labels` as
|
|
132
|
-
* numbers floored. */
|
|
124
|
+
/** Encodes `labels` as a JSON attribute object with `snake_case` keys and floored numeric values. */
|
|
133
125
|
function attributes(labels) {
|
|
134
126
|
const out = {};
|
|
135
127
|
for (const [key, value] of Object.entries(labels)) {
|
|
@@ -137,7 +129,7 @@ function attributes(labels) {
|
|
|
137
129
|
}
|
|
138
130
|
return JSON.stringify(out);
|
|
139
131
|
}
|
|
140
|
-
/** `statusCode`
|
|
132
|
+
/** Converts camelCase/PascalCase to snake_case (e.g. `statusCode` -> `status_code`, `HTTPStatus` -> `http_status`). */
|
|
141
133
|
function snakeCase(s) {
|
|
142
134
|
return s
|
|
143
135
|
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
@@ -149,76 +141,79 @@ function snakeCase(s) {
|
|
|
149
141
|
// `named` binds a shared or global metric declared elsewhere, by another
|
|
150
142
|
// service, possibly in another language: its kind and labels are the
|
|
151
143
|
// declaration's, and so are its scope, unit, description and buckets.
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
144
|
+
/**
|
|
145
|
+
* A monotonically increasing metric for counting occurrences or totals.
|
|
146
|
+
* Scoped to the declaring service by default.
|
|
147
|
+
*/
|
|
155
148
|
export class Counter {
|
|
156
149
|
inst;
|
|
157
150
|
attrs;
|
|
158
|
-
/** Declares
|
|
151
|
+
/** Declares a counter named `name`. */
|
|
159
152
|
constructor(name, opts) {
|
|
160
153
|
this.inst = new Lazy('counter', name, opts, own(opts));
|
|
161
154
|
}
|
|
162
|
-
/** Binds
|
|
155
|
+
/** Binds to a shared or global counter declared elsewhere. */
|
|
163
156
|
static named(name) {
|
|
164
157
|
return bind(Counter, new Lazy('counter', name, undefined, false));
|
|
165
158
|
}
|
|
166
|
-
/**
|
|
159
|
+
/** Increments the counter by 1. */
|
|
167
160
|
increment() {
|
|
168
161
|
this.inst.get().recordEncoded(1, this.attrs);
|
|
169
162
|
}
|
|
170
|
-
/** Adds `n
|
|
171
|
-
* ignored. */
|
|
163
|
+
/** Adds `n` to the counter. Negative values are ignored. */
|
|
172
164
|
add(n) {
|
|
173
165
|
this.inst.get().recordEncoded(n, this.attrs);
|
|
174
166
|
}
|
|
175
|
-
/**
|
|
167
|
+
/** Returns this counter handle so it can be passed to other code. */
|
|
176
168
|
ref() {
|
|
177
169
|
return this;
|
|
178
170
|
}
|
|
179
171
|
}
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
172
|
+
/**
|
|
173
|
+
* A metric that can increase or decrease by arbitrary deltas, such as
|
|
174
|
+
* in-flight requests or queued jobs. Scoped to the declaring service by
|
|
175
|
+
* default.
|
|
176
|
+
*/
|
|
183
177
|
export class UpDownCounter {
|
|
184
178
|
inst;
|
|
185
179
|
attrs;
|
|
186
|
-
/** Declares
|
|
180
|
+
/** Declares an up-down counter named `name`. */
|
|
187
181
|
constructor(name, opts) {
|
|
188
182
|
this.inst = new Lazy('upDownCounter', name, opts, own(opts));
|
|
189
183
|
}
|
|
190
|
-
/** Binds
|
|
184
|
+
/** Binds to a shared or global up-down counter declared elsewhere. */
|
|
191
185
|
static named(name) {
|
|
192
186
|
return bind(UpDownCounter, new Lazy('upDownCounter', name, undefined, false));
|
|
193
187
|
}
|
|
194
|
-
/** Adds `n
|
|
188
|
+
/** Adds `n` (positive or negative) to the counter. */
|
|
195
189
|
add(n) {
|
|
196
190
|
this.inst.get().recordEncoded(n, this.attrs);
|
|
197
191
|
}
|
|
198
|
-
/**
|
|
192
|
+
/** Increments the counter by 1. */
|
|
199
193
|
increment() {
|
|
200
194
|
this.inst.get().recordEncoded(1, this.attrs);
|
|
201
195
|
}
|
|
202
|
-
/**
|
|
196
|
+
/** Decrements the counter by 1. */
|
|
203
197
|
decrement() {
|
|
204
198
|
this.inst.get().recordEncoded(-1, this.attrs);
|
|
205
199
|
}
|
|
206
|
-
/**
|
|
200
|
+
/** Returns this up-down counter handle so it can be passed to other code. */
|
|
207
201
|
ref() {
|
|
208
202
|
return this;
|
|
209
203
|
}
|
|
210
204
|
}
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
205
|
+
/**
|
|
206
|
+
* A metric that records the latest instantaneous value of something. Scoped to
|
|
207
|
+
* the declaring service by default.
|
|
208
|
+
*/
|
|
214
209
|
export class Gauge {
|
|
215
210
|
inst;
|
|
216
211
|
attrs;
|
|
217
|
-
/** Declares
|
|
212
|
+
/** Declares a gauge named `name`. */
|
|
218
213
|
constructor(name, opts) {
|
|
219
214
|
this.inst = new Lazy('gauge', name, opts, own(opts));
|
|
220
215
|
}
|
|
221
|
-
/** Binds
|
|
216
|
+
/** Binds to a shared or global gauge declared elsewhere. */
|
|
222
217
|
static named(name) {
|
|
223
218
|
return bind(Gauge, new Lazy('gauge', name, undefined, false));
|
|
224
219
|
}
|
|
@@ -226,30 +221,31 @@ export class Gauge {
|
|
|
226
221
|
set(value) {
|
|
227
222
|
this.inst.get().recordEncoded(value, this.attrs);
|
|
228
223
|
}
|
|
229
|
-
/**
|
|
224
|
+
/** Returns this gauge handle so it can be passed to other code. */
|
|
230
225
|
ref() {
|
|
231
226
|
return this;
|
|
232
227
|
}
|
|
233
228
|
}
|
|
234
|
-
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
229
|
+
/**
|
|
230
|
+
* A metric that records the distribution of values, such as request latencies
|
|
231
|
+
* or upload sizes. Scoped to the declaring service by default.
|
|
232
|
+
*/
|
|
237
233
|
export class Histogram {
|
|
238
234
|
inst;
|
|
239
235
|
attrs;
|
|
240
|
-
/** Declares
|
|
236
|
+
/** Declares a histogram named `name`. */
|
|
241
237
|
constructor(name, opts) {
|
|
242
238
|
this.inst = new Lazy('histogram', name, opts, own(opts));
|
|
243
239
|
}
|
|
244
|
-
/** Binds
|
|
240
|
+
/** Binds to a shared or global histogram declared elsewhere. */
|
|
245
241
|
static named(name) {
|
|
246
242
|
return bind(Histogram, new Lazy('histogram', name, undefined, false));
|
|
247
243
|
}
|
|
248
|
-
/** Records `value
|
|
244
|
+
/** Records `value` in the histogram. */
|
|
249
245
|
record(value) {
|
|
250
246
|
this.inst.get().recordEncoded(value, this.attrs);
|
|
251
247
|
}
|
|
252
|
-
/**
|
|
248
|
+
/** Returns this histogram handle so it can be passed to other code. */
|
|
253
249
|
ref() {
|
|
254
250
|
return this;
|
|
255
251
|
}
|
|
@@ -258,94 +254,106 @@ export class Histogram {
|
|
|
258
254
|
// cannot infer the name's literal type beside an explicit type argument, so
|
|
259
255
|
// the name is a plain `string`, and the parser's check is the only one it
|
|
260
256
|
// gets.
|
|
261
|
-
/**
|
|
262
|
-
*
|
|
257
|
+
/**
|
|
258
|
+
* A labeled group of {@link Counter} metrics keyed by `L`. Scoped to the
|
|
259
|
+
* declaring service by default.
|
|
260
|
+
*/
|
|
263
261
|
export class CounterGroup {
|
|
264
262
|
inst;
|
|
265
|
-
/** Declares
|
|
263
|
+
/** Declares a counter group named `name`. */
|
|
266
264
|
constructor(name, opts) {
|
|
267
265
|
this.inst = new Lazy('counter', name, opts, own(opts));
|
|
268
266
|
}
|
|
269
|
-
/** Binds
|
|
270
|
-
* whose labels are `L`. */
|
|
267
|
+
/** Binds to a shared or global counter group declared elsewhere with labels `L`. */
|
|
271
268
|
static named(name) {
|
|
272
269
|
return bind(CounterGroup, new Lazy('counter', name, undefined, false));
|
|
273
270
|
}
|
|
274
|
-
/**
|
|
275
|
-
*
|
|
271
|
+
/**
|
|
272
|
+
* Returns a {@link Counter} bound to `labels`. Cache the returned handle on
|
|
273
|
+
* hot paths to avoid re-encoding the label attributes.
|
|
274
|
+
*/
|
|
276
275
|
with(labels) {
|
|
277
276
|
return bind(Counter, this.inst, attributes(labels));
|
|
278
277
|
}
|
|
279
|
-
/**
|
|
278
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
280
279
|
ref() {
|
|
281
280
|
return this;
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
|
-
/**
|
|
285
|
-
*
|
|
283
|
+
/**
|
|
284
|
+
* A labeled group of {@link UpDownCounter} metrics keyed by `L`. Scoped to the
|
|
285
|
+
* declaring service by default.
|
|
286
|
+
*/
|
|
286
287
|
export class UpDownCounterGroup {
|
|
287
288
|
inst;
|
|
288
|
-
/** Declares
|
|
289
|
+
/** Declares an up-down counter group named `name`. */
|
|
289
290
|
constructor(name, opts) {
|
|
290
291
|
this.inst = new Lazy('upDownCounter', name, opts, own(opts));
|
|
291
292
|
}
|
|
292
|
-
/** Binds
|
|
293
|
-
* whose labels are `L`. */
|
|
293
|
+
/** Binds to a shared or global up-down counter group declared elsewhere with labels `L`. */
|
|
294
294
|
static named(name) {
|
|
295
295
|
return bind(UpDownCounterGroup, new Lazy('upDownCounter', name, undefined, false));
|
|
296
296
|
}
|
|
297
|
-
/**
|
|
298
|
-
*
|
|
297
|
+
/**
|
|
298
|
+
* Returns an {@link UpDownCounter} bound to `labels`. Cache the returned
|
|
299
|
+
* handle on hot paths to avoid re-encoding the label attributes.
|
|
300
|
+
*/
|
|
299
301
|
with(labels) {
|
|
300
302
|
return bind(UpDownCounter, this.inst, attributes(labels));
|
|
301
303
|
}
|
|
302
|
-
/**
|
|
304
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
303
305
|
ref() {
|
|
304
306
|
return this;
|
|
305
307
|
}
|
|
306
308
|
}
|
|
307
|
-
/**
|
|
308
|
-
*
|
|
309
|
+
/**
|
|
310
|
+
* A labeled group of {@link Gauge} metrics keyed by `L`. Scoped to the
|
|
311
|
+
* declaring service by default.
|
|
312
|
+
*/
|
|
309
313
|
export class GaugeGroup {
|
|
310
314
|
inst;
|
|
311
|
-
/** Declares
|
|
315
|
+
/** Declares a gauge group named `name`. */
|
|
312
316
|
constructor(name, opts) {
|
|
313
317
|
this.inst = new Lazy('gauge', name, opts, own(opts));
|
|
314
318
|
}
|
|
315
|
-
/** Binds
|
|
316
|
-
* whose labels are `L`. */
|
|
319
|
+
/** Binds to a shared or global gauge group declared elsewhere with labels `L`. */
|
|
317
320
|
static named(name) {
|
|
318
321
|
return bind(GaugeGroup, new Lazy('gauge', name, undefined, false));
|
|
319
322
|
}
|
|
320
|
-
/**
|
|
321
|
-
*
|
|
323
|
+
/**
|
|
324
|
+
* Returns a {@link Gauge} bound to `labels`. Cache the returned handle on
|
|
325
|
+
* hot paths to avoid re-encoding the label attributes.
|
|
326
|
+
*/
|
|
322
327
|
with(labels) {
|
|
323
328
|
return bind(Gauge, this.inst, attributes(labels));
|
|
324
329
|
}
|
|
325
|
-
/**
|
|
330
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
326
331
|
ref() {
|
|
327
332
|
return this;
|
|
328
333
|
}
|
|
329
334
|
}
|
|
330
|
-
/**
|
|
331
|
-
*
|
|
335
|
+
/**
|
|
336
|
+
* A labeled group of {@link Histogram} metrics keyed by `L`. Scoped to the
|
|
337
|
+
* declaring service by default.
|
|
338
|
+
*/
|
|
332
339
|
export class HistogramGroup {
|
|
333
340
|
inst;
|
|
334
|
-
/** Declares
|
|
341
|
+
/** Declares a histogram group named `name`. */
|
|
335
342
|
constructor(name, opts) {
|
|
336
343
|
this.inst = new Lazy('histogram', name, opts, own(opts));
|
|
337
344
|
}
|
|
338
|
-
/** Binds
|
|
339
|
-
* whose labels are `L`. */
|
|
345
|
+
/** Binds to a shared or global histogram group declared elsewhere with labels `L`. */
|
|
340
346
|
static named(name) {
|
|
341
347
|
return bind(HistogramGroup, new Lazy('histogram', name, undefined, false));
|
|
342
348
|
}
|
|
343
|
-
/**
|
|
344
|
-
*
|
|
349
|
+
/**
|
|
350
|
+
* Returns a {@link Histogram} bound to `labels`. Cache the returned handle
|
|
351
|
+
* on hot paths to avoid re-encoding the label attributes.
|
|
352
|
+
*/
|
|
345
353
|
with(labels) {
|
|
346
354
|
return bind(Histogram, this.inst, attributes(labels));
|
|
347
355
|
}
|
|
348
|
-
/**
|
|
356
|
+
/** Returns this metric group handle so it can be passed to other code. */
|
|
349
357
|
ref() {
|
|
350
358
|
return this;
|
|
351
359
|
}
|
package/dist/metrics/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../metrics/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../metrics/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAGH,OAAO,EAAC,aAAa,EAAE,KAAK,EAAE,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,CAAC;IACd,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,cAAc;IACR,IAAI,CAAO;IAE5B,+CAA+C;IAC/C,YAAY,IAAY,EAAE,IAAuB;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,sFAAsF;IACtF,MAAM,CAAC,KAAK,CAAsB,IAAY;QAC5C,OAAO,IAAI,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,MAAS;QACZ,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,0EAA0E;IAC1E,GAAG;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/otel.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ import { meterProvider } from './internal/runtime/meter.js';
|
|
|
3
3
|
export { meterProvider };
|
|
4
4
|
export type { MeterProvider } from './internal/otel/meter.js';
|
|
5
5
|
export type { TracerProvider };
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
/**
|
|
7
|
+
* Returns Encore's OpenTelemetry `TracerProvider`, which records spans into the
|
|
8
|
+
* runtime's telemetry pipeline. Encore records its own spans automatically;
|
|
9
|
+
* pass this provider to third-party instrumentations or register it with
|
|
10
|
+
* `trace.setGlobalTracerProvider`.
|
|
11
|
+
*/
|
|
9
12
|
export declare function tracerProvider(): TracerProvider;
|
|
10
13
|
//# sourceMappingURL=otel.d.ts.map
|
package/dist/otel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../otel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAC,aAAa,EAAC,CAAC;AACvB,YAAY,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAC,cAAc,EAAC,CAAC;AAI7B
|
|
1
|
+
{"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../otel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAC,aAAa,EAAC,CAAC;AACvB,YAAY,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAC,cAAc,EAAC,CAAC;AAI7B;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAG/C"}
|
package/dist/otel.js
CHANGED
|
@@ -3,9 +3,12 @@ import { meterProvider } from './internal/runtime/meter.js';
|
|
|
3
3
|
import { RT } from './internal/runtime/mod.js';
|
|
4
4
|
export { meterProvider };
|
|
5
5
|
let tracers;
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
/**
|
|
7
|
+
* Returns Encore's OpenTelemetry `TracerProvider`, which records spans into the
|
|
8
|
+
* runtime's telemetry pipeline. Encore records its own spans automatically;
|
|
9
|
+
* pass this provider to third-party instrumentations or register it with
|
|
10
|
+
* `trace.setGlobalTracerProvider`.
|
|
11
|
+
*/
|
|
9
12
|
export function tracerProvider() {
|
|
10
13
|
tracers ??= new TracerProvider(RT.telemetry());
|
|
11
14
|
return tracers;
|
package/dist/otel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otel.js","sourceRoot":"","sources":["../otel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,EAAE,EAAC,MAAM,wBAAwB,CAAC;AAE1C,OAAO,EAAC,aAAa,EAAC,CAAC;AAIvB,IAAI,OAAmC,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"otel.js","sourceRoot":"","sources":["../otel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,EAAE,EAAC,MAAM,wBAAwB,CAAC;AAE1C,OAAO,EAAC,aAAa,EAAC,CAAC;AAIvB,IAAI,OAAmC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,KAAK,IAAI,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|