1.5.0 • Published 1 year ago

@nodescript/metrics v1.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Metrics

Collect metrics with simple and concise API.

Uses Mesh IoC.

Usage

  1. Use counters, gauges and histograms to collect metrics in your application.

    export class MyService {
    
        @metric()
        counter = new CounterMetric('my_service_counter_total', 'Total number of times something important happened.');
    
        doSomething() {
            // ...
            counter.incr();
        }
    
    }
  2. Generate a Prometheus report from all metrics defined in your mesh:

    const report = generateMetricsReport(mesh);