PrometheusHTTPServer

command module
v0.0.0-...-40367cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 8 Imported by: 0

README

Prometheus HTTP Server

An example application that shows how to implement Prometheus Metrics into your Golang application and visualize the data using Grafana.

Requirements

  • Golang
  • Docker

Getting started

Starting the application

You can start all services by running the docker-compose file:

docker-compose up -d
Generating load on HTTP Server

You can either generate load manually by visiting the HTTP page on localhost:8080 or generate load using some load generator. I use Hey, which is an easy to use command-line tool.

hey -z 5m -q 5 -m GET -H "Accept: text/html" http://127.0.0.1:8080

hey -n 10000 -c 100 -m GET -H "Accept: text/html" http://127.0.0.1:8080

You can now see the metrics of your application on http://localhost:8080/metrics.

Importing Grafana dashboard

Lastly, you can visualize the metrics data using Grafana, which should be running on localhost:3000 after deploying the docker-compose file.

  1. You need to set Prometheus as your data source
  2. Visualize the exposed Prometheus metrics in a Dashboard (I have also included a dashboard file in the Grafana folder that you can import)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL