Skip to content

Observability context not propagated #220

@jonenst

Description

@jonenst

Describe the current behavior

when applying a big modification we do it in a thread pool, we must propagate the observability context

Describe the expected behavior

should have traceid in logs

Describe the steps

No response

Environment

No response

Relevant Log Output

No response

Extra Information

Example code

<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>context-propagation</artifactId>
</dependency>
import io.micrometer.context.ContextExecutorService;
import io.micrometer.context.ContextSnapshotFactory;

public class ImportExportExecutionService {
   public ImportExportExecutionService(...) {
    // wrap(ExecutorService) is deprecated, micrometer wants us to be explicit
    // wrap executor to propagate traceids from opened scopes in the threads
    executorService = ContextExecutorService.wrap(threadPoolExecutor, () ->
        ContextSnapshotFactory.builder().build().captureAll()
    );
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions