Skip to content

Commit 6a1838d

Browse files
committed
Revert HelidonServerResponseMutator singleton; instantiate inline
Matches the dominant convention for non-enum HttpServerResponseMutator implementations in this repo (Akka, Pekko, Grizzly, Jetty 8/11/12, Servlet 3/5, Liberty all use 'new XyzResponseMutator()' at the call site) and the default rule in general-rules.md ('Prefer Instance Creation Over Singletons'). Header customization is not a hot path that warrants the singleton exception.
1 parent c1d849f commit 6a1838d

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

instrumentation/helidon-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/helidon/v4_3/HelidonServerResponseMutator.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010

1111
final class HelidonServerResponseMutator implements HttpServerResponseMutator<ServerResponse> {
1212

13-
static final HelidonServerResponseMutator INSTANCE = new HelidonServerResponseMutator();
14-
15-
private HelidonServerResponseMutator() {}
16-
1713
@Override
1814
public void appendHeader(ServerResponse res, String name, String value) {
1915
res.header(name, value);

instrumentation/helidon-4.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/helidon/v4_3/ResponseCustomizingFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void filter(FilterChain chain, RoutingRequest req, RoutingResponse res) {
2121

2222
var context = Context.current();
2323
HttpServerResponseCustomizerHolder.getCustomizer()
24-
.customize(context, res, HelidonServerResponseMutator.INSTANCE);
24+
.customize(context, res, new HelidonServerResponseMutator());
2525
chain.proceed();
2626
}
2727
}

0 commit comments

Comments
 (0)