Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byndyusoft/nest-prometheus
Module for Nests with http_requests metric for Prometheus.
https://github.com/byndyusoft/nest-prometheus
nestjs nodejs prometheus prometheus-metrics typescript
Last synced: 17 days ago
JSON representation
Module for Nests with http_requests metric for Prometheus.
- Host: GitHub
- URL: https://github.com/byndyusoft/nest-prometheus
- Owner: Byndyusoft
- License: apache-2.0
- Created: 2024-11-18T07:36:15.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-12-06T11:26:01.000Z (about 1 month ago)
- Last Synced: 2024-12-06T11:28:29.728Z (about 1 month ago)
- Topics: nestjs, nodejs, prometheus, prometheus-metrics, typescript
- Language: TypeScript
- Homepage: https://github.com/Byndyusoft/nest-prometheus
- Size: 141 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nest-prometheus
[![npm@latest](https://img.shields.io/npm/v/@byndyusoft/nest-prometheus/latest.svg)](https://www.npmjs.com/package/@byndyusoft/nest-prometheus)
[![test](https://github.com/Byndyusoft/nest-prometheus/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/Byndyusoft/nest-prometheus/actions/workflows/test.yaml)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)This package is a module for NestJS.
It provides the `http_requests` metric for Prometheus, which measures the duration of HTTP requests, distributes them into time intervals (buckets), and counts the number of requests and their total duration.- The metric includes filtering by path, request method, and response code.
- Data on request durations are collected and distributed into time intervals (buckets).
- The number of requests and their total duration are recorded.## Requirements
- Node.js v20 LTS or later
- npm or yarn## Install
```bash
npm install @byndyusoft/nest-prometheus
```or
```bash
yarn add @byndyusoft/nest-prometheus
```## Usage
```typescript
import { Module } from "@nestjs/common";
import { PromModule } from "@byndyusoft/nest-prometheus";@Module({
imports: [
PromModule.register({
httpRequestBucket: {
enable: true,
},
}),
],
})
export class ApplicationModule {}
```## Set custom options
```typescript
PromModule.register({
httpRequestBucket: {
enable: true,
timeBuckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 10],
ignoredUrls: ['/mymetric', '/favicon.ico']
},
apiTag: 'Infrastructure',
metricPath: '/mymetric'
}),
```## Maintainers
- [@Byndyusoft/owners](https://github.com/orgs/Byndyusoft/teams/owners) <>
- [@Byndyusoft/team](https://github.com/orgs/Byndyusoft/teams/team)
- [@tykachev](https://github.com/tykachev)## License
This repository is released under version 2.0 of the
[Apache License](https://www.apache.org/licenses/LICENSE-2.0).