Zudoku
Guides

OpenTelemetry Collector

This example uses OpenTelemetry Collector, a vendor-agnostic implementation of how to receive, process and export telemetry data. OpenTelemetry Collector can be used with Unikraft / Unikraft Cloud to work with telemetry data.

To run this example, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, e.g. Docker.

  2. Clone the examples repository and cd into the examples/opentelemetry-collector/ directory:

TerminalCode
git clone https://github.com/kraftcloud/examples cd examples/opentelemetry-collector/

Make sure to log into Unikraft Cloud by setting your token and a metro close to you. We use fra0 (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช) in this guide:

TerminalCode
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra0

When done, invoke the following command to deploy this application on Unikraft Cloud:

TerminalCode
kraft cloud deploy -M 1024M .

The output shows the instance URL and other details:

TerminalCode
[โ—] Deployed successfully! โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ name: opentelemetry-collector-bvtnh โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ uuid: 40e8b154-b3b6-4312-ae69-2cdb794b15e4 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ state: starting โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ image: opentelemetry-collector@sha256:64f73ea5fe208f54e5212f57979f24bebcf36276495462c52b380d15dd539ced โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ memory: 976 MiB โ”œโ”€โ”€ private fqdn: opentelemetry-collector-bvtnh.internal โ”œโ”€โ”€โ”€โ”€ private ip: 172.16.3.3 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ args: /usr/bin/otelcontribcol --config /etc/otel/config.yaml

In this case, the instance name is opentelemetry-collector-bvtnh. They are different for each run.

Note that the instance does not export a service. The default configuration can receive telemetry data from other instances by specifying the private IP or internal DNS as destination. The only configured exporter is the debug exporter. Feel free to modify and redeploy!

At any point in time, you can list information about the instance:

TerminalCode
kraft cloud instance list
Code
razvand@mantis:~/.../examples/opentelemetry-collector$ kraft cloud inst ls NAME FQDN STATE STATUS IMAGE MEMORY ARGS BOOT TIME opentelemetry-collector-bvtnh running since 11mins opentelemetry... 976 MiB /usr/bin/otelcontribcol --config... 177.62 ms

When done, you can remove the instance:

TerminalCode
kraft cloud instance remove opentelemetry-collector-bvtnh

Customize your Application

To customize the OpenTelemetry Collector application, update Kraftfile or, more likely, the rootfs/etc/otel/config.yaml files:

YAMLCode
spec: v0.6 runtime: opentelemetry-collector:latest rootfs: ./rootfs

You can update the rootfs/etc/otel/config.yaml file as detailed in the documentation. Such as adding another export, apart from the debug exporter.

Learn More

Use the --help option for detailed information on using Unikraft Cloud:

TerminalCode
kraft cloud --help

Or visit the CLI Reference.

Last modified on