Skip to content

Commit

Permalink
GH-9001: Revise Observation propagation over the channel
Browse files Browse the repository at this point in the history
Fixes: #9001

The `ObservationPropagationChannelInterceptor` does not propagate an observation properly.
And it fully cannot when the message channel is persistent.

* Deprecate `ObservationPropagationChannelInterceptor` in favor of enabled observation on the channel
and target `MessageHandler` which is a consumer of this channel.
* Remove tests with an `ObservationPropagationChannelInterceptor`
* Mention a correct behavior in the `metrics.adoc` and `ObservationPropagationChannelInterceptor` Javadocs
  • Loading branch information
artembilan committed Mar 18, 2024
1 parent 91d21c2 commit 0b1d691
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 386 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,22 @@
* implementation responsible for an {@link Observation} propagation from one message
* flow's thread to another through the {@link MessageChannel}s involved in the flow.
* Opens a new {@link Observation.Scope} on another thread and cleans up it in the end.
* <p>
* NOTE: This interceptor is proven to be wrong since an existing observation usually is closed
* on the sender side before the message is consumed on the receiver side.
* Therefore, it is better to have a {@code sender} observation on this channel,
* and then {@code receiver} observation on a subscriber for this channel.
* This way a tracing information is stored into message headers passing this channel.
* Such an approach also eliminate a problem with persistent message channels where
* an {@link Observation} is not serializable to be stored into database as a part of the message.
*
* @author Artem Bilan
*
* @since 6.0
*
* @deprecated since 6.1.7 for removal in 6.4 in favor of enabling observation on the channel and its consumer.
*/
@Deprecated(since = "6.1.7", forRemoval = true)
public class ObservationPropagationChannelInterceptor extends ThreadStatePropagationChannelInterceptor<Observation> {

private final ThreadLocal<Observation.Scope> scopes = new ThreadLocal<>();
Expand Down

This file was deleted.

Loading

0 comments on commit 0b1d691

Please sign in to comment.