I have got metrics and traces sent to Grafana Cloud OTLP endpoints (/v1/metrics, /v1/traces) succesfully. See feat: Added OpenTelemetry Tracing Support · gshiva/pygptcourse@f84c368 · GitHub
I am trying to add logs to the traces and followed the example of opentelemetry-python/docs/examples/logs/example.py at main · open-telemetry/opentelemetry-python · GitHub with the end point set to /v1/logs.
Only a minor issue now that I listed in the reply.
It is user error. I had set the exporter to grpc
protocol (second time I am doing it (facepalm)).
The direct logs sending works now. But attaching it to regular logger in my trace decorator seems to have an issue. IDK.
{“body”:"Failed to export logs batch code: 204, reason: ",“severity”:“ERROR”,“resources”:{“service.name”:“TShirtLauncherControl”,“telemetry.sdk.language”:“python”,“telemetry.sdk.name”:“opentelemetry”,“telemetry.sdk.version”:“1.22.0”},“instrumentation_scope”:{“name”:“opentelemetry.sdk._logs._internal”}}
It is very late for me.
Wanted to update the forum before I sign off.
it is working great actually. As long as I send a warning or error log, it shows up. If someone can tell me how to get the trace log correlation working (an example would be awesome)
Kudos to Grafana team for making the OLTP endpoint available. Saves us so much time setting up, configuring, running, maintaining and monitoring agents.
2 Likes
Have you looked at otel auto instrumentation and also beyla?
I briefly saw the examples for auto instrumentation. It seemed that they were available only for .NET or Java.
I briefly looked at beyla. It seems to be for HTTP/S/grPC apps. Mine is a command line python app.