Skip to main content

angel3_prometheus 10.0.0 copy "angel3_prometheus: ^10.0.0" to clipboard
angel3_prometheus: ^10.0.0 copied to clipboard

Prometheus metrics for Angel3 applications. Times each request, counts those in progress, and serves the metrics in the Prometheus text format.

example/main.dart

import 'dart:io';

import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
import 'package:angel3_prometheus/angel3_prometheus.dart';

Future<void> main() async {
  var app = Angel();
  var metrics = PrometheusMetrics(ignore: (req) => req.path == 'health');

  // First, so that it measures every request.
  await app.configure(metrics.configureServer);

  // A metric of the app's own.
  var greetings = Counter(name: 'greetings_total', help: 'Greetings sent.')
    ..register(metrics.registry);

  app
    ..get('/hello', (req, res) {
      greetings.inc();
      return 'Hello!';
    })
    ..get('/health', (req, res) => 'up');

  // The metrics, at http://127.0.0.1:9100/metrics, off the app's port.
  await metrics.serve(app, InternetAddress.loopbackIPv4, 9100);

  var http = AngelHttp(app);
  await http.startServer('127.0.0.1', 3000);
  print('Listening at ${http.uri}; metrics at http://127.0.0.1:9100/metrics');
}
0
likes
160
points
63
downloads

Documentation

API reference

Publisher

verified publisherdukefirehawk.com

Weekly Downloads

Prometheus metrics for Angel3 applications. Times each request, counts those in progress, and serves the metrics in the Prometheus text format.

Homepage
Repository (GitHub)
View/report issues

Topics

#prometheus #metrics #monitoring

License

BSD-3-Clause (license)

Dependencies

angel3_framework, http_parser, prometheus_client

More

Packages that depend on angel3_prometheus