In theory that library could use the ContextData class I just added to get context data no matter how it got there. However, the Micrometer library’s setValue and getValue set and retrieve the full map, not values. That won’t play nice with a ScopedContext since once you set it you would immediately be leaving the context so what you set would be instantly forgotten. Under the covers of course it could push a new map on the queue but that would likely behave very differently than the way ScopedContext does - i.e. you are completely replacing maps not incrementally modifying them.
Ralph > On Apr 15, 2024, at 10:07 AM, Piotr P. Karwasz <piotr.karw...@gmail.com> > wrote: > > Hi, > > On Mon, 15 Apr 2024 at 18:44, Matt Sicker <m...@musigma.org > <mailto:m...@musigma.org>> wrote: >> Context Propagation support :: Micrometer Context Propagation >> docs.micrometer.io >> >> <https://docs.micrometer.io/context-propagation/reference/>Context >> Propagation support :: Micrometer Context Propagation >> <https://docs.micrometer.io/context-propagation/reference/> >> docs.micrometer.io >> <https://docs.micrometer.io/context-propagation/reference/> >> <https://docs.micrometer.io/context-propagation/reference/> >> >> This is more in line with what I was thinking we should support. I’m not >> suggesting that we add Micrometer as a dependency to the API or Core, but we >> can replicate the minimal API here or figure out a smaller API for >> integration purposes. > > I agree. To support `context-propagation` we don't need to add anything to > the API or SPI. To support it efficiently, we need the two methods from PR > [1]. > > Note that SLF4J is already supported by `context-propagation` (cf. [2]). > > Piotr > > [1] https://github.com/apache/logging-log4j2/pull/2442 > [2] https://github.com/micrometer-metrics/context-propagation/pull/194