Skip to content

Missing ObservationRegistry Configuration in StreamBridge for Dynamic MessageChannels #3033

@agustino-lim

Description

@agustino-lim

In the current implementation of StreamBridge, when a message is published to a dynamic destination, the following code creates a local messageChannel:

https://github.com/spring-cloud/spring-cloud-stream/blob/main/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/function/StreamBridge.java#L291-L293

messageChannel = this.isAsync() ? new ExecutorChannel(this.executorService) : new DirectWithAttributesChannel();
((AbstractSubscribableChannel) messageChannel).setApplicationContext(applicationContext);
((AbstractSubscribableChannel) messageChannel).setComponentName(destinationName);

However, this messageChannel does not have an ObservationRegistry registered with it. As a result, the messages sent through this dynamically created channel are published without observability support, which means tracing is missing.

Expected Behavior:
Ideally, StreamBridge should ensure that any dynamically created messageChannel is configured with an ObservationRegistry, enabling observability features for all messages published through these channels.

Reference:
https://github.com/spring-projects/spring-integration/blob/main/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationManagementConfigurer.java#L205-L218

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