Python
Please follow the steps outlined in this document.
Once your application is emitting metrics, your POD in K8s will need to be annotated to enable the agent to scrape the metrics. Following are the relevant annotations:
It is very simple to configure trace context (traceId, spanId, and trace flags) injection into user logs in Python applications. Please follow the below mentioned steps to inject the trace context to the logs:
There is no out of the box auto-instrumentation to inject the trace context. Instead, you'll have to get a context from current span and attach it to the log statement.
Step 1: Import the library.
Step 2: Get the current span context.
Step 3: Get trace_id and span_id from the context.
Step 4: Inject trace context (trace_id and span_id) to the log.
Please ensure the aforementioned code block is added to a file where your application requests are traced with OTel Python instrumentation.
If you are running a python application in a VM, ensure you have installed OpsVerse Agent and OpenTelemetry Collector using steps in the OpsVerse Docs, and then instrument your application using the docs below: