Skip to content

otel context isn't propagated #1653

@vainaircorn

Description

@vainaircorn

I've instrumented my indexing code with openllmetry; when submitting batches on the ThreadPoolExecutor the context (used by otel to propagate trace) isn't being passed:

following is suggested fix:

# do not block the thread - the results are written to a central (locked) list and we want to have multiple concurrent batch-requests
ctx = contextvars.copy_context()

self.__executor.submit(
    ctx.run,
    functools.partial(self.__send_batch, objs, refs, readd_rate_limit=isinstance(self.__batching_mode, _RateLimitedBatching)),
)

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