
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@betsys-nestjs/monitoring
Advanced tools
| Package | Version |
|---|---|
| on-headers | ^1.0.0 |
| prom-client | ^14.0.0 |
| @betsys-nestjs/config-utils | ^2.0.0 |
| @hapi/joi | ^17.0.0 |
| @nestjs/common | ^10.0.0 |
| @nestjs/config | ^3.0.0 |
| @nestjs/core | ^10.0.0 |
| @nestjs/platform-express | ^10.0.0 |
| @nestjs/swagger | ^7.0.0 |
| express | ^4.0.0 |
| reflect-metadata | <1.0.0 |
| rxjs | ^7.0.0 |
Just register the module in your application module. If you are not using cluster, use the SimpleMonitoringModule
import {Module} from '@nestjs/common';
import {SimpleMonitoringModule} from '@betsys/nestjs-monitoring';
@Module({
imports: [
SimpleMonitoringModule.forRoot({platformType: express}),
],
})
class AppModule {
}
The forRoot module factory function accepts the following parameters:
class SimpleMonitoringModule {
static forRoot({contextType, registerControllers, hasClusterMetrics, enableDefaultMetrics, histogramBuckets}): DynamicModule;
}
platformType You can chose between grpc and express that automatically initialize request loggingregisterController (default = true) allows you to disable metrics controllers completelyhasClusterMetrics (default = false) bootstraps the module in cluster modeenableDefaultMetrics (default = true) controls whether prom-client's default metrics are collectedhistogramBuckets (default = [0.1, 1, 5, 15, 30, 50, 100, 200, 300, 500, 1000, 2500, 5000, 10000, 20000]) allows you to customize the histogram buckets for request monitoringIf you are using cluster, use the ClusterMonitoringModule
import {Module} from '@nestjs/common';
import {ClusterMonitoringModule} from '@betsys/nestjs-monitoring';
@Module({
imports: [
ClusterMonitoringModule.forRoot({ registerController: true}),
],
})
class AppModule {
}
You can use cluster only with express platform.
The forRoot module factory function accepts the following parameters:
class ClusterMonitoringModule {
static forRoot({registerController, enableDefaultMetrics, histogramBuckets}): DynamicModule;
}
registerController (default = true) allows you to disable metrics controllers completelyenableDefaultMetrics (default = true) controls whether prom-client's default metrics are collectedhistogramBuckets (default = [0.1, 1, 5, 15, 30, 50, 100, 200, 300, 500, 1000, 2500, 5000, 10000, 20000]) allows you to customize the histogram buckets for request monitoringTo create your own metrics, just create new metrics object and call its methods to add new value to metric. You can
use MonitoringConfig to resolve metrics name to add configured prefix.
For example, simple monitoring service:
import {Injectable} from '@nestjs/common';
import {
MonitoringConfig,
Counter,
Gauge,
InjectMonitoringConfig,
InjectRegistry,
MonitoringConfigInterface,
Registry
} from '@betsys/nestjs-monitoring';
@Injectable()
export class WebsocketMonitoringService {
private readonly messagesSent: Counter<string>;
constructor(
@InjectMonitoringConfig() private readonly config: MonitoringConfigInterface,
@InjectMonitoringRegistry() private readonly registry: Registry,
) {
this.messagesSent = new Counter({
name: this.config.getMetricsName('websocket_messages_sent'),
help: 'count of messages sent over websocket',
labelNames: ['event'],
registers: [registry]
});
}
incrementMessagesSent(event: string): void {
this.messagesSent.inc({event});
}
}
To see complete list of options and metrics, check prom-client.
FAQs
NestJS prometheus implementations using prom-client library
The npm package @betsys-nestjs/monitoring receives a total of 7 weekly downloads. As such, @betsys-nestjs/monitoring popularity was classified as not popular.
We found that @betsys-nestjs/monitoring demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.