Zudoku
Guides

OpenTelemetry Collector

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

To run this example, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, for example Docker.

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

Code(bash)
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. This guide uses fra (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช):

Code(bash)
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra

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

Code(bash)
kraft cloud deploy -M 1024M .

The output shows the instance address and other details:

Code(ansi)
[โ—] 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're different for each run.

Note that the instance doesn't 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 change and redeploy!

You can list information about the instance by running:

Code(bash)
kraft cloud instance list
Code(text)
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:

Code(bash)
kraft cloud instance remove opentelemetry-collector-bvtnh

Customize your app

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

Code(yaml)
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:

Code(bash)
kraft cloud --help

Or visit the CLI Reference.

Last modified on