Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kostis-codefresh/prometheus-sample-app
Example Go app that exposes prometheus metrics
https://github.com/kostis-codefresh/prometheus-sample-app
docker-compose golang graphana prometheus
Last synced: 7 days ago
JSON representation
Example Go app that exposes prometheus metrics
- Host: GitHub
- URL: https://github.com/kostis-codefresh/prometheus-sample-app
- Owner: kostis-codefresh
- License: mit
- Created: 2021-03-22T13:13:49.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-24T17:10:25.000Z (almost 4 years ago)
- Last Synced: 2023-03-05T03:09:15.135Z (almost 2 years ago)
- Topics: docker-compose, golang, graphana, prometheus
- Language: Go
- Homepage:
- Size: 130 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Example Go app that exposes Prometheus metrics
[](https://goreportcard.com/report/github.com/kostis-codefresh/prometheus-sample-app)

Original code modified from https://gabrieltanner.org/blog/collecting-prometheus-metrics-in-golang
## How to build
Run:
* `go build` to get the executable OR
* `docker build . -t example-app` to create a container image if you prefer docker instead or don't have access to a Go dev environment## How to run the application on its own
* `go run .` OR
* `docker run -p 8080:8080 example-app`Then visit http://localhost:8080 or http://localhost:8080/metrics
## How to run with Prometheus and Graphana
Run `docker-compose up`
You can access Prometheus at http://localhost:9090 and Graphana at http://localhost:3000
1. Login into Graphana. Default user/password for Graphana is admin/admin
1. Add a datasource for type Prometheus at address http://localhost:9090 and auth type "Browser"
1. Import [graphana/graphana-dashboard.json](graphana/graphana-dashboard.json) as a premade dashboard