Performing Observability and Monitoring

Describing Observability in Kyma

Objectives

After completing this lesson, you will be able to:
  • Explain observability core concepts
  • Illustrate the basic concepts of telemetry in Kyma
  • Explain how to integrate Kyma with SAP Cloud Logging

Introduction to Observability

You are now operating some workloads using SAP BTP, Kyma runtime and want to gain more insights into your running applications. For this purpose, you want to start collecting and analyzing telemetry signals of your application, such as logs, traces, and metrics. In this lesson, you will learn about the telemetry features of Kyma for collecting the relevant data and analyzing this data with SAP Cloud Logging.

What is Observability?

Observability means the ability of a system to provide information about its internal state. You can use this information to monitor system behavior and diagnose problems. Observability is a key concept in microservice-based applications, where many components interact in complex ways. Applications expose insights about their internal state using logs, metrics, and traces. Collectively, these insights are called "telemetry".

The Kyma Telemetry Module

Overview

SAP BTP, Kyma runtime comes with the Telemetry module, which provides a Kubernetes API to collect and ship typical telemetry data of your instrumented workload to observability backends, like SAP Cloud Logging.

Application Log Collection

Application logs are essential for operating and troubleshooting applications. Ideally, logs are stored in an external system for several days and can be easily filtered.

The Telemetry module comes with a solution for collecting logs based on the OpenTelemetry Collector. Using an API called LogPipeline, you can collect or push application logs seamlessly. When you specify an SAP Cloud Logging endpoint as a destination, you can access the log data for a time period that you configure. Additionally, if the application logs are collected in the JSON format, they are parsed and pushed to the target over the OpenTelemetry protocol (OTLP). You can then search and filter across all log attributes.

Trace Collection

Distributed traces help you understand application behavior and the connections between frontend actions and backend implementation. They can record the request chain across several workloads and execution chains inside an application. Traces consist of spans that are emitted by the individual components taking part in a trace. By collecting and sending all spans to an observability backend, you can analyze the distributed traces across your SAP BTP, Kyma runtime.

The Telemetry module includes a solution for collecting distributed traces based on the OpenTelemetry Collector. Using an API called TracePipeline, you can establish a cluster-central gateway to which instrumented applications can push span data. Istio and many other Kyma modules are preconfigured to push spans to this gateway. If you specify an SAP Cloud Logging endpoint as a destination, you get instant access to the trace data with some visualizations. To see the correlation between logs and traces, enrich your application logs with a trace ID attribute.

To instrument the span data inside your application, use the available OpenTelemetry SDKs. Additionally, many auto-instrumentations are available for most languages and tools. Ensure your application sends its span data using OTLP, as this is the format the gateway uses.

Metric Collection

Metrics are aggregated statistics that reflect a component's internal state over time, unlike logs and traces, which are request-oriented. Typical statistics, such as the number of processed requests or registered users, can be very useful for monitoring the current state and health of a component. Also, you can define proactive and reactive alerts if metrics are about to reach thresholds, or if they have already passed thresholds.

The Telemetry module provides an API MetricPipeline, which will establish a cluster-central gateway based on the OpenTelemetry Collector, to which instrumented workloads can send metric data. If you specify an SAP Cloud Logging endpoint as a destination, you get instant access to the metric data with a basic metric explorer.

Additionally, the MetricPipeline supports different kinds of input scenarios to easily collect metrics:

  • From the Kubernetes runtime about your application
  • From Istio sidecars
  • From any application exposing metrics in a Prometheus format

To instrument the metric data inside your application, use the available OpenTelemetry SDKs. Additionally, many auto-instrumentations are available for most languages and tools. Ensure your application sends its span data using OTLP, as this is the format the gateway uses.

Integration with SAP Cloud Logging

To integrate SAP Cloud Logging, you must complete the following steps:

  1. Create an instance of SAP Cloud Logging with an account and have a Kubernetes Secret available with the account credentials. SAP Cloud Logging is a SAP BTP service, and its instance is created via the regular service management features.
    • With the SAP BTP Operator module, you can define a ServiceInstance resource, referencing the service plan to use and providing additional parameters for the service configuration.
    • You must also create a ServiceBinding resource, which requests an account in the service. Here, you can configure the regular credential rotation.
    • The ServiceBinding triggers the generation of a Kubernetes Secret that holds the credentials.
  2. Define a LogPipeline with the Telemetry API referencing the Secret that holds the credentials.
    • With the Telemetry module, you can define a LogPipeline, which creates the relevant agent or gateways in the cluster for collecting the telemetry data.
    • The LogPipeline references the Secret with the service credentials, which is used by the log agent to ship the data.
    • When the automatic credential rotation of the ServiceBinding updates the Secret, the log agent is reconfigured with the new credentials.

The following diagram illustrates an example integration with the LogPipeline. The same applies to the TracePipeline and MetricPipeline features.

Summary

In this lesson, you have learned about the different aspects of the Telemetry module in Kyma and how to integrate them with SAP Cloud Logging to gain instant access to telemetry data for analysis and alerting.

In the next exercise, you will integrate SAP Cloud Logging using the Kyma Telemetry API and start discovering the available data.