Deploy 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:
-
Install the
kraft
CLI tool and a container runtime engine, e.g. Docker. -
Clone the
examples
repository andcd
into theexamples/opentelemetry-collector/
directory:
git clone https://github.com/kraftcloud/examplescd 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:
# Set Unikraft Cloud access tokenexport UKC_TOKEN=token# Set metro to Frankfurt, DEexport UKC_METRO=fra0
When done, invoke the following command to deploy this application on Unikraft Cloud:
kraft cloud deploy -M 1024M .
The output shows the instance URL and other details:
[●] 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:
kraft cloud instance list
razvand@mantis:~/.../examples/opentelemetry-collector$ kraft cloud inst lsNAME FQDN STATE STATUS IMAGE MEMORY ARGS BOOT TIMEopentelemetry-collector-bvtnh running since 11mins opentelemetry... 976 MiB /usr/bin/otelcontribcol --config... 177.62 ms
When done, you can remove the instance:
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:
spec: v0.6
runtime: opentelemetry-collector:latest
rootfs: ./rootfs
receivers:otlp:protocols: grpc: endpoint: "0.0.0.0:4317" http: endpoint: "0.0.0.0:4318"
exporters:debug:verbosity: detailed
processors:batch:
extensions:health_check:
service:extensions: [health_check]# Disable the self telemetry which requires process-level datatelemetry:metrics: level: nonepipelines:traces: receivers: [otlp] processors: [batch] exporters: [debug]metrics: receivers: [otlp] processors: [batch] exporters: [debug]logs: receivers: [otlp] processors: [batch] exporters: [debug]
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:
kraft cloud --help
Or visit the CLI Reference.