Customize Function Traces ​
This tutorial shows how to use the built-in OpenTelemetry tracer object to send custom trace data to the trace backend.
Kyma Functions are instrumented to handle trace headers. This means that every time you call your Function, the executed logic is traceable using a dedicated span visible in the trace backend (that is, start time and duration). Additionally, you can extend the default trace context and create your own custom spans as you wish (that is, when calling a remote service in your distributed application) or add additional information to the tracing context by introducing events and tags. The following tutorial shows you how to do it using tracer client that is available as part of the event object.
Prerequisites ​
Before you start, make sure you have these tools installed:
Steps ​
The following code samples illustrate how to enrich the default trace with custom spans, events, and tags:
- Create an inline Function with the following body:
Find the traces for the Function in the trace backend.