# prom2json-se

> [![npm][npm-badge]][npm-url]

Latest version **0.6.0** (published 2019-07-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install prom2json-se
pnpm add prom2json-se
yarn add prom2json-se
bun add prom2json-se
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2019-07-12 |
| First published | 2019-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mihovil Strujic, PhD |
| Maintainers | michaelortho |
| Keywords | prometheus, monitoring, converter, json, transform |

## Links

- npm: https://www.npmjs.com/package/prom2json-se
- Repository: https://bitbucket.org/SeaExc/se.monitoring.prom2json
- Homepage: https://bitbucket.org/SeaExc/se.monitoring.prom2json#readme
- npm.io page: https://npm.io/package/prom2json-se

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.6.0 (latest) — 2019-07-12
- 0.5.1 — 2019-07-12
- 0.5.0 — 2019-07-12

## README

# Prom2Json SE
[![npm][npm-badge]][npm-url]

## Description

This small module is helping with conversion between Prometheus string output and
JSON. JSON format is not standard output for Prometheus, but some processors
prefer to use that one over any other.

Some snippets are inspired by https://github.com/anasceym/prom2json-stream

## Installation

```shell
// If you use npm
npm i prom2json-se -S

// If you use yarn
yarn add prom2json-se
```

## How to use

```javascript

// Load module
const prom2Json = require('./');

// Use module
const promString = `
...
`;
const promJson = prom2Json.convert(promString);
```

## Simple example with Prometheus client:

```javascript

const express = require('express');
const app = express();

...

const Prometheus = require('prom-client');
const prom2Json = require('prom2json-se');

// Default Metrics (every 10s)
Prometheus.collectDefaultMetrics();

// Add metrics endpoint
app.use('/metrics-json', (req, res) => {
  const json = prom2Json.convert(Prometheus.register.metrics());
  res.send(json);
});

...

app.listen(process.env.PORT || 3000);
```

## License

This module has MIT license.

[npm-badge]:https://img.shields.io/npm/v/prom2json-se.svg
[npm-url]:https://www.npmjs.com/package/prom2json-se

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