Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maximemoreillon/elysia-prometheus-metrics
An Elysia.js middleware to export Prometheus metrics.
https://github.com/maximemoreillon/elysia-prometheus-metrics
bun elysia elysiajs middleware monitoring prometheus typescript
Last synced: 2 months ago
JSON representation
An Elysia.js middleware to export Prometheus metrics.
- Host: GitHub
- URL: https://github.com/maximemoreillon/elysia-prometheus-metrics
- Owner: maximemoreillon
- License: mit
- Created: 2023-11-24T22:38:05.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-25T22:59:38.000Z (8 months ago)
- Last Synced: 2024-04-26T23:00:31.491Z (8 months ago)
- Topics: bun, elysia, elysiajs, middleware, monitoring, prometheus, typescript
- Language: TypeScript
- Homepage:
- Size: 47.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elysia Prometheus metrics
[![coverage report](https://gitlab.com/moreillon_ci/moreillon_npm/elysia-prometheus-metrics/badges/master/coverage.svg)](https://gitlab.com/moreillon_ci/moreillon_npm/elysia-prometheus-metrics/-/commits/master)
An Elysia.js middleware to export Prometheus metrics. Is is intended as a replacement to the [express prometheus bundle](https://www.npmjs.com/package/express-prom-bundle) for Elysia, without relying on prom-client as Bun does not support the PerformanceObserver yet (As of november 2023). Currently, this middleware only provides the `http_request_duration_seconds` histogram.
## Installation
```
bun add elysia-prometheus-metrics
```## Usage
```typescript
import { Elysia } from "elysia"
import metricsMiddleware from "elysia-prometheus-metrics"const middlewareOptions = {}
new Elysia()
.use(metricsMiddleware(middlewareOptions))
.get("/", () => "Hello world")
.listen(8080)
```