Skip to content

Make opentelemetry dependecies optional. #361

@bloodearnest

Description

@bloodearnest

We currently vendor many opentelemetry packages, and their dependencies, including things like protobufs. These are pulled in via jobrunner, which is instrumented from its production days.

However, it is rare we ever actually use the otel tracing embedded in jobrunner, although it has proved useful from time to time.

We could remove all the instrumentation, and all the dependencies, but that would a) be quite a lot of work and b) we do want to collect telemetry from opensafely-cli in the future.

However, opentelemetry packages are designed to support this use case. The only required package is opentelemetry-api - you can instrument your codebase using it, and it will by default do nothing with it. Then you can add the sdk and an exporter package, and start emitting telemetry.

So, we can just vendor the opensafely-api package, and make all the others optional. To enable tracing, we can add a package extra so you can pip install opensafely[tracing]. This would remove 9 dependencies and >50k lines from the this project, but not remove otel support entirely, for future and current use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions