@promster/metrics 9.1.6 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import type { TDefaultedPromsterOptions, TGcMetrics } from '@promster/types';
1
+ import type { TGcMetrics } from '@promster/types';
2
2
  declare const createGcMetrics: {
3
- (options: TDefaultedPromsterOptions): TGcMetrics;
3
+ (options: DeepRequired<import("@promster/types").TPromsterOptions>): TGcMetrics;
4
4
  defaultOptions: {
5
5
  getLabelValues: () => {};
6
6
  labels: never[];
@@ -1,6 +1,6 @@
1
- import type { TDefaultedPromsterOptions, TGraphQlMetrics } from '@promster/types';
1
+ import type { TGraphQlMetrics } from '@promster/types';
2
2
  declare const createGraphQlMetrics: {
3
- (options: TDefaultedPromsterOptions): TGraphQlMetrics;
3
+ (options: DeepRequired<import("@promster/types").TPromsterOptions>): TGraphQlMetrics;
4
4
  defaultOptions: {
5
5
  getLabelValues: () => {};
6
6
  labels: never[];
@@ -1,6 +1,6 @@
1
- import type { TDefaultedPromsterOptions, THttpMetrics } from '@promster/types';
1
+ import type { THttpMetrics } from '@promster/types';
2
2
  declare const createHttpMetrics: {
3
- (options: TDefaultedPromsterOptions): THttpMetrics;
3
+ (options: DeepRequired<import("@promster/types").TPromsterOptions>): THttpMetrics;
4
4
  defaultOptions: {
5
5
  getLabelValues: () => {};
6
6
  labels: never[];
@@ -192,7 +192,7 @@ const defaultOptions$2 = {
192
192
  labels: [],
193
193
  metricPrefix: '',
194
194
  metricNames: {
195
- up: ['up'],
195
+ up: ['nodejs_up'],
196
196
  countOfGcs: ['nodejs_gc_runs_total'],
197
197
  durationOfGc: ['nodejs_gc_pause_seconds_total'],
198
198
  reclaimedInGc: ['nodejs_gc_reclaimed_bytes_total']
@@ -201,7 +201,7 @@ const defaultOptions$2 = {
201
201
  const getMetrics = options => ({
202
202
  up: asArray(options.metricNames.up).map(nameOfUpMetric => new Prometheus__namespace.Gauge({
203
203
  name: `${options.metricPrefix}${nameOfUpMetric}`,
204
- help: '1 = up, 0 = not up'
204
+ help: '1 = nodejs server is up, 0 = nodejs server is not up'
205
205
  })),
206
206
  countOfGcs: asArray(options.metricNames.countOfGcs).map(nameOfCountOfGcsMetric => new Prometheus__namespace.Counter({
207
207
  name: `${options.metricPrefix}${nameOfCountOfGcsMetric}`,
@@ -270,25 +270,25 @@ const createRequestRecorder = (metrics, options = defaultOptions$1) => {
270
270
  const labels = sortLabels(recordingOptions.labels);
271
271
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
272
272
  var _metrics$httpRequestD;
273
- (_metrics$httpRequestD = metrics.httpRequestDurationInSeconds) === null || _metrics$httpRequestD === void 0 ? void 0 : _metrics$httpRequestD.forEach(httpRequestDurationInSecondsMetricType => {
273
+ (_metrics$httpRequestD = metrics.httpRequestDurationInSeconds) === null || _metrics$httpRequestD === void 0 || _metrics$httpRequestD.forEach(httpRequestDurationInSecondsMetricType => {
274
274
  httpRequestDurationInSecondsMetricType.observe(labels, durationS);
275
275
  });
276
276
  }
277
277
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
278
278
  var _metrics$httpRequestD2;
279
- (_metrics$httpRequestD2 = metrics.httpRequestDurationPerPercentileInSeconds) === null || _metrics$httpRequestD2 === void 0 ? void 0 : _metrics$httpRequestD2.forEach(httpRequestDurationPerPercentileInSecondsMetricType => {
279
+ (_metrics$httpRequestD2 = metrics.httpRequestDurationPerPercentileInSeconds) === null || _metrics$httpRequestD2 === void 0 || _metrics$httpRequestD2.forEach(httpRequestDurationPerPercentileInSecondsMetricType => {
280
280
  httpRequestDurationPerPercentileInSecondsMetricType.observe(labels, durationS);
281
281
  });
282
282
  }
283
283
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
284
284
  var _metrics$httpRequests;
285
- (_metrics$httpRequests = metrics.httpRequestsTotal) === null || _metrics$httpRequests === void 0 ? void 0 : _metrics$httpRequests.forEach(httpRequestsTotalMetricType => {
285
+ (_metrics$httpRequests = metrics.httpRequestsTotal) === null || _metrics$httpRequests === void 0 || _metrics$httpRequests.forEach(httpRequestsTotalMetricType => {
286
286
  httpRequestsTotalMetricType.inc(labels);
287
287
  });
288
288
  }
289
289
  if (recordingOptions.requestContentLength) {
290
290
  var _metrics$httpRequestC;
291
- (_metrics$httpRequestC = metrics.httpRequestContentLengthInBytes) === null || _metrics$httpRequestC === void 0 ? void 0 : _metrics$httpRequestC.forEach(httpRequestContentLengthInBytesMetricType => {
291
+ (_metrics$httpRequestC = metrics.httpRequestContentLengthInBytes) === null || _metrics$httpRequestC === void 0 || _metrics$httpRequestC.forEach(httpRequestContentLengthInBytesMetricType => {
292
292
  httpRequestContentLengthInBytesMetricType.observe(labels,
293
293
  // @ts-expect-error
294
294
  recordingOptions.requestContentLength);
@@ -296,7 +296,7 @@ const createRequestRecorder = (metrics, options = defaultOptions$1) => {
296
296
  }
297
297
  if (recordingOptions.responseContentLength) {
298
298
  var _metrics$httpResponse;
299
- (_metrics$httpResponse = metrics.httpResponseContentLengthInBytes) === null || _metrics$httpResponse === void 0 ? void 0 : _metrics$httpResponse.forEach(httpResponseContentLengthInBytesMetricType => {
299
+ (_metrics$httpResponse = metrics.httpResponseContentLengthInBytes) === null || _metrics$httpResponse === void 0 || _metrics$httpResponse.forEach(httpResponseContentLengthInBytesMetricType => {
300
300
  httpResponseContentLengthInBytesMetricType.observe(labels,
301
301
  // @ts-expect-error
302
302
  recordingOptions.responseContentLength);
@@ -192,7 +192,7 @@ const defaultOptions$2 = {
192
192
  labels: [],
193
193
  metricPrefix: '',
194
194
  metricNames: {
195
- up: ['up'],
195
+ up: ['nodejs_up'],
196
196
  countOfGcs: ['nodejs_gc_runs_total'],
197
197
  durationOfGc: ['nodejs_gc_pause_seconds_total'],
198
198
  reclaimedInGc: ['nodejs_gc_reclaimed_bytes_total']
@@ -201,7 +201,7 @@ const defaultOptions$2 = {
201
201
  const getMetrics = options => ({
202
202
  up: asArray(options.metricNames.up).map(nameOfUpMetric => new Prometheus__namespace.Gauge({
203
203
  name: `${options.metricPrefix}${nameOfUpMetric}`,
204
- help: '1 = up, 0 = not up'
204
+ help: '1 = nodejs server is up, 0 = nodejs server is not up'
205
205
  })),
206
206
  countOfGcs: asArray(options.metricNames.countOfGcs).map(nameOfCountOfGcsMetric => new Prometheus__namespace.Counter({
207
207
  name: `${options.metricPrefix}${nameOfCountOfGcsMetric}`,
@@ -270,25 +270,25 @@ const createRequestRecorder = (metrics, options = defaultOptions$1) => {
270
270
  const labels = sortLabels(recordingOptions.labels);
271
271
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
272
272
  var _metrics$httpRequestD;
273
- (_metrics$httpRequestD = metrics.httpRequestDurationInSeconds) === null || _metrics$httpRequestD === void 0 ? void 0 : _metrics$httpRequestD.forEach(httpRequestDurationInSecondsMetricType => {
273
+ (_metrics$httpRequestD = metrics.httpRequestDurationInSeconds) === null || _metrics$httpRequestD === void 0 || _metrics$httpRequestD.forEach(httpRequestDurationInSecondsMetricType => {
274
274
  httpRequestDurationInSecondsMetricType.observe(labels, durationS);
275
275
  });
276
276
  }
277
277
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
278
278
  var _metrics$httpRequestD2;
279
- (_metrics$httpRequestD2 = metrics.httpRequestDurationPerPercentileInSeconds) === null || _metrics$httpRequestD2 === void 0 ? void 0 : _metrics$httpRequestD2.forEach(httpRequestDurationPerPercentileInSecondsMetricType => {
279
+ (_metrics$httpRequestD2 = metrics.httpRequestDurationPerPercentileInSeconds) === null || _metrics$httpRequestD2 === void 0 || _metrics$httpRequestD2.forEach(httpRequestDurationPerPercentileInSecondsMetricType => {
280
280
  httpRequestDurationPerPercentileInSecondsMetricType.observe(labels, durationS);
281
281
  });
282
282
  }
283
283
  if (!shouldSkipMetricsByEnvironment && durationS !== undefined) {
284
284
  var _metrics$httpRequests;
285
- (_metrics$httpRequests = metrics.httpRequestsTotal) === null || _metrics$httpRequests === void 0 ? void 0 : _metrics$httpRequests.forEach(httpRequestsTotalMetricType => {
285
+ (_metrics$httpRequests = metrics.httpRequestsTotal) === null || _metrics$httpRequests === void 0 || _metrics$httpRequests.forEach(httpRequestsTotalMetricType => {
286
286
  httpRequestsTotalMetricType.inc(labels);
287
287
  });
288
288
  }
289
289
  if (recordingOptions.requestContentLength) {
290
290
  var _metrics$httpRequestC;
291
- (_metrics$httpRequestC = metrics.httpRequestContentLengthInBytes) === null || _metrics$httpRequestC === void 0 ? void 0 : _metrics$httpRequestC.forEach(httpRequestContentLengthInBytesMetricType => {
291
+ (_metrics$httpRequestC = metrics.httpRequestContentLengthInBytes) === null || _metrics$httpRequestC === void 0 || _metrics$httpRequestC.forEach(httpRequestContentLengthInBytesMetricType => {
292
292
  httpRequestContentLengthInBytesMetricType.observe(labels,
293
293
  // @ts-expect-error
294
294
  recordingOptions.requestContentLength);
@@ -296,7 +296,7 @@ const createRequestRecorder = (metrics, options = defaultOptions$1) => {
296
296
  }
297
297
  if (recordingOptions.responseContentLength) {
298
298
  var _metrics$httpResponse;
299
- (_metrics$httpResponse = metrics.httpResponseContentLengthInBytes) === null || _metrics$httpResponse === void 0 ? void 0 : _metrics$httpResponse.forEach(httpResponseContentLengthInBytesMetricType => {
299
+ (_metrics$httpResponse = metrics.httpResponseContentLengthInBytes) === null || _metrics$httpResponse === void 0 || _metrics$httpResponse.forEach(httpResponseContentLengthInBytesMetricType => {
300
300
  httpResponseContentLengthInBytesMetricType.observe(labels,
301
301
  // @ts-expect-error
302
302
  recordingOptions.responseContentLength);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promster/metrics",
3
- "version": "9.1.6",
3
+ "version": "10.0.0",
4
4
  "description": "Metrics utilities used by all other server integrations",
5
5
  "main": "dist/promster-metrics.cjs.js",
6
6
  "typings": "dist/promster-metrics.cjs.d.ts",
@@ -16,8 +16,8 @@
16
16
  "access": "public"
17
17
  },
18
18
  "engines": {
19
- "node": ">=14",
20
- "npm": ">=6"
19
+ "node": ">=16",
20
+ "npm": ">=8"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -40,20 +40,20 @@
40
40
  "lodash.once": "4.1.1",
41
41
  "merge-options": "3.0.4",
42
42
  "optional": "0.1.4",
43
- "ts-essentials": "9.3.0",
43
+ "ts-essentials": "9.3.2",
44
44
  "tslib": "2.4.1",
45
45
  "url-value-parser": "2.2.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@promster/types": "^3.2.5",
49
- "@types/lodash": "4.14.191",
50
- "prom-client": "14.1.0",
51
- "typescript": "4.9.4"
48
+ "@promster/types": "^4.0.0",
49
+ "@types/lodash": "4.14.197",
50
+ "prom-client": "14.2.0",
51
+ "typescript": "4.9.5"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@sematext/gc-stats": "1.5.8"
54
+ "@sematext/gc-stats": "1.5.9"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "prom-client": "13.x.x || 14.x"
58
58
  }
59
- }
59
+ }