Sign inSign up

plasmops/promexp-examples

By plasmops

•Updated almost 8 years ago

NodeJS metrics export to Prometheus (examples)

Image
0

85

plasmops/promexp-examples repository overview

⁠Prometheus metrics exporter

⁠Prometheus scratch metrics endpoint

Usually you would want to expose your application metrics via /metrics endpoint.

⁠Log events metrics

Generally a json log event contains several fields like message, level and hopefully others :). In order to export log event metrics it's sufficient only a few these fields. The first one is level, since obviously we want to know the number of magnitude of errors, infos and warnings. The second could be message, but please do not use it. Messages tend to be a random text describing a particular event. A better choice to introduce an event type (event_type) which will stand for a short and unique identifier of an event.

Due to the nature of log events the suitable metric type would be a counter, since there's the only task to estimate the number of log events happening.

The sample code is available log events exporter⁠, container plasmops/promexp-examples:logevents⁠.

⁠Example
docker run --rm -it -p 80:80 plasmops/promexp-examples:logevents

# wait for a while
curl http://localhost/metrics

Tag summary

Content type

Image

Digest

Size

29.2 MB

Last updated

almost 8 years ago

docker pull plasmops/promexp-examples:logevents