Customize Function traces
This tutorial shows how to use the build-in OpenTelemetry tracer object to send custom trace data to the Jaeger service.
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 Jaeger service (i.e. start time and duration). Additionally, you can extend the default trace context and create your own custom spans whenever you feel it is helpful (i.e. when calling a remote service in your distributed application) or add additional information to the tracing context by introducing events and tags. This tutorial shows you how to do it using tracer client that is available as part of the event object.
Before you start, make sure you have these tools installed:
- Kyma installed on a cluster
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:
Expose Jaeger securely and open the following Jaeger's address in your browser:Click to copyhttp://localhost:16686
NOTE: By default, only 1% of the requests are sent to Jaeger for the trace recording. To increase this number see the Jaeger doesn't show the traces you want to see page.
Choose your Deployment's name from the Service list and click Find Traces