# @adobe/metrics-sampler

> Library for collecting and summarizing metrics

Latest version **1.0.5** (published 2025-11-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @adobe/metrics-sampler
pnpm add @adobe/metrics-sampler
yarn add @adobe/metrics-sampler
bun add @adobe/metrics-sampler
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2025-11-11 |
| First published | 2020-04-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Adobe Inc. |
| Maintainers | marbec, tripod, garthdb, lazd, adobe-admin, patrickfulton, trieloff, shazron, krisnye, dcpfsdk, natebaldwin, devongovett, aspro83, symanovi, dpfister, stefan-guggisberg, rofe, kptdobe, adobehalls, fullcolorcoder, djaeggi, dylandepass, mhaack, amol-anand, stopp-adobe, doten, duh_schmidt, asthabh23, zdahbi, tuicu, fmeschbe |
| Keywords | metrics, sampling, sampler, adobe, node |

## Links

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

## Dependencies (3)

- [flat](https://npm.io/package/flat.md) ^5.0.2
- [datalib](https://npm.io/package/datalib.md) ^1.9.3
- [interval-promise](https://npm.io/package/interval-promise.md) ^1.4.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2025-11-11
- 1.0.4 — 2021-11-01
- 1.0.3 — 2021-08-17
- 1.0.2 — 2021-05-03
- 1.0.1 — 2020-12-02
- 1.0.0 — 2020-04-27

## README

[![Version](https://img.shields.io/npm/v/@adobe/metrics-sampler.svg)](https://npmjs.org/package/@adobe/metrics-sampler)

# node-metrics-sampler

Library for collecting and gathering metrics

### Installation

```bash
npm install @adobe/metrics-sampler
```

### Sampler Usage

The Sampler can be used to gather metrics over a period of time. For example, let's say we want to collect OS metrics as we read files on our computer.

```js
// start sampler that will run every 200ms
const sampler = new Sampler( () => {
			return os.cpus();
        }, 200);
const file = fs.readSync('/path/to/file');

// now we can look at the current values in a summary statistic
console.log(sampler.getValues());
```
When we are done sampling, we can end the sampler interval and retrieve the metrics.
```js
const metricsSummary = await sampler.finish();
```

After ending the sampler, any calls to `sampler.finish()` or `sampler.getValues()` will return the summary statistics


### Contributing
Contributions are welcomed! Read the [Contributing Guide](./.github/CONTRIBUTING.md) for more information.

### Licensing
This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information.

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