Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lasylv/nestjs-actuator

Allow monitoring NestJS applications through Spring Boot Admin
https://github.com/lasylv/nestjs-actuator

monitoring nest nestjs spring-boot-admin

Last synced: 27 days ago
JSON representation

Allow monitoring NestJS applications through Spring Boot Admin

Awesome Lists containing this project

README

        

Nestjs Actuator

A module to monitor your Nestjs applications.





GitHub
npm









GitHub top language

## Description

Nestjs-actuator is a [NestJS](https://nestjs.com/) module (Typescript) implementation of the [Spring Actuator API](https://docs.spring.io/spring-boot/docs/current/actuator-api/html/#info) .

This project was inspired by [Pyctuator](https://github.com/SolarEdgeTech/pyctuator).

This module aims to register and monitor NestJS application through [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin).
However, this module can also be used just to expose the endpoints provided.

The project come with only one hard dependency, `@nestjs/schedule` which might be removed in the future.

## Installation

```bash
$ npm install --save @glosur/nestjs-actuator
```

## How to use

Import `ActuatorModule` into the root `ApplicationModule`

```typescript
import { Module } from '@nestjs/common';
import {ActuatorModule} from "./actuator.module";

@Module({
imports: [
ActuatorModule.forRoot({
registration : {
adminServerUrl: 'http://localhost:8080', // URL of the spring boot admin server
name: 'myApp', // Name of your app
serviceUrl: 'http://localhost:3000', // URL to register with to Spring Boot Admin. This is what Spring Boot Admin will try to call to fetch informations.
auth: { // Optional, needed if you secured your Spring Boot Admin Server
"username": "username",
"password": "pwd"
},
metadata: {} // Optional, additionals metadata
}
}),
]
})
export class ApplicationModule {}
```

### Supported SBA features
* **Version:** Display the version of the app
* **Environment:** Display environment variables (Hiding sensible ones)
* **Http traces:** Display the last 100 http calls to your application

More to come !

## Actuator Endpoints security

This project does not provide any security on the exposed endpoints. Apply a middleware to `/actuator` to protect it.
However make sure to make the Spring Boot Admin Server aware of those security concerns through metadata.

## Compatibility version

This module has only be tested againt NestJS 7+. It *might* work with lower versions.

## Known caveats

Due to how works interceptors in NestJS, some calls can't be seen in the Http Traces tab. Those calls are the one not mapped to any route.
Also, exception filters getting triggered after interceptors means the status code can sometimee be missing

## License

MIT licensed