#4378 Draft: Add OpenTelemetry instrumentation module
Opened by lsedlar. Modified
lsedlar/koji opentelemetry-instrumentation  into  master

Download 4378.patch

Disclaimer: I had this code lying around, and wanted to share here. I'm not convinced this should really be part of Koji code base, especially not in the current state with no tests. But it may be useful to someone.

The summary of this change is that for an opentelemetry instrumented application using Koji API it is tricky to get visibility into the API calls. The easy option is using RequestsInstrumentor, which exposes the HTTP calls. This is very much not helpful, as all you see is POST requests to the same end point. This module adds additional spans that expose more details about the calls.

The code has a few issues (apart from the missing tests):

  • The API call arguments are attached as attributes to the span. This could leak sensitive information (username+password, maybe also something else?), and also it could run into size limits (but I don't know if there are any).
  • The multicall interface is fairly complicated, and it leaks the internal details. The traces are slightly different depending on which multicall approach was used.

Commit message follows:


This module allows Koji library users to enable instrumentation by wrapping the ClientSession. It will then create a span for each API call.

The spans store which method was called and what the arguments were.

This is completely transparent to the server. The instrumentation does not forward any trace IDs to the hub (unless requests are instrumented, in which case the traceparent header is added to all HTTP calls).

Metadata