Loopback

Setup

You can follow the below steps to enable Prometheus metrics for Loopback

Install
--------
npm install --save @loopback/metrics

Import
--------
import {MetricsComponent} from '@loopback/metrics';

In the constructor, add the component to your application:
----
this.component(MetricsComponent);

You can refer the Link for any further config changes or information

You can verify the loopback is enabled by checking following metrics

  • loopback_invocation_total

  • loopback_invocation_duration_seconds

Metrics

Metric

KPI

Requests

loopback_invocation_total

Request Rate

rate(loopback_invocation_total[5m])

Errors

loopback_invocation_total

Error Ratio (server errors)

rate(loopback_invocation_total{status="5.."}[5m])/ rate(loopback_invocation_total[5m])

Error Ratio (client errors)

rate(loopback_invocation_total{statusCode="4.."}[5m])/ rate(loopback_invocation_total[5m])

Latency

loopback_invocation_duration_seconds

Latency Average

rate(loopback_invocation_duration_seconds[5m])/ rate(loopback_invocation_total[5m])

Latency P99

histogram_quantile ( 0.99, sum(rate(loopback_invocation_duration_histogram_bucket[1m]) > 0) by (le) )

Alerts

KPI

Alerts

Request Rate

RequestRateAnomaly

Error Rate

ErrorRatioBreach

ErrorBuildup based on a 99.9 SLO

Latency Average

Latency P99

LatencyAverageBreach

LatencyAverageAnomaly

LatencyP99ErrorBuildup

Dashboards

Service KPI Dashboard

This dashboard has the following KPIs from resources and requests:

  • Request Rate

  • Latency Average

  • Latency P99

  • Error Rate

  • CPU %

  • CPU Cores Used

  • CPU Throttle

  • Memory %

  • Memory Bytes

  • Disk Usage

  • Network Usage

Last updated