simple-service-instrumented

command module
v0.0.0-...-b2922ac Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 11 Imported by: 0

README

Simple Service

Service content

a-service is a simple golang service which exposes 2 http endpoints:

  1. /health
  2. /metrics

It also exposes a bunch of metrics to prometheus:

  1. regular golang metrics
  2. a_hits_total: The total number of hits
  3. avec_duration_seconds: 99th percentile latency in seconds

You can run a docker build and post it to your own docker registry. However for the sake of simplicity a docker images is already available with this a-service at quay.io/bjoydeep/a-service:latest

Goal

Goal is to get the metrics this service emits into the platform Prometheus inside OpenShift - in other words, the Promtheus deployed by the default OpenShift. Check with OpenShift RedHat Team if this will be supported even though you can technically do it.

Steps
  1. Connect to your OpenShift cluster as cluster admin.
  2. Adjust image location in deploy/deploy.yaml if needed.
  3. Run kubectl apply -k deploy/
  4. You will find that a namespace a-service created and a pod and a service is created under it. It will also create ServiceMonitor CR in the openshift-monitoring namespace and allow prometheus-k8s service account in openshift-monitoring namespace to scrape endpoints of service exposed by a-service (it creates the required ClusterRole and ClusterRoleBinding)
  5. Create a route in OpenShift for the service created by a-service
  6. Open up a browser and make requests to http://a-service.*/health a few times.
  7. Check local prometheus for metrics mentioned above

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