Skip to content

infa-pavakuma/prometheus-example-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus Example App

This example app serves as an example of how one can easily instrument HTTP handlers with Prometheus metrics. It uses the Prometheus go client to create a new Prometheus registry.

Usage is simple, on any request to / the request will result in a 200 response code. This increments the counter for this response code. Similarly the /err endpoint will result in a 404 response code, therefore increments that respective counter. Duration metrics are also exposed for any request to /.

A Docker image is available at: quay.io/brancz/prometheus-example-app:v0.3.0

Deploying in a Kubernetes cluster

First, deploy one instance of this example application, which listens and exposes metrics on port 8080 using the following Deployment manifest.

Then, in order for Prometheus to be able to discover and scrape these metrics, in this repository we provide Pod Monitor custom resource as an example. For that, Prometheus Operator needs to be running in the cluster. To install it, follow this guide: quickstart.

For this example application, PodMonitor manifest describes how the metrics can be discovered and scrapped by Prometheus.

About

Go app that exposes metrics about its HTTP handlers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 82.7%
  • Makefile 11.0%
  • Dockerfile 6.3%