# @nodescript/metrics

> Tiny backend metrics collection library

Latest version **1.7.2** (published 2025-12-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @nodescript/metrics
pnpm add @nodescript/metrics
yarn add @nodescript/metrics
bun add @nodescript/metrics
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.2 |
| Published | 2025-12-29 |
| First published | 2022-12-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Boris Okunskiy |
| Maintainers | inca, danielolaviobr, mattscarthsaunders |

## Links

- npm: https://www.npmjs.com/package/@nodescript/metrics
- Repository: https://github.com/nodescriptlang/metrics
- Homepage: https://github.com/nodescriptlang/metrics#readme
- Issues: https://github.com/nodescriptlang/metrics/issues
- npm.io page: https://npm.io/package/@nodescript/metrics

## Dependencies (2)

- [mesh-ioc](https://npm.io/package/mesh-ioc.md) ^4.1.1
- [mesh-decorators](https://npm.io/package/mesh-decorators.md) ^1.3.2

## Recent versions

- 1.7.2 (latest) — 2025-12-29
- 1.7.1 — 2024-12-22
- 1.7.0 — 2024-12-22
- 1.5.0 — 2024-07-12
- 1.3.1 — 2024-04-19
- 1.3.0 — 2024-04-04
- 1.2.1 — 2024-03-13
- 1.2.0 — 2024-03-04
- 1.1.1 — 2023-02-14
- 1.1.0 — 2022-12-15
- 1.0.2 — 2022-12-07
- 1.0.1 — 2022-12-07

## README

# Metrics

Collect metrics with simple and concise API.

Uses [Mesh IoC](https://github.com/nodescriptlang/mesh).

## Usage

1. Use counters, gauges and histograms to collect metrics in your application.

    ```ts
    export class MyService {

        @metric()
        counter = new CounterMetric('my_service_counter_total', 'Total number of times something important happened.');

        doSomething() {
            // ...
            counter.incr();
        }

    }
    ```

2. Generate a Prometheus report from all metrics defined in your mesh:

    ```ts
    const report = generateMetricsReport(mesh);
    ```

---
_Source: https://npm.io/package/@nodescript/metrics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
