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: 6 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 (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T23:34:35.000Z (over 1 year ago)
- Last Synced: 2025-04-04T00:12:40.357Z (7 months ago)
- Topics: bun, elysia, elysiajs, middleware, monitoring, prometheus, typescript
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elysia Prometheus metrics
[](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)
```