Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.8 KB

README.md

File metadata and controls

53 lines (39 loc) · 1.8 KB

Expose Custom Metrics in Kyma

Overview

This example shows how to expose custom metrics to Prometheus with a Golang service in Kyma. To do so, follow these steps:

  1. Expose a sample application serving metrics on the 8081 port.
  2. Access the exposed metrics in Prometheus.

Prerequisites

  • Kyma as the target deployment environment.
  • If sidecar injection is not enabled for the default Namespace, run the following command:
    kubectl label namespace default istio-injection=enabled

Installation

Expose a sample metrics application

Deploy the application, service, and servicemonitor:

kubectl apply -f deployment -R

Access the exposed metrics in Prometheus

  1. Run the port-forward command on the core-prometheus service:

    kubectl port-forward -n kyma-system svc/core-prometheus 9090:9090

All the sample-metrics endpoints appear as the Targets list.

  1. Use either the cpu_temperature_celsius or hd_errors_total in the expression field here.
  2. Click the Execute button to check the values scrapped by Prometheus.

Cleanup

Run the following commands to completely remove the example and all its resources from the cluster:

  1. Remove the istio-injection label from the default Namespace.
    kubectl label namespace default istio-injection-
  2. Remove ServiceMonitor in the kyma-system Namespace.
    kubectl delete servicemonitor -l example=monitoring-custom-metrics -n kyma-system
  3. Remove the sample-metrics Deployments in the default Namespace.
    kubectl delete all -l example=monitoring-custom-metrics