Skip to content

Commit 09cae5f

Browse files
committed
* sse: add listener context
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
1 parent e8a9df1 commit 09cae5f

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
> support JSONB type, use "?::jsonb" instead of "?" for jsonb query
1212
> support gcloud IAM auth
1313
* log-exporter: strict schema definition
14+
* sse: add listener context
1415

1516
### 9.2.1 (4/24/2025 - 5/19/2025) !!! only support java 24
1617

core-ng/src/main/java/core/framework/internal/web/sse/ServerSentEventCloseHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public void exchangeEvent(HttpServerExchange exchange, NextListener next) {
3434
actionLog.context("client_ip", channel.clientIP);
3535
if (channel.traceId != null) actionLog.context("trace_id", channel.traceId);
3636

37+
actionLog.context("listener", support.listener.getClass().getCanonicalName());
3738
support.listener.onClose(channel);
3839

3940
if (!channel.groups.isEmpty()) actionLog.context("group", channel.groups.toArray());

core-ng/src/main/java/core/framework/internal/web/sse/ServerSentEventHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ void handle(HttpServerExchange exchange, StreamSinkChannel sink) {
118118
request.session = ReadOnlySession.of(sessionManager.load(request, actionLog));
119119
String lastEventId = exchange.getRequestHeaders().getLast(LAST_EVENT_ID);
120120
if (lastEventId != null) actionLog.context("last_event_id", lastEventId);
121+
122+
actionLog.context("listener", support.listener.getClass().getCanonicalName());
121123
support.listener.onConnect(request, channel, lastEventId);
124+
122125
if (!channel.groups.isEmpty()) actionLog.context("group", channel.groups.toArray()); // may join group onConnect
123126
} catch (Throwable e) {
124127
logManager.logError(e);

0 commit comments

Comments
 (0)