Skip to content

Context propagation error with io.micrometer #3499

@JaEdmuva

Description

@JaEdmuva

I have a Spring boot 3.1.0/webflux/reactor 3.5.6
When using reactor 3.5.3 or after (as indicated in the documentation (https://micrometer.io/docs/observation#instrumentation_of_reactive_libraries_after_reactor_3_5_3)
with the Hook API:

Hooks.enableAutomaticContextPropagation();

It will generate an error due to an update in io.micrometer.context-propagation API. It will no longer allow to call the .reset() in the ThreadLocalAccessor interface since it's been deprecated, resulting in an exception like this:

IllegalStateException(this.getClass().getName() + "#reset() should not be called. Please implement #setValue() method when removing the #reset() implementation.");

Expected Behavior

The context propagation should be executed without errors

Actual Behavior

An exception is thrown when enabling automatic context propagation

Possible Solution

IF it's simple as that, the solution would be to call the restore(V previousValue) or setValue(previousValue) method to actually 'reset' the state

Your Environment

Springboot 3.1.0
io.micrometer:micrometer-tracing-bridge-otel:1.1.2

  • Reactor version(s) used: 3.5.6
  • Other relevant libraries versions (eg. netty, ...): reactor-netty-http:1.1.7
  • JVM version (java -version): 17
  • OS and version (eg uname -a): mac os

Metadata

Metadata

Assignees

No one assigned

    Labels

    for/other-projectThis issue belongs to another project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions