@promster/metrics 15.5.0 → 15.5.2

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.
Files changed (42) hide show
  1. package/dist/index.cjs +385 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +144 -0
  4. package/dist/index.d.ts +144 -0
  5. package/dist/index.js +336 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +30 -10
  8. package/dist/declarations/src/client/client.d.ts +0 -9
  9. package/dist/declarations/src/client/index.d.ts +0 -2
  10. package/dist/declarations/src/create-gc-metrics/create-gc-metrics.d.ts +0 -14
  11. package/dist/declarations/src/create-gc-metrics/index.d.ts +0 -2
  12. package/dist/declarations/src/create-gc-observer/create-gc-observer.d.ts +0 -3
  13. package/dist/declarations/src/create-gc-observer/index.d.ts +0 -2
  14. package/dist/declarations/src/create-graphql-metrics/create-graphql-metrics.d.ts +0 -25
  15. package/dist/declarations/src/create-graphql-metrics/index.d.ts +0 -2
  16. package/dist/declarations/src/create-http-metrics/create-http-metrics.d.ts +0 -26
  17. package/dist/declarations/src/create-http-metrics/index.d.ts +0 -2
  18. package/dist/declarations/src/create-request-recorder/create-request-recorder.d.ts +0 -16
  19. package/dist/declarations/src/create-request-recorder/index.d.ts +0 -3
  20. package/dist/declarations/src/end-measurement-from/end-measurement-from.d.ts +0 -4
  21. package/dist/declarations/src/end-measurement-from/index.d.ts +0 -2
  22. package/dist/declarations/src/environment/index.d.ts +0 -3
  23. package/dist/declarations/src/environment/kubernetes.d.ts +0 -2
  24. package/dist/declarations/src/environment/skip-metrics-in-environment.d.ts +0 -6
  25. package/dist/declarations/src/index.d.ts +0 -16
  26. package/dist/declarations/src/normalizers/index.d.ts +0 -9
  27. package/dist/declarations/src/normalizers/method/index.d.ts +0 -2
  28. package/dist/declarations/src/normalizers/method/method.d.ts +0 -2
  29. package/dist/declarations/src/normalizers/path/index.d.ts +0 -2
  30. package/dist/declarations/src/normalizers/path/path.d.ts +0 -2
  31. package/dist/declarations/src/normalizers/status-code/index.d.ts +0 -2
  32. package/dist/declarations/src/normalizers/status-code/status-code.d.ts +0 -2
  33. package/dist/declarations/src/sort-labels/index.d.ts +0 -2
  34. package/dist/declarations/src/sort-labels/sort-labels.d.ts +0 -3
  35. package/dist/declarations/src/summary/index.d.ts +0 -2
  36. package/dist/declarations/src/summary/summary.d.ts +0 -3
  37. package/dist/declarations/src/timing/index.d.ts +0 -2
  38. package/dist/declarations/src/timing/timing.d.ts +0 -17
  39. package/dist/promster-metrics.cjs.d.ts +0 -2
  40. package/dist/promster-metrics.cjs.dev.js +0 -410
  41. package/dist/promster-metrics.cjs.js +0 -7
  42. package/dist/promster-metrics.cjs.prod.js +0 -410
package/dist/index.cjs ADDED
@@ -0,0 +1,385 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let es_toolkit_function = require("es-toolkit/function");
25
+ let prom_client = require("prom-client");
26
+ prom_client = __toESM(prom_client, 1);
27
+ let merge_options = require("merge-options");
28
+ merge_options = __toESM(merge_options, 1);
29
+ let _chainsafe_prometheus_gc_stats = require("@chainsafe/prometheus-gc-stats");
30
+ let node_url = require("node:url");
31
+ node_url = __toESM(node_url, 1);
32
+ let url_value_parser = require("url-value-parser");
33
+ url_value_parser = __toESM(url_value_parser, 1);
34
+ //#region src/environment/kubernetes.ts
35
+ const isRunningInKubernetes = () => Boolean(process.env.KUBERNETES_SERVICE_HOST);
36
+ //#endregion
37
+ //#region src/environment/skip-metrics-in-environment.ts
38
+ const skipMetricsInEnvironment = (options) => options.detectKubernetes === true && !isRunningInKubernetes();
39
+ //#endregion
40
+ //#region src/client/client.ts
41
+ const defaultRegister = prom_client.register;
42
+ const configure = (0, es_toolkit_function.once)((options) => {
43
+ if (!skipMetricsInEnvironment(options)) prom_client.collectDefaultMetrics(options);
44
+ });
45
+ //#endregion
46
+ //#region src/create-gc-metrics/create-gc-metrics.ts
47
+ const asArray$2 = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
48
+ const defaultOptions$4 = {
49
+ getLabelValues: () => ({}),
50
+ labels: [],
51
+ metricPrefix: "",
52
+ metricNames: { up: ["nodejs_up"] },
53
+ gcCollectionInterval: 6e3
54
+ };
55
+ const getMetrics$2 = (options) => ({ up: asArray$2(options.metricNames.up).map((nameOfUpMetric) => new prom_client.Gauge({
56
+ name: `${options.metricPrefix}${nameOfUpMetric}`,
57
+ help: "1 = nodejs server is up, 0 = nodejs server is not up"
58
+ })) });
59
+ const createGcMetrics = (options) => {
60
+ const defaultedOptions = (0, merge_options.default)(defaultOptions$4, options);
61
+ configure({ prefix: defaultedOptions.metricPrefix });
62
+ return getMetrics$2(defaultedOptions);
63
+ };
64
+ createGcMetrics.defaultOptions = defaultOptions$4;
65
+ //#endregion
66
+ //#region src/create-gc-observer/create-gc-observer.ts
67
+ const defaultOptions$3 = { disableGcMetrics: false };
68
+ const createGcObserver = (0, es_toolkit_function.once)((_metrics, options) => () => {
69
+ (0, _chainsafe_prometheus_gc_stats.gcStats)(defaultRegister, {
70
+ collectionInterval: options.gcCollectionInterval,
71
+ prefix: options.metricPrefix
72
+ });
73
+ });
74
+ createGcObserver.defaultOptions = defaultOptions$3;
75
+ //#endregion
76
+ //#region src/create-graphql-metrics/create-graphql-metrics.ts
77
+ const defaultGraphQlPercentiles = [
78
+ .5,
79
+ .9,
80
+ .95,
81
+ .98,
82
+ .99
83
+ ];
84
+ const defaultLabels$1 = ["operation_name"];
85
+ const asArray$1 = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
86
+ const shouldObserveGraphQlParseDurationAsHistogram = (options) => options.metricTypes.includes("graphQlParseDurationHistogram");
87
+ const shouldObserveGraphQlValidationDurationAsHistogram = (options) => options.metricTypes.includes("graphQlValidationDurationHistogram");
88
+ const shouldObserveGraphQlResolveFieldDurationAsHistogram = (options) => options.metricTypes.includes("graphQlResolveFieldDurationHistogram");
89
+ const shouldObserveGraphQlRequestDurationAsHistogram = (options) => options.metricTypes.includes("graphQlRequestDurationHistogram");
90
+ const shouldObserveGraphQlErrorsTotalAsCounter = (options) => options.metricTypes.includes("graphQlErrorsTotal");
91
+ const defaultOptions$2 = {
92
+ getLabelValues: () => ({}),
93
+ labels: [],
94
+ metricPrefix: "",
95
+ metricTypes: [
96
+ "graphQlParseDurationHistogram",
97
+ "graphQlValidationDurationHistogram",
98
+ "graphQlResolveFieldDurationHistogram",
99
+ "graphQlRequestDurationHistogram",
100
+ "graphQlErrorsTotal"
101
+ ],
102
+ metricNames: {
103
+ graphQlParseDuration: ["graphql_parse_duration_seconds"],
104
+ graphQlValidationDuration: ["graphql_validation_duration_seconds"],
105
+ graphQlResolveFieldDuration: ["graphql_resolve_field_duration_seconds"],
106
+ graphQlRequestDuration: ["graphql_request_duration_seconds"],
107
+ graphQlErrorsTotal: ["graphql_errors_total"]
108
+ },
109
+ metricPercentiles: {
110
+ graphQlParseDuration: defaultGraphQlPercentiles,
111
+ graphQlValidationDuration: defaultGraphQlPercentiles,
112
+ graphQlResolveFieldDuration: defaultGraphQlPercentiles,
113
+ graphQlRequestDuration: defaultGraphQlPercentiles,
114
+ graphQlErrorsTotal: defaultGraphQlPercentiles
115
+ }
116
+ };
117
+ const getMetrics$1 = (options) => ({
118
+ graphQlParseDuration: shouldObserveGraphQlParseDurationAsHistogram(options) ? asArray$1(options.metricNames.graphQlParseDuration).map((nameOfGraphQlParseDuration) => new prom_client.Histogram({
119
+ name: `${options.metricPrefix}${nameOfGraphQlParseDuration}`,
120
+ help: "The GraphQL request parse time in seconds.",
121
+ labelNames: defaultLabels$1.concat(options.labels).toSorted(),
122
+ buckets: options.metricPercentiles?.graphQlParseDuration || defaultGraphQlPercentiles
123
+ })) : void 0,
124
+ graphQlValidationDuration: shouldObserveGraphQlValidationDurationAsHistogram(options) ? asArray$1(options.metricNames.graphQlValidationDuration).map((nameOfGraphQlValidationDuration) => new prom_client.Histogram({
125
+ name: `${options.metricPrefix}${nameOfGraphQlValidationDuration}`,
126
+ help: "The GraphQL request validation time in seconds.",
127
+ labelNames: defaultLabels$1.concat(options.labels).toSorted(),
128
+ buckets: options.metricPercentiles?.graphQlValidationDuration || defaultGraphQlPercentiles
129
+ })) : void 0,
130
+ graphQlResolveFieldDuration: shouldObserveGraphQlResolveFieldDurationAsHistogram(options) ? asArray$1(options.metricNames.graphQlResolveFieldDuration).map((nameOfGraphQlResolveFieldDuration) => new prom_client.Histogram({
131
+ name: `${options.metricPrefix}${nameOfGraphQlResolveFieldDuration}`,
132
+ help: "The GraphQL field resolving time in seconds.",
133
+ labelNames: defaultLabels$1.concat(["field_name"]).concat(options.labels).toSorted(),
134
+ buckets: options.metricPercentiles?.graphQlResolveFieldDuration || defaultGraphQlPercentiles
135
+ })) : void 0,
136
+ graphQlRequestDuration: shouldObserveGraphQlRequestDurationAsHistogram(options) ? asArray$1(options.metricNames.graphQlRequestDuration).map((nameOfGraphQlRequestDuration) => new prom_client.Histogram({
137
+ name: `${options.metricPrefix}${nameOfGraphQlRequestDuration}`,
138
+ help: "The GraphQL request duration time in seconds.",
139
+ labelNames: defaultLabels$1.concat(options.labels).toSorted(),
140
+ buckets: options.metricPercentiles?.graphQlRequestDuration || defaultGraphQlPercentiles
141
+ })) : void 0,
142
+ graphQlErrorsTotal: shouldObserveGraphQlErrorsTotalAsCounter(options) ? asArray$1(options.metricNames.graphQlErrorsTotal).map((nameOfGraphQlErrorsCount) => new prom_client.Counter({
143
+ name: `${options.metricPrefix}${nameOfGraphQlErrorsCount}`,
144
+ help: "Count of errors while parsing, validating, or executing a GraphQL operation.",
145
+ labelNames: defaultLabels$1.concat(["phase"]).concat(options.labels).toSorted()
146
+ })) : void 0
147
+ });
148
+ const createGraphQlMetrics = (options) => {
149
+ const defaultedOptions = (0, merge_options.default)(defaultOptions$2, options);
150
+ configure({ prefix: defaultedOptions.metricPrefix });
151
+ return getMetrics$1(defaultedOptions);
152
+ };
153
+ createGraphQlMetrics.defaultOptions = defaultOptions$2;
154
+ //#endregion
155
+ //#region src/create-http-metrics/create-http-metrics.ts
156
+ const defaultHttpRequestDurationPercentileInSeconds = [
157
+ .5,
158
+ .9,
159
+ .95,
160
+ .98,
161
+ .99
162
+ ];
163
+ const defaultHttpRequestDurationInSeconds = [
164
+ .05,
165
+ .1,
166
+ .3,
167
+ .5,
168
+ .8,
169
+ 1,
170
+ 1.5,
171
+ 2,
172
+ 3,
173
+ 10
174
+ ];
175
+ const defaultHttpContentLengthInBytes = [
176
+ 1e5,
177
+ 2e5,
178
+ 5e5,
179
+ 1e6,
180
+ 15e5,
181
+ 2e6,
182
+ 3e6,
183
+ 5e6,
184
+ 1e7
185
+ ];
186
+ const defaultLabels = [
187
+ "path",
188
+ "status_code",
189
+ "method"
190
+ ];
191
+ const asArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
192
+ const shouldObserveHttpRequestsAsSummary = (options) => options.metricTypes.includes("httpRequestsSummary");
193
+ const shouldObserveHttpRequestsAsHistogram = (options) => options.metricTypes.includes("httpRequestsHistogram");
194
+ const shouldObserveHttpRequestsAsCounter = (options) => options.metricTypes.includes("httpRequestsTotal");
195
+ const shouldObserveHttpContentLengthAsHistogram = (options) => options.metricTypes.includes("httpContentLengthHistogram");
196
+ const defaultOptions$1 = {
197
+ getLabelValues: () => ({}),
198
+ labels: [],
199
+ metricPrefix: "",
200
+ metricTypes: ["httpRequestsTotal", "httpRequestsHistogram"],
201
+ metricNames: {
202
+ httpRequestsTotal: ["http_requests_total"],
203
+ httpRequestDurationPerPercentileInSeconds: ["http_request_duration_per_percentile_seconds"],
204
+ httpRequestDurationInSeconds: ["http_request_duration_seconds"],
205
+ httpRequestContentLengthInBytes: ["http_request_content_length_bytes"],
206
+ httpResponseContentLengthInBytes: ["http_response_content_length_bytes"]
207
+ },
208
+ metricBuckets: {
209
+ httpRequestContentLengthInBytes: defaultHttpContentLengthInBytes,
210
+ httpRequestDurationInSeconds: defaultHttpRequestDurationInSeconds
211
+ },
212
+ metricPercentiles: {
213
+ httpRequestDurationPerPercentileInSeconds: defaultHttpRequestDurationPercentileInSeconds,
214
+ httpResponseContentLengthInBytes: defaultHttpContentLengthInBytes
215
+ }
216
+ };
217
+ const getMetrics = (options) => ({
218
+ httpRequestContentLengthInBytes: shouldObserveHttpContentLengthAsHistogram(options) ? asArray(options.metricNames.httpRequestContentLengthInBytes).map((nameOfHttpContentLengthMetric) => new prom_client.Histogram({
219
+ name: `${options.metricPrefix}${nameOfHttpContentLengthMetric}`,
220
+ help: "The HTTP request content length in bytes.",
221
+ labelNames: defaultLabels.concat(options.labels).toSorted(),
222
+ buckets: options.metricBuckets?.httpRequestContentLengthInBytes || defaultHttpContentLengthInBytes
223
+ })) : void 0,
224
+ httpResponseContentLengthInBytes: shouldObserveHttpContentLengthAsHistogram(options) ? asArray(options.metricNames.httpResponseContentLengthInBytes).map((nameOfHttpContentLengthMetric) => new prom_client.Histogram({
225
+ name: `${options.metricPrefix}${nameOfHttpContentLengthMetric}`,
226
+ help: "The HTTP response content length in bytes.",
227
+ labelNames: defaultLabels.concat(options.labels).toSorted(),
228
+ buckets: options.metricBuckets?.httpResponseContentLengthInBytes || defaultHttpContentLengthInBytes
229
+ })) : void 0
230
+ });
231
+ const getHttpRequestLatencyMetricsInSeconds = (options) => ({
232
+ httpRequestDurationPerPercentileInSeconds: shouldObserveHttpRequestsAsSummary(options) ? asArray(options.metricNames.httpRequestDurationPerPercentileInSeconds).map((nameOfHttpRequestDurationPerPercentileInSeconds) => new prom_client.Summary({
233
+ name: `${options.metricPrefix}${nameOfHttpRequestDurationPerPercentileInSeconds}`,
234
+ help: "The HTTP request latencies in seconds.",
235
+ labelNames: defaultLabels.concat(options.labels).toSorted(),
236
+ percentiles: options.metricPercentiles?.httpRequestDurationPerPercentileInSeconds || defaultHttpRequestDurationPercentileInSeconds
237
+ })) : void 0,
238
+ httpRequestDurationInSeconds: shouldObserveHttpRequestsAsHistogram(options) ? asArray(options.metricNames.httpRequestDurationInSeconds).map((nameOfHttpRequestDurationInSecondsMetric) => new prom_client.Histogram({
239
+ name: `${options.metricPrefix}${nameOfHttpRequestDurationInSecondsMetric}`,
240
+ help: "The HTTP request latencies in seconds.",
241
+ labelNames: defaultLabels.concat(options.labels).toSorted(),
242
+ buckets: options.metricBuckets?.httpRequestDurationInSeconds || defaultHttpRequestDurationInSeconds
243
+ })) : void 0
244
+ });
245
+ const getHttpRequestCounterMetric = (options) => ({ httpRequestsTotal: shouldObserveHttpRequestsAsCounter(options) ? asArray(options.metricNames.httpRequestsTotal).map((nameOfHttpRequestsTotalMetric) => new prom_client.Counter({
246
+ name: `${options.metricPrefix}${nameOfHttpRequestsTotalMetric}`,
247
+ help: "The total HTTP requests.",
248
+ labelNames: defaultLabels.concat(options.labels).toSorted()
249
+ })) : void 0 });
250
+ const createHttpMetrics = (options) => {
251
+ const defaultedOptions = (0, merge_options.default)(defaultOptions$1, options);
252
+ configure({ prefix: defaultedOptions.metricPrefix });
253
+ const metrics = getMetrics(defaultedOptions);
254
+ const httpRequestLatencyMetricsInSeconds = getHttpRequestLatencyMetricsInSeconds(defaultedOptions);
255
+ const httpRequestCounterMetric = getHttpRequestCounterMetric(defaultedOptions);
256
+ return Object.assign({}, metrics, httpRequestLatencyMetricsInSeconds, httpRequestCounterMetric);
257
+ };
258
+ createHttpMetrics.defaultOptions = defaultOptions$1;
259
+ //#endregion
260
+ //#region src/end-measurement-from/end-measurement-from.ts
261
+ const NS_PER_SEC = 1e9;
262
+ function endMeasurementFrom(start) {
263
+ const [seconds, nanoseconds] = process.hrtime(start);
264
+ return { durationS: (seconds * NS_PER_SEC + nanoseconds) / NS_PER_SEC };
265
+ }
266
+ //#endregion
267
+ //#region src/sort-labels/sort-labels.ts
268
+ function sortLabels(unsortedLabels) {
269
+ return Object.keys(unsortedLabels).toSorted((a, b) => {
270
+ if (a < b) return -1;
271
+ if (a > b) return 1;
272
+ return 0;
273
+ }).reduce((sortedLabels, labelName) => {
274
+ sortedLabels[labelName] = unsortedLabels[labelName];
275
+ return sortedLabels;
276
+ }, {});
277
+ }
278
+ //#endregion
279
+ //#region src/create-request-recorder/create-request-recorder.ts
280
+ const defaultOptions = { detectKubernetes: false };
281
+ function isTiming(timing) {
282
+ return !Array.isArray(timing);
283
+ }
284
+ const createRequestRecorder = (metrics, options = defaultOptions) => {
285
+ const shouldSkipMetricsByEnvironment = skipMetricsInEnvironment((0, merge_options.default)(defaultOptions, options));
286
+ return (timing, recordingOptions) => {
287
+ const durationS = isTiming(timing) ? timing.end().value().seconds : endMeasurementFrom(timing).durationS;
288
+ const labels = sortLabels(recordingOptions.labels);
289
+ if (!shouldSkipMetricsByEnvironment && durationS !== void 0) {
290
+ if (metrics.httpRequestDurationInSeconds) for (const httpRequestDurationInSecondsMetricType of metrics.httpRequestDurationInSeconds) httpRequestDurationInSecondsMetricType.observe(labels, durationS);
291
+ }
292
+ if (!shouldSkipMetricsByEnvironment && durationS !== void 0) {
293
+ if (metrics.httpRequestDurationPerPercentileInSeconds) for (const httpRequestDurationPerPercentileInSecondsMetricType of metrics.httpRequestDurationPerPercentileInSeconds) httpRequestDurationPerPercentileInSecondsMetricType.observe(labels, durationS);
294
+ }
295
+ if (!shouldSkipMetricsByEnvironment && durationS !== void 0) {
296
+ if (metrics.httpRequestsTotal) for (const httpRequestsTotalMetricType of metrics.httpRequestsTotal) httpRequestsTotalMetricType.inc(labels);
297
+ }
298
+ if (recordingOptions.requestContentLength) {
299
+ if (metrics.httpRequestContentLengthInBytes) for (const httpRequestContentLengthInBytesMetricType of metrics.httpRequestContentLengthInBytes) httpRequestContentLengthInBytesMetricType.observe(labels, recordingOptions.requestContentLength);
300
+ }
301
+ if (recordingOptions.responseContentLength) {
302
+ if (metrics.httpResponseContentLengthInBytes) for (const httpResponseContentLengthInBytesMetricType of metrics.httpResponseContentLengthInBytes) httpResponseContentLengthInBytesMetricType.observe(labels, recordingOptions.responseContentLength);
303
+ }
304
+ };
305
+ };
306
+ createRequestRecorder.defaultOptions = defaultOptions;
307
+ //#endregion
308
+ //#region src/normalizers/method/method.ts
309
+ const normalizeMethod = (method) => method.toLowerCase();
310
+ //#endregion
311
+ //#region src/normalizers/path/path.ts
312
+ const urlValueParser = new url_value_parser.default();
313
+ const normalizePath = (path) => {
314
+ const parsedPathname = node_url.default.parse(path).pathname;
315
+ if (!parsedPathname) return "";
316
+ return urlValueParser.replacePathValues(parsedPathname, "#val");
317
+ };
318
+ //#endregion
319
+ //#region src/normalizers/status-code/status-code.ts
320
+ const normalizeStatusCode = (statusCode) => statusCode;
321
+ //#endregion
322
+ //#region src/normalizers/index.ts
323
+ const defaultNormalizers = {
324
+ normalizeStatusCode,
325
+ normalizePath,
326
+ normalizeMethod
327
+ };
328
+ //#endregion
329
+ //#region src/summary/summary.ts
330
+ const getSummary = async () => defaultRegister.metrics();
331
+ const getContentType = () => defaultRegister.contentType;
332
+ //#endregion
333
+ //#region src/timing/timing.ts
334
+ var Timing = class Timing {
335
+ static NS_PER_SEC = BigInt(1e9);
336
+ #startTime;
337
+ #endTime;
338
+ constructor() {
339
+ this.reset();
340
+ }
341
+ value() {
342
+ const startTime = this.#startTime;
343
+ const endTime = this.#endTime;
344
+ if (!endTime || !startTime) return { seconds: void 0 };
345
+ return { seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC) };
346
+ }
347
+ reset() {
348
+ this.#startTime = process.hrtime.bigint();
349
+ this.#endTime = void 0;
350
+ return this;
351
+ }
352
+ end() {
353
+ this.#endTime = process.hrtime.bigint();
354
+ return this;
355
+ }
356
+ };
357
+ const timing = { start() {
358
+ return new Timing();
359
+ } };
360
+ //#endregion
361
+ Object.defineProperty(exports, "Prometheus", {
362
+ enumerable: true,
363
+ get: function() {
364
+ return prom_client;
365
+ }
366
+ });
367
+ exports.createGcMetrics = createGcMetrics;
368
+ exports.createGcObserver = createGcObserver;
369
+ exports.createGraphQlMetrics = createGraphQlMetrics;
370
+ exports.createHttpMetrics = createHttpMetrics;
371
+ exports.createRequestRecorder = createRequestRecorder;
372
+ exports.defaultNormalizers = defaultNormalizers;
373
+ exports.defaultRegister = defaultRegister;
374
+ exports.endMeasurementFrom = endMeasurementFrom;
375
+ exports.getContentType = getContentType;
376
+ exports.getSummary = getSummary;
377
+ exports.isRunningInKubernetes = isRunningInKubernetes;
378
+ exports.normalizeMethod = normalizeMethod;
379
+ exports.normalizePath = normalizePath;
380
+ exports.normalizeStatusCode = normalizeStatusCode;
381
+ exports.skipMetricsInEnvironment = skipMetricsInEnvironment;
382
+ exports.sortLabels = sortLabels;
383
+ exports.timing = timing;
384
+
385
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["Prometheus","asArray","defaultOptions","getMetrics","Prometheus","defaultOptions","defaultLabels","asArray","defaultOptions","getMetrics","Prometheus","defaultOptions","Prometheus","UrlValueParser","url","#startTime","#endTime"],"sources":["../src/environment/kubernetes.ts","../src/environment/skip-metrics-in-environment.ts","../src/client/client.ts","../src/create-gc-metrics/create-gc-metrics.ts","../src/create-gc-observer/create-gc-observer.ts","../src/create-graphql-metrics/create-graphql-metrics.ts","../src/create-http-metrics/create-http-metrics.ts","../src/end-measurement-from/end-measurement-from.ts","../src/sort-labels/sort-labels.ts","../src/create-request-recorder/create-request-recorder.ts","../src/normalizers/method/method.ts","../src/normalizers/path/path.ts","../src/normalizers/status-code/status-code.ts","../src/normalizers/index.ts","../src/summary/summary.ts","../src/timing/timing.ts"],"sourcesContent":["const isRunningInKubernetes = () =>\n Boolean(process.env.KUBERNETES_SERVICE_HOST);\n\nexport { isRunningInKubernetes };\n","import type { TOptionalPromsterOptions } from '@promster/types';\n\nimport { isRunningInKubernetes } from './kubernetes';\n\ntype TSkipMetricsInEnvironmentOptions = {\n detectKubernetes?: TOptionalPromsterOptions['detectKubernetes'];\n};\n\nconst skipMetricsInEnvironment = (options: TSkipMetricsInEnvironmentOptions) =>\n options.detectKubernetes === true && !isRunningInKubernetes();\n\nexport { skipMetricsInEnvironment };\n","import { once } from 'es-toolkit/function';\nimport type { PrometheusContentType } from 'prom-client';\nimport * as Prometheus from 'prom-client';\n\nimport { skipMetricsInEnvironment } from '../environment';\n\n// NOTE:\n// This is the `globalRegistry` provided by the `prom-client`\n// We could create multiple registries with `new Prometheus.registry()`.\nconst defaultRegister = Prometheus.register;\n\ninterface TClientOptions extends Prometheus.DefaultMetricsCollectorConfiguration<PrometheusContentType> {\n detectKubernetes?: boolean;\n prefix?: string;\n}\n\nconst configure = once((options: TClientOptions) => {\n const shouldSkipMetricsInEnvironment = skipMetricsInEnvironment(options);\n\n if (!shouldSkipMetricsInEnvironment) {\n Prometheus.collectDefaultMetrics(options);\n }\n});\n\nexport { Prometheus, defaultRegister, configure };\n","import type { TDefaultedPromsterOptions, TGcMetrics } from '@promster/types';\nimport merge from 'merge-options';\n\nimport { configure, Prometheus } from '../client';\n\nconst asArray = (maybeArray: Readonly<string[] | string>) =>\n Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n\nconst defaultOptions = {\n getLabelValues: () => ({}),\n labels: [],\n metricPrefix: '',\n metricNames: {\n up: ['nodejs_up'],\n },\n gcCollectionInterval: 6000,\n};\n\nconst getMetrics = (options: TDefaultedPromsterOptions) => ({\n up: asArray(options.metricNames.up).map(\n (nameOfUpMetric: string) =>\n new Prometheus.Gauge({\n name: `${options.metricPrefix}${nameOfUpMetric}`,\n help: '1 = nodejs server is up, 0 = nodejs server is not up',\n }),\n ),\n});\n\nconst createGcMetrics = (options: TDefaultedPromsterOptions): TGcMetrics => {\n const defaultedOptions: TDefaultedPromsterOptions = merge(\n defaultOptions,\n options,\n );\n\n configure({\n prefix: defaultedOptions.metricPrefix,\n });\n\n const gcMetrics = getMetrics(defaultedOptions);\n\n return gcMetrics;\n};\n\ncreateGcMetrics.defaultOptions = defaultOptions;\n\nexport { createGcMetrics };\n","import { gcStats } from '@chainsafe/prometheus-gc-stats';\nimport type { TDefaultedPromsterOptions, TGcMetrics } from '@promster/types';\nimport { once } from 'es-toolkit/function';\n\nimport { defaultRegister } from '../client/client';\n\nconst defaultOptions = {\n disableGcMetrics: false,\n};\n\nconst createGcObserver = once(\n (_metrics: TGcMetrics, options: TDefaultedPromsterOptions) => () => {\n gcStats(defaultRegister, {\n collectionInterval: options.gcCollectionInterval,\n prefix: options.metricPrefix,\n });\n },\n);\n\n// @ts-expect-error\ncreateGcObserver.defaultOptions = defaultOptions;\n\nexport { createGcObserver };\n","import type {\n TDefaultedPromsterOptions,\n TGraphQlMetrics,\n} from '@promster/types';\nimport merge from 'merge-options';\n\nimport { configure, Prometheus } from '../client';\n\nconst defaultGraphQlPercentiles = [0.5, 0.9, 0.95, 0.98, 0.99];\n\nconst defaultLabels = ['operation_name'];\nconst asArray = (maybeArray: Readonly<string[] | string>) =>\n Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n\nconst shouldObserveGraphQlParseDurationAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('graphQlParseDurationHistogram');\nconst shouldObserveGraphQlValidationDurationAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('graphQlValidationDurationHistogram');\nconst shouldObserveGraphQlResolveFieldDurationAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('graphQlResolveFieldDurationHistogram');\nconst shouldObserveGraphQlRequestDurationAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('graphQlRequestDurationHistogram');\nconst shouldObserveGraphQlErrorsTotalAsCounter = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('graphQlErrorsTotal');\n\nconst defaultOptions = {\n getLabelValues: () => ({}),\n labels: [],\n metricPrefix: '',\n metricTypes: [\n 'graphQlParseDurationHistogram',\n 'graphQlValidationDurationHistogram',\n 'graphQlResolveFieldDurationHistogram',\n 'graphQlRequestDurationHistogram',\n 'graphQlErrorsTotal',\n ],\n metricNames: {\n graphQlParseDuration: ['graphql_parse_duration_seconds'],\n graphQlValidationDuration: ['graphql_validation_duration_seconds'],\n graphQlResolveFieldDuration: ['graphql_resolve_field_duration_seconds'],\n graphQlRequestDuration: ['graphql_request_duration_seconds'],\n graphQlErrorsTotal: ['graphql_errors_total'],\n },\n metricPercentiles: {\n graphQlParseDuration: defaultGraphQlPercentiles,\n graphQlValidationDuration: defaultGraphQlPercentiles,\n graphQlResolveFieldDuration: defaultGraphQlPercentiles,\n graphQlRequestDuration: defaultGraphQlPercentiles,\n graphQlErrorsTotal: defaultGraphQlPercentiles,\n },\n};\n\nconst getMetrics = (options: TDefaultedPromsterOptions) => ({\n graphQlParseDuration: shouldObserveGraphQlParseDurationAsHistogram(options)\n ? asArray(options.metricNames.graphQlParseDuration).map(\n (nameOfGraphQlParseDuration: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfGraphQlParseDuration}`,\n help: 'The GraphQL request parse time in seconds.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricPercentiles?.graphQlParseDuration ||\n defaultGraphQlPercentiles,\n }),\n )\n : undefined,\n\n graphQlValidationDuration: shouldObserveGraphQlValidationDurationAsHistogram(\n options,\n )\n ? asArray(options.metricNames.graphQlValidationDuration).map(\n (nameOfGraphQlValidationDuration: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfGraphQlValidationDuration}`,\n help: 'The GraphQL request validation time in seconds.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricPercentiles?.graphQlValidationDuration ||\n defaultGraphQlPercentiles,\n }),\n )\n : undefined,\n\n graphQlResolveFieldDuration:\n shouldObserveGraphQlResolveFieldDurationAsHistogram(options)\n ? asArray(options.metricNames.graphQlResolveFieldDuration).map(\n (nameOfGraphQlResolveFieldDuration: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfGraphQlResolveFieldDuration}`,\n help: 'The GraphQL field resolving time in seconds.',\n labelNames: defaultLabels\n .concat(['field_name'])\n .concat(options.labels)\n .toSorted(),\n buckets:\n options.metricPercentiles?.graphQlResolveFieldDuration ||\n defaultGraphQlPercentiles,\n }),\n )\n : undefined,\n\n graphQlRequestDuration: shouldObserveGraphQlRequestDurationAsHistogram(\n options,\n )\n ? asArray(options.metricNames.graphQlRequestDuration).map(\n (nameOfGraphQlRequestDuration: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfGraphQlRequestDuration}`,\n help: 'The GraphQL request duration time in seconds.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricPercentiles?.graphQlRequestDuration ||\n defaultGraphQlPercentiles,\n }),\n )\n : undefined,\n\n graphQlErrorsTotal: shouldObserveGraphQlErrorsTotalAsCounter(options)\n ? asArray(options.metricNames.graphQlErrorsTotal).map(\n (nameOfGraphQlErrorsCount: string) =>\n new Prometheus.Counter({\n name: `${options.metricPrefix}${nameOfGraphQlErrorsCount}`,\n help: 'Count of errors while parsing, validating, or executing a GraphQL operation.',\n labelNames: defaultLabels\n .concat(['phase'])\n .concat(options.labels)\n .toSorted(),\n }),\n )\n : undefined,\n});\n\nconst createGraphQlMetrics = (\n options: TDefaultedPromsterOptions,\n): TGraphQlMetrics => {\n const defaultedOptions: TDefaultedPromsterOptions = merge(\n defaultOptions,\n options,\n );\n\n configure({\n prefix: defaultedOptions.metricPrefix,\n });\n\n const metrics = getMetrics(defaultedOptions);\n\n return metrics;\n};\n\ncreateGraphQlMetrics.defaultOptions = defaultOptions;\n\nexport { createGraphQlMetrics };\n","import type { TDefaultedPromsterOptions, THttpMetrics } from '@promster/types';\nimport merge from 'merge-options';\n\nimport { configure, Prometheus } from '../client';\n\nconst defaultHttpRequestDurationPercentileInSeconds = [\n 0.5, 0.9, 0.95, 0.98, 0.99,\n];\nconst defaultHttpRequestDurationInSeconds = [\n 0.05, 0.1, 0.3, 0.5, 0.8, 1, 1.5, 2, 3, 10,\n];\nconst defaultHttpContentLengthInBytes = [\n 100000, 200000, 500000, 1000000, 1500000, 2000000, 3000000, 5000000, 10000000,\n];\n\nconst defaultLabels = ['path', 'status_code', 'method'];\nconst asArray = (maybeArray: Readonly<string[] | string>) =>\n Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n\nconst shouldObserveHttpRequestsAsSummary = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('httpRequestsSummary');\nconst shouldObserveHttpRequestsAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('httpRequestsHistogram');\nconst shouldObserveHttpRequestsAsCounter = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('httpRequestsTotal');\nconst shouldObserveHttpContentLengthAsHistogram = (\n options: TDefaultedPromsterOptions,\n) => options.metricTypes.includes('httpContentLengthHistogram');\n\nconst defaultOptions = {\n getLabelValues: () => ({}),\n labels: [],\n metricPrefix: '',\n metricTypes: ['httpRequestsTotal', 'httpRequestsHistogram'],\n metricNames: {\n httpRequestsTotal: ['http_requests_total'],\n httpRequestDurationPerPercentileInSeconds: [\n 'http_request_duration_per_percentile_seconds',\n ],\n httpRequestDurationInSeconds: ['http_request_duration_seconds'],\n httpRequestContentLengthInBytes: ['http_request_content_length_bytes'],\n httpResponseContentLengthInBytes: ['http_response_content_length_bytes'],\n },\n metricBuckets: {\n httpRequestContentLengthInBytes: defaultHttpContentLengthInBytes,\n httpRequestDurationInSeconds: defaultHttpRequestDurationInSeconds,\n },\n metricPercentiles: {\n httpRequestDurationPerPercentileInSeconds:\n defaultHttpRequestDurationPercentileInSeconds,\n httpResponseContentLengthInBytes: defaultHttpContentLengthInBytes,\n },\n};\n\nconst getMetrics = (options: TDefaultedPromsterOptions) => ({\n httpRequestContentLengthInBytes: shouldObserveHttpContentLengthAsHistogram(\n options,\n )\n ? asArray(options.metricNames.httpRequestContentLengthInBytes).map(\n (nameOfHttpContentLengthMetric: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfHttpContentLengthMetric}`,\n help: 'The HTTP request content length in bytes.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricBuckets?.httpRequestContentLengthInBytes ||\n defaultHttpContentLengthInBytes,\n }),\n )\n : undefined,\n\n httpResponseContentLengthInBytes: shouldObserveHttpContentLengthAsHistogram(\n options,\n )\n ? asArray(options.metricNames.httpResponseContentLengthInBytes).map(\n (nameOfHttpContentLengthMetric: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfHttpContentLengthMetric}`,\n help: 'The HTTP response content length in bytes.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricBuckets?.httpResponseContentLengthInBytes ||\n defaultHttpContentLengthInBytes,\n }),\n )\n : undefined,\n});\n\nconst getHttpRequestLatencyMetricsInSeconds = (\n options: TDefaultedPromsterOptions,\n) => ({\n httpRequestDurationPerPercentileInSeconds: shouldObserveHttpRequestsAsSummary(\n options,\n )\n ? asArray(\n options.metricNames.httpRequestDurationPerPercentileInSeconds,\n ).map(\n (nameOfHttpRequestDurationPerPercentileInSeconds: string) =>\n new Prometheus.Summary({\n name: `${options.metricPrefix}${nameOfHttpRequestDurationPerPercentileInSeconds}`,\n help: 'The HTTP request latencies in seconds.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n percentiles:\n options.metricPercentiles\n ?.httpRequestDurationPerPercentileInSeconds ||\n defaultHttpRequestDurationPercentileInSeconds,\n }),\n )\n : undefined,\n\n httpRequestDurationInSeconds: shouldObserveHttpRequestsAsHistogram(options)\n ? asArray(options.metricNames.httpRequestDurationInSeconds).map(\n (nameOfHttpRequestDurationInSecondsMetric: string) =>\n new Prometheus.Histogram({\n name: `${options.metricPrefix}${nameOfHttpRequestDurationInSecondsMetric}`,\n help: 'The HTTP request latencies in seconds.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n buckets:\n options.metricBuckets?.httpRequestDurationInSeconds ||\n defaultHttpRequestDurationInSeconds,\n }),\n )\n : undefined,\n});\n\nconst getHttpRequestCounterMetric = (options: TDefaultedPromsterOptions) => ({\n httpRequestsTotal: shouldObserveHttpRequestsAsCounter(options)\n ? asArray(options.metricNames.httpRequestsTotal).map(\n (nameOfHttpRequestsTotalMetric: string) =>\n new Prometheus.Counter({\n name: `${options.metricPrefix}${nameOfHttpRequestsTotalMetric}`,\n help: 'The total HTTP requests.',\n labelNames: defaultLabels.concat(options.labels).toSorted(),\n }),\n )\n : undefined,\n});\n\nconst createHttpMetrics = (\n options: TDefaultedPromsterOptions,\n): THttpMetrics => {\n const defaultedOptions: TDefaultedPromsterOptions = merge(\n defaultOptions,\n options,\n );\n\n configure({\n prefix: defaultedOptions.metricPrefix,\n });\n\n const metrics = getMetrics(defaultedOptions);\n\n const httpRequestLatencyMetricsInSeconds =\n getHttpRequestLatencyMetricsInSeconds(defaultedOptions);\n const httpRequestCounterMetric =\n getHttpRequestCounterMetric(defaultedOptions);\n\n return Object.assign(\n {},\n metrics,\n httpRequestLatencyMetricsInSeconds,\n httpRequestCounterMetric,\n );\n};\n\ncreateHttpMetrics.defaultOptions = defaultOptions;\n\nexport { createHttpMetrics };\n","const NS_PER_SEC = 1e9;\n\nfunction endMeasurementFrom(start: [number, number]) {\n const [seconds, nanoseconds] = process.hrtime(start);\n\n return {\n durationS: (seconds * NS_PER_SEC + nanoseconds) / NS_PER_SEC,\n };\n}\n\nexport { endMeasurementFrom };\n","import type { TLabelValues } from '@promster/types';\n\nfunction sortLabels(unsortedLabels: TLabelValues): TLabelValues {\n return Object.keys(unsortedLabels)\n .toSorted((a, b) => {\n if (a < b) {\n return -1;\n }\n\n if (a > b) {\n return 1;\n }\n\n return 0;\n })\n .reduce<TLabelValues>((sortedLabels, labelName) => {\n sortedLabels[labelName] = unsortedLabels[labelName];\n return sortedLabels;\n }, {});\n}\n\nexport { sortLabels };\n","import type {\n TDefaultedPromsterOptions,\n THttpMetrics,\n TLabelValues,\n TOptionalPromsterOptions,\n} from '@promster/types';\nimport merge from 'merge-options';\n\nimport { endMeasurementFrom } from '../end-measurement-from';\nimport { skipMetricsInEnvironment } from '../environment';\nimport { sortLabels } from '../sort-labels';\nimport type { Timing } from '../timing';\n\ntype TRecordingOptions = {\n labels: TLabelValues;\n requestContentLength?: number;\n responseContentLength?: number;\n};\n\ntype TLegacyTiming = [number, number];\nexport type TRequestRecorder = (\n _timing: Timing | TLegacyTiming,\n _recordingOptions: TRecordingOptions,\n) => void;\n\nconst defaultOptions: TOptionalPromsterOptions = {\n detectKubernetes: false,\n};\n\nfunction isTiming(timing: Timing | TLegacyTiming): timing is Timing {\n return !Array.isArray(timing);\n}\n\nconst createRequestRecorder = (\n metrics: THttpMetrics,\n options: TOptionalPromsterOptions = defaultOptions,\n): TRequestRecorder => {\n const defaultedRecorderOptions: TDefaultedPromsterOptions = merge(\n defaultOptions,\n options,\n );\n const shouldSkipMetricsByEnvironment = skipMetricsInEnvironment(\n defaultedRecorderOptions,\n );\n\n return (\n timing: Timing | TLegacyTiming,\n recordingOptions: TRecordingOptions,\n ) => {\n const durationS = isTiming(timing)\n ? timing.end().value().seconds\n : endMeasurementFrom(timing).durationS;\n\n const labels = sortLabels(recordingOptions.labels);\n\n if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {\n if (metrics.httpRequestDurationInSeconds) {\n for (const httpRequestDurationInSecondsMetricType of metrics.httpRequestDurationInSeconds) {\n httpRequestDurationInSecondsMetricType.observe(labels, durationS);\n }\n }\n }\n\n if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {\n if (metrics.httpRequestDurationPerPercentileInSeconds) {\n for (const httpRequestDurationPerPercentileInSecondsMetricType of metrics.httpRequestDurationPerPercentileInSeconds) {\n httpRequestDurationPerPercentileInSecondsMetricType.observe(\n labels,\n durationS,\n );\n }\n }\n }\n\n if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {\n if (metrics.httpRequestsTotal) {\n for (const httpRequestsTotalMetricType of metrics.httpRequestsTotal) {\n httpRequestsTotalMetricType.inc(labels);\n }\n }\n }\n\n if (recordingOptions.requestContentLength) {\n if (metrics.httpRequestContentLengthInBytes) {\n for (const httpRequestContentLengthInBytesMetricType of metrics.httpRequestContentLengthInBytes) {\n httpRequestContentLengthInBytesMetricType.observe(\n labels,\n recordingOptions.requestContentLength,\n );\n }\n }\n }\n\n if (recordingOptions.responseContentLength) {\n if (metrics.httpResponseContentLengthInBytes) {\n for (const httpResponseContentLengthInBytesMetricType of metrics.httpResponseContentLengthInBytes) {\n httpResponseContentLengthInBytesMetricType.observe(\n labels,\n recordingOptions.responseContentLength,\n );\n }\n }\n }\n };\n};\n\ncreateRequestRecorder.defaultOptions = defaultOptions;\n\nexport { createRequestRecorder, sortLabels, endMeasurementFrom };\n","const normalizeMethod = (method: string): string => method.toLowerCase();\n\nexport { normalizeMethod };\n","import url from 'node:url';\n\nimport UrlValueParser from 'url-value-parser';\n\nconst urlValueParser = new UrlValueParser();\n\nconst normalizePath = (path: string): string => {\n const parsedPathname = url.parse(path).pathname;\n\n if (!parsedPathname) {\n return '';\n }\n\n return urlValueParser.replacePathValues(parsedPathname, '#val');\n};\n\nexport { normalizePath };\n","const normalizeStatusCode = (statusCode: number): number => statusCode;\n\nexport { normalizeStatusCode };\n","import { normalizeMethod } from './method';\nimport { normalizePath } from './path';\nimport { normalizeStatusCode } from './status-code';\n\nconst defaultNormalizers = {\n normalizeStatusCode,\n normalizePath,\n normalizeMethod,\n};\n\nexport {\n normalizeStatusCode,\n normalizePath,\n normalizeMethod,\n defaultNormalizers,\n};\n","import { defaultRegister } from '../client';\n\nconst getSummary = async () => defaultRegister.metrics();\nconst getContentType = () => defaultRegister.contentType;\n\nexport { getSummary, getContentType };\n","class Timing {\n static NS_PER_SEC = BigInt(1e9);\n\n #startTime?: bigint;\n #endTime?: bigint;\n\n constructor() {\n this.reset();\n }\n\n value() {\n const startTime = this.#startTime;\n const endTime = this.#endTime;\n\n if (!endTime || !startTime) {\n return { seconds: undefined };\n }\n\n return { seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC) };\n }\n\n reset() {\n this.#startTime = process.hrtime.bigint();\n this.#endTime = undefined;\n\n return this;\n }\n\n end() {\n this.#endTime = process.hrtime.bigint();\n\n return this;\n }\n}\n\nconst timing = {\n start() {\n return new Timing();\n },\n};\n\nexport default timing;\nexport { Timing };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,8BACJ,QAAQ,QAAQ,IAAI,uBAAuB;;;ACO7C,MAAM,4BAA4B,YAChC,QAAQ,qBAAqB,QAAQ,CAAC,sBAAsB;;;ACA9D,MAAM,kBAAkBA,YAAW;AAOnC,MAAM,aAAA,GAAA,oBAAA,KAAA,EAAkB,YAA4B;CAGlD,IAAI,CAFmC,yBAAyB,OAE9B,GAChC,YAAW,sBAAsB,OAAO;AAE5C,CAAC;;;ACjBD,MAAMC,aAAW,eACf,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU;AAEtD,MAAMC,mBAAiB;CACrB,uBAAuB,CAAC;CACxB,QAAQ,CAAC;CACT,cAAc;CACd,aAAa,EACX,IAA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AuB,eAA+B;;;ACI5D,MAAM,qBAAqB;CACzB;CACA;CACA;AACF;;;ACNA,MAAM,aAAa,YAAY,gBAAgB,QAAQ;AACvD,MAAM,uBAAuB,gBAAgB;;;ACH7C,IAAM,SAAN,MAAM,OAAO;CACX,OAAO,aAAa,OAAO,GAAG;CAE9B;CACA;CAEA,cAAc;EACZ,KAAK,MAAM;CACb;CAEA,QAAQ;EACN,MAAM,YAAY,KAAKC;EACvB,MAAM,UAAU,KAAKC;EAErB,IAAI,CAAC,WAAW,CAAC,WACf,OAAO,EAAE,SAAS,KAAA,EAAU;EAG9B,OAAO,EAAE,SAAS,OAAO,UAAU,SAAS,IAAI,OAAO,OAAO,UAAU,EAAE;CAC5E;CAEA,QAAQ;EACN,KAAKD,aAAa,QAAQ,OAAO,OAAO;EACxC,KAAKC,WAAW,KAAA;EAEhB,OAAO;CACT;CAEA,MAAM;EACJ,KAAKA,WAAW,QAAQ,OAAO,OAAO;EAEtC,OAAO;CACT;AACF;AAEA,MAAM,SAAS,EACb,QAAQ;CACN,OAAO,IAAI,OAAO;AACpB,EACF"}
@@ -0,0 +1,144 @@
1
+ import * as Prometheus from "prom-client";
2
+ import { TDefaultedPromsterOptions, TGcMetrics, TGraphQlMetrics, THttpMetrics, TLabelValues, TOptionalPromsterOptions } from "@promster/types";
3
+ export type * from "@promster/types";
4
+
5
+ //#region src/client/client.d.ts
6
+ declare const defaultRegister: Prometheus.Registry<"text/plain; version=0.0.4; charset=utf-8">;
7
+ //#endregion
8
+ //#region src/create-gc-metrics/create-gc-metrics.d.ts
9
+ declare const createGcMetrics: {
10
+ (options: TDefaultedPromsterOptions): TGcMetrics;
11
+ defaultOptions: {
12
+ getLabelValues: () => {};
13
+ labels: never[];
14
+ metricPrefix: string;
15
+ metricNames: {
16
+ up: string[];
17
+ };
18
+ gcCollectionInterval: number;
19
+ };
20
+ };
21
+ //#endregion
22
+ //#region src/create-gc-observer/create-gc-observer.d.ts
23
+ declare const createGcObserver: (_metrics: TGcMetrics, options: TDefaultedPromsterOptions) => () => void;
24
+ //#endregion
25
+ //#region src/create-graphql-metrics/create-graphql-metrics.d.ts
26
+ declare const createGraphQlMetrics: {
27
+ (options: TDefaultedPromsterOptions): TGraphQlMetrics;
28
+ defaultOptions: {
29
+ getLabelValues: () => {};
30
+ labels: never[];
31
+ metricPrefix: string;
32
+ metricTypes: string[];
33
+ metricNames: {
34
+ graphQlParseDuration: string[];
35
+ graphQlValidationDuration: string[];
36
+ graphQlResolveFieldDuration: string[];
37
+ graphQlRequestDuration: string[];
38
+ graphQlErrorsTotal: string[];
39
+ };
40
+ metricPercentiles: {
41
+ graphQlParseDuration: number[];
42
+ graphQlValidationDuration: number[];
43
+ graphQlResolveFieldDuration: number[];
44
+ graphQlRequestDuration: number[];
45
+ graphQlErrorsTotal: number[];
46
+ };
47
+ };
48
+ };
49
+ //#endregion
50
+ //#region src/create-http-metrics/create-http-metrics.d.ts
51
+ declare const createHttpMetrics: {
52
+ (options: TDefaultedPromsterOptions): THttpMetrics;
53
+ defaultOptions: {
54
+ getLabelValues: () => {};
55
+ labels: never[];
56
+ metricPrefix: string;
57
+ metricTypes: string[];
58
+ metricNames: {
59
+ httpRequestsTotal: string[];
60
+ httpRequestDurationPerPercentileInSeconds: string[];
61
+ httpRequestDurationInSeconds: string[];
62
+ httpRequestContentLengthInBytes: string[];
63
+ httpResponseContentLengthInBytes: string[];
64
+ };
65
+ metricBuckets: {
66
+ httpRequestContentLengthInBytes: number[];
67
+ httpRequestDurationInSeconds: number[];
68
+ };
69
+ metricPercentiles: {
70
+ httpRequestDurationPerPercentileInSeconds: number[];
71
+ httpResponseContentLengthInBytes: number[];
72
+ };
73
+ };
74
+ };
75
+ //#endregion
76
+ //#region src/end-measurement-from/end-measurement-from.d.ts
77
+ declare function endMeasurementFrom(start: [number, number]): {
78
+ durationS: number;
79
+ };
80
+ //#endregion
81
+ //#region src/sort-labels/sort-labels.d.ts
82
+ declare function sortLabels(unsortedLabels: TLabelValues): TLabelValues;
83
+ //#endregion
84
+ //#region src/timing/timing.d.ts
85
+ declare class Timing {
86
+ #private;
87
+ static NS_PER_SEC: bigint;
88
+ constructor();
89
+ value(): {
90
+ seconds: undefined;
91
+ } | {
92
+ seconds: number;
93
+ };
94
+ reset(): this;
95
+ end(): this;
96
+ }
97
+ declare const timing: {
98
+ start(): Timing;
99
+ };
100
+ //#endregion
101
+ //#region src/create-request-recorder/create-request-recorder.d.ts
102
+ type TRecordingOptions = {
103
+ labels: TLabelValues;
104
+ requestContentLength?: number;
105
+ responseContentLength?: number;
106
+ };
107
+ type TLegacyTiming = [number, number];
108
+ type TRequestRecorder = (_timing: Timing | TLegacyTiming, _recordingOptions: TRecordingOptions) => void;
109
+ declare const createRequestRecorder: {
110
+ (metrics: THttpMetrics, options?: TOptionalPromsterOptions): TRequestRecorder;
111
+ defaultOptions: TOptionalPromsterOptions;
112
+ };
113
+ //#endregion
114
+ //#region src/environment/kubernetes.d.ts
115
+ declare const isRunningInKubernetes: () => boolean;
116
+ //#endregion
117
+ //#region src/environment/skip-metrics-in-environment.d.ts
118
+ type TSkipMetricsInEnvironmentOptions = {
119
+ detectKubernetes?: TOptionalPromsterOptions['detectKubernetes'];
120
+ };
121
+ declare const skipMetricsInEnvironment: (options: TSkipMetricsInEnvironmentOptions) => boolean;
122
+ //#endregion
123
+ //#region src/normalizers/method/method.d.ts
124
+ declare const normalizeMethod: (method: string) => string;
125
+ //#endregion
126
+ //#region src/normalizers/path/path.d.ts
127
+ declare const normalizePath: (path: string) => string;
128
+ //#endregion
129
+ //#region src/normalizers/status-code/status-code.d.ts
130
+ declare const normalizeStatusCode: (statusCode: number) => number;
131
+ //#endregion
132
+ //#region src/normalizers/index.d.ts
133
+ declare const defaultNormalizers: {
134
+ normalizeStatusCode: (statusCode: number) => number;
135
+ normalizePath: (path: string) => string;
136
+ normalizeMethod: (method: string) => string;
137
+ };
138
+ //#endregion
139
+ //#region src/summary/summary.d.ts
140
+ declare const getSummary: () => Promise<string>;
141
+ declare const getContentType: () => "text/plain; version=0.0.4; charset=utf-8";
142
+ //#endregion
143
+ export { Prometheus, type Timing as TPromsterTiming, type TRequestRecorder, createGcMetrics, createGcObserver, createGraphQlMetrics, createHttpMetrics, createRequestRecorder, defaultNormalizers, defaultRegister, endMeasurementFrom, getContentType, getSummary, isRunningInKubernetes, normalizeMethod, normalizePath, normalizeStatusCode, skipMetricsInEnvironment, sortLabels, timing };
144
+ //# sourceMappingURL=index.d.cts.map