OpenTelemetry Support
...
Service Integration Guides
Kubernetes Auto-Instrumentatio...

Go Application

4min

This document explains how to instrument the Go application with KloudMate, using OpenTelemetry.

This instrumentation can be possible using the OpenTelemetry operator, which supports injecting and configuring auto-instrumentation libraries for .NET, Java, Node.js, Python, and Go service.

Pre-requisites:

  1. Running a Kubernetes cluster.
  2. The cert-manager must be installed. If you use the helm chart, there is an option to generate a self-signed cert instead.

Step 1: First, install the OpenTelemetry Operator into your cluster.

You can do this with the Operator release manifest, the Operator helm chart, or with Operator Hub.

BASH


Step 2: Create an OpenTelemetry collector to send telemetry from containers to a collector instead of directly to a backend.

For example, here is a demo collector used

YAML


Change your Kloudmate workspace API key to configure the collector to export data to Kloudmate.

Step 3: Configure automatic instrumentation

To be able to manage automatic instrumentation, the Operator needs to be configured to know what pods to the instrument and which automatic instrumentation to use for those pods. This is done via the Instrumentation CRD

For example, we used Go SDK auto instrumentation.

The following command creates a basic Instrumentation resource that is configured for instrumenting Go services to get metrics, logs, and traces.

YAML


The endpoint used under exporter must be the same as the service name of the collector created in Step 2. Use only one instrumentation command as per the requirement.

Step 4: Now opt-in your services to automatic instrumentation. This is done by updating your service’s spec.template.metadata.annotations to include a language-specific annotation

To patch your existing. Go application with the necessary annotation and use the below command

BASH