0.43.0 • Published 14 days ago

@lidofinance/api-metrics v0.43.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@lidofinance/api-metrics

Utils to work with common API metrics

Installation

yarn add @lidofinance/api-metrics

Getting started

collectStartupMetrics

Just call it in the same place where you call collectDefaultMetrics.

import { Registry, collectDefaultMetrics } from 'prom-client';
import getConfig from 'next/config';
import { METRICS_PREFIX } from 'config';
import buildInfoJson from 'build-info.json';
import { collectStartupMetrics } from '@lidofinance/api-metrics';

const { publicRuntimeConfig } = getConfig();
const { defaultChain, supportedChains } = publicRuntimeConfig;

export const registry = new Registry();

collectStartupMetrics({
  prefix: METRICS_PREFIX,
  registry,
  defaultChain,
  supportedChains: supportedChains.split(','),
  version: process.env.npm_package_version ?? 'unversioned',
  commit: buildInfoJson.commit,
  branch: buildInfoJson.branch,
});

collectDefaultMetrics({ prefix: METRICS_PREFIX, register: registry });

rpcMetricsFactory

It's mostly internal util for @lidofinance/api-rpc and @lidofinance/eth-api-providers, but you should use it if you use RPC requests in some other way.

Take a look into the file itself to view exported metrics, it's quite simple.

rpcMetricsUtils

There is a list of utils, which helps to reduce cardinality, e.g. you should collect '2xx' instead of '200', '201', ... and other HTTP response statuses, because in most cases it doesn't matter.

0.43.0

14 days ago

0.42.0

2 months ago

0.41.0

2 months ago

0.40.0

3 months ago

0.39.1

5 months ago

0.39.0

7 months ago

0.38.0

8 months ago

0.37.1

8 months ago

0.37.0

8 months ago

0.36.0

9 months ago

0.35.0

9 months ago

0.34.0

9 months ago

0.33.0

10 months ago

0.32.0

10 months ago

0.31.0

10 months ago

0.30.0

10 months ago

0.29.0

10 months ago

0.28.0

11 months ago

0.21.0

1 year ago

0.27.0

11 months ago

0.26.0

11 months ago

0.25.0

12 months ago

0.24.0

12 months ago

0.23.0

12 months ago

0.22.0

12 months ago

0.20.0

1 year ago

0.19.0

1 year ago

0.17.0

1 year ago

0.18.0

1 year ago

0.14.0

1 year ago

0.15.0

1 year ago

0.16.0

1 year ago

0.10.0

1 year ago

0.11.0

1 year ago

0.9.0

1 year ago

0.12.0

1 year ago

0.8.0

1 year ago

0.13.0

1 year ago

0.7.0

1 year ago

0.6.0

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago