@promster/metrics 7.0.4 → 9.1.1

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 (24) hide show
  1. package/dist/declarations/src/create-gc-metrics/create-gc-metrics.d.ts +16 -0
  2. package/dist/declarations/src/create-gc-metrics/index.d.ts +2 -0
  3. package/dist/declarations/src/create-graphql-metrics/create-graphql-metrics.d.ts +18 -0
  4. package/dist/declarations/src/create-graphql-metrics/index.d.ts +2 -0
  5. package/dist/declarations/src/create-http-metrics/create-http-metrics.d.ts +18 -0
  6. package/dist/declarations/src/create-http-metrics/index.d.ts +2 -0
  7. package/dist/declarations/src/create-request-recorder/create-request-recorder.d.ts +7 -9
  8. package/dist/declarations/src/end-measurement-from/end-measurement-from.d.ts +4 -0
  9. package/dist/declarations/src/end-measurement-from/index.d.ts +2 -0
  10. package/dist/declarations/src/environment/index.d.ts +3 -0
  11. package/dist/declarations/src/{kubernetes → environment}/kubernetes.d.ts +0 -0
  12. package/dist/declarations/src/environment/skip-metrics-in-environment.d.ts +6 -0
  13. package/dist/declarations/src/index.d.ts +9 -3
  14. package/dist/declarations/src/sort-labels/index.d.ts +2 -0
  15. package/dist/declarations/src/sort-labels/sort-labels.d.ts +3 -0
  16. package/dist/declarations/src/timing/index.d.ts +2 -0
  17. package/dist/declarations/src/timing/timing.d.ts +15 -0
  18. package/dist/promster-metrics.cjs.dev.js +332 -146
  19. package/dist/promster-metrics.cjs.prod.js +332 -146
  20. package/package.json +9 -8
  21. package/readme.md +1 -2
  22. package/dist/declarations/src/create-metric-types/create-metric-types.d.ts +0 -25
  23. package/dist/declarations/src/create-metric-types/index.d.ts +0 -2
  24. package/dist/declarations/src/kubernetes/index.d.ts +0 -2
@@ -0,0 +1,16 @@
1
+ import type { TDefaultedPromsterOptions, TGcMetrics } from '@promster/types';
2
+ declare const createGcMetrics: {
3
+ (options: TDefaultedPromsterOptions): TGcMetrics;
4
+ defaultOptions: {
5
+ getLabelValues: () => {};
6
+ labels: never[];
7
+ metricPrefix: string;
8
+ metricNames: {
9
+ up: string[];
10
+ countOfGcs: string[];
11
+ durationOfGc: string[];
12
+ reclaimedInGc: string[];
13
+ };
14
+ };
15
+ };
16
+ export { createGcMetrics };
@@ -0,0 +1,2 @@
1
+ import { createGcMetrics } from './create-gc-metrics';
2
+ export { createGcMetrics };
@@ -0,0 +1,18 @@
1
+ import type { TDefaultedPromsterOptions, TGraphQlMetrics } from '@promster/types';
2
+ declare const createGraphQlMetrics: {
3
+ (options: TDefaultedPromsterOptions): TGraphQlMetrics;
4
+ defaultOptions: {
5
+ getLabelValues: () => {};
6
+ labels: never[];
7
+ metricPrefix: string;
8
+ metricTypes: string[];
9
+ metricNames: {
10
+ graphQlParseDuration: string[];
11
+ graphQlValidationDuration: string[];
12
+ graphQlResolveFieldDuration: string[];
13
+ graphQlRequestDuration: string[];
14
+ graphQlErrorsTotal: string[];
15
+ };
16
+ };
17
+ };
18
+ export { createGraphQlMetrics };
@@ -0,0 +1,2 @@
1
+ import { createGraphQlMetrics } from './create-graphql-metrics';
2
+ export { createGraphQlMetrics };
@@ -0,0 +1,18 @@
1
+ import type { TDefaultedPromsterOptions, THttpMetrics } from '@promster/types';
2
+ declare const createHttpMetrics: {
3
+ (options: TDefaultedPromsterOptions): THttpMetrics;
4
+ defaultOptions: {
5
+ getLabelValues: () => {};
6
+ labels: never[];
7
+ metricPrefix: string;
8
+ metricTypes: string[];
9
+ metricNames: {
10
+ httpRequestsTotal: string[];
11
+ httpRequestDurationPerPercentileInSeconds: string[];
12
+ httpRequestDurationInSeconds: string[];
13
+ httpRequestContentLengthInBytes: string[];
14
+ httpResponseContentLengthInBytes: string[];
15
+ };
16
+ };
17
+ };
18
+ export { createHttpMetrics };
@@ -0,0 +1,2 @@
1
+ import { createHttpMetrics } from './create-http-metrics';
2
+ export { createHttpMetrics };
@@ -1,18 +1,16 @@
1
- import type { TPromsterOptions, TLabelValues, TMetricTypes } from '@promster/types';
1
+ import type { TPromsterOptions, TLabelValues, THttpMetrics } from '@promster/types';
2
+ import { sortLabels } from '../sort-labels';
3
+ import { endMeasurementFrom } from '../end-measurement-from';
4
+ import { Timing } from '../timing';
2
5
  declare type TRecordingOptions = {
3
6
  labels: TLabelValues;
4
7
  requestContentLength?: number;
5
8
  responseContentLength?: number;
6
9
  };
7
- declare type TRequestTiming = [number, number];
8
- export declare type TRequestRecorder = (start: TRequestTiming, recordingOptions: TRecordingOptions) => void;
9
- declare const sortLabels: (unsortedLabels: TLabelValues) => TLabelValues;
10
- declare const endMeasurementFrom: (start: TRequestTiming) => {
11
- durationMs: number;
12
- durationS: number;
13
- };
10
+ declare type TLegacyTiming = [number, number];
11
+ export declare type TRequestRecorder = (timing: Timing | TLegacyTiming, recordingOptions: TRecordingOptions) => void;
14
12
  declare const createRequestRecorder: {
15
- (metricTypes: TMetricTypes, options?: TPromsterOptions): TRequestRecorder;
13
+ (metrics: THttpMetrics, options?: TPromsterOptions): TRequestRecorder;
16
14
  defaultOptions: TPromsterOptions;
17
15
  };
18
16
  export { createRequestRecorder, sortLabels, endMeasurementFrom };
@@ -0,0 +1,4 @@
1
+ declare function endMeasurementFrom(start: [number, number]): {
2
+ durationS: number;
3
+ };
4
+ export { endMeasurementFrom };
@@ -0,0 +1,2 @@
1
+ import { endMeasurementFrom } from './end-measurement-from';
2
+ export { endMeasurementFrom };
@@ -0,0 +1,3 @@
1
+ import { isRunningInKubernetes } from './kubernetes';
2
+ import { skipMetricsInEnvironment } from './skip-metrics-in-environment';
3
+ export { isRunningInKubernetes, skipMetricsInEnvironment };
@@ -0,0 +1,6 @@
1
+ import type { TPromsterOptions } from '@promster/types';
2
+ declare type TSkipMetricsInEnvironmentOptions = {
3
+ detectKubernetes?: TPromsterOptions['detectKubernetes'];
4
+ };
5
+ declare const skipMetricsInEnvironment: (options: TSkipMetricsInEnvironmentOptions) => boolean;
6
+ export { skipMetricsInEnvironment };
@@ -1,9 +1,15 @@
1
1
  import { Prometheus, defaultRegister } from './client';
2
- import { createMetricTypes } from './create-metric-types';
2
+ import { createHttpMetrics } from './create-http-metrics';
3
+ import { createGraphQlMetrics } from './create-graphql-metrics';
4
+ import { createGcMetrics } from './create-gc-metrics';
3
5
  import { getSummary, getContentType } from './summary';
4
6
  import { createRequestRecorder } from './create-request-recorder';
5
7
  import { createGcObserver } from './create-gc-observer';
6
8
  import { defaultNormalizers, normalizeStatusCode, normalizePath, normalizeMethod } from './normalizers';
7
- import { isRunningInKubernetes } from './kubernetes';
9
+ import { isRunningInKubernetes, skipMetricsInEnvironment } from './environment';
10
+ import { endMeasurementFrom } from './end-measurement-from';
11
+ import { sortLabels } from './sort-labels';
12
+ import { timing } from './timing';
8
13
  export type { TRequestRecorder } from './create-request-recorder';
9
- export { Prometheus, defaultRegister, createMetricTypes, getSummary, getContentType, createRequestRecorder, createGcObserver, defaultNormalizers, normalizeStatusCode, normalizePath, normalizeMethod, isRunningInKubernetes, };
14
+ export type { Timing as TPromsterTiming } from './timing';
15
+ export { Prometheus, defaultRegister, createHttpMetrics, createGraphQlMetrics, createGcMetrics, getSummary, getContentType, createRequestRecorder, createGcObserver, defaultNormalizers, normalizeStatusCode, normalizePath, normalizeMethod, isRunningInKubernetes, skipMetricsInEnvironment, endMeasurementFrom, sortLabels, timing, };
@@ -0,0 +1,2 @@
1
+ import { sortLabels } from './sort-labels';
2
+ export { sortLabels };
@@ -0,0 +1,3 @@
1
+ import type { TLabelValues } from '@promster/types';
2
+ declare function sortLabels(unsortedLabels: TLabelValues): TLabelValues;
3
+ export { sortLabels };
@@ -0,0 +1,2 @@
1
+ import timing, { Timing } from './timing';
2
+ export { timing, Timing };
@@ -0,0 +1,15 @@
1
+ declare class Timing {
2
+ #private;
3
+ static NS_PER_SEC: bigint;
4
+ constructor();
5
+ value(): {
6
+ seconds: number | 0n | undefined;
7
+ };
8
+ reset(): this;
9
+ end(): this;
10
+ }
11
+ declare const timing: {
12
+ start(): Timing;
13
+ };
14
+ export default timing;
15
+ export { Timing };