Just a simple example how to export your custom metrics.
Basically this repo would like to show how to write a basic producer/consumer application in Go and create custom Prometheus metrics. In fact most of the tasks are just faked, this means there is no an effective processing, just some random data in order to simulate time consuming tasks with failure as well.
$ kubectl create ns prometherion
namespace/prometherion created
$ eval $(minikube docker-env); docker build . -t prometherion/prometheus-exporter-golang:latest
Sending build context to Docker daemon 11.04MB
(...)
Successfully tagged prometherion/prometheus-exporter-golang:latest
$ kubectl -n prometherion create -f manifests/k8s
service/consumer-create-metrics created
service/consumer-delete-metrics created
service/consumer-read-metrics created
service/consumer-update-metrics created
deployment.extensions/consumer-create created
deployment.extensions/consumer-delete created
deployment.extensions/consumer-read created
deployment.extensions/consumer-update created
deployment.extensions/grafana created
service/grafana created
deployment.extensions/prometheus created
service/prometheus created
configmap/prometheus created
deployment.extensions/redis created
service/redis created
Basically I'm not using Ingress in order to approach KISS, so deploying Grafana service as NodePort: you can grab it using this command.
$ k get svc grafana -o jsonpath='{.spec.ports[0].nodePort}'
3260
Obviously Minkube IP can be obtained with the following command:
$ minikube ip
192.168.99.100
Since it's a default installation, you can login with credentials admin / admin.
So you can add the Prometheus datasource using the address
http://prometheus:9090
and load the
dashboard.
Just use the produce.sh script that create random actions and push them as Batch Jobs.