Skip to content

Commit

Permalink
Remove static from http2metricschannelhandler to allow for override (#…
Browse files Browse the repository at this point in the history
…1750)

* Remove static from http2metricschannelhandler to allow for override

* Update incrementErrorCounter function

---------

Co-authored-by: $(git --no-pager log --format=format:'%an' -n 1) <$(git --no-pager log --format=format:'%ae' -n 1)>
  • Loading branch information
karim-z authored Feb 29, 2024
1 parent 401d2a4 commit 3276e6a
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ public Outbound outbound() {
return outbound;
}

protected static void incrementErrorCounter(
Registry registry, String counterName, String metricId, Http2Exception h2e) {
protected void incrementErrorCounter(Registry registry, String counterName, String metricId, Http2Exception h2e) {
String h2Error = h2e.error() != null ? h2e.error().name() : "NA";
String exceptionName = h2e.getClass().getSimpleName();

registry.counter(counterName, "id", metricId, "error", h2Error, "exception", exceptionName)
.increment();
}

protected static void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) {
protected void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) {
long errorCode;
if (frame instanceof Http2ResetFrame) {
errorCode = ((Http2ResetFrame) frame).errorCode();
Expand All @@ -69,7 +68,7 @@ protected static void incrementCounter(Registry registry, String counterName, St
}

@ChannelHandler.Sharable
private static class Inbound extends ChannelInboundHandlerAdapter {
private class Inbound extends ChannelInboundHandlerAdapter {
private final Registry registry;
private final String metricId;
private final String frameCounterName;
Expand Down Expand Up @@ -117,7 +116,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E
}

@ChannelHandler.Sharable
private static class Outbound extends ChannelOutboundHandlerAdapter {
private class Outbound extends ChannelOutboundHandlerAdapter {
private final Registry registry;
private final String metricId;
private final String frameCounterName;
Expand Down

0 comments on commit 3276e6a

Please sign in to comment.