Skip to content

Commit

Permalink
minor nits
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhee17 committed Sep 19, 2024
1 parent 5964079 commit 7417ccd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ private GracefulShutdownSupport(ServerMetrics serverMetrics) {
* Increases the number of pending responses.
*/
final void inc() {
serverMetrics.increasePendingResponse();
serverMetrics.increasePendingResponses();
}

/**
* Decreases the number of pending responses.
*/
void dec() {
serverMetrics.decreasePendingResponse();
serverMetrics.decreasePendingResponses();
}

/**
Expand Down Expand Up @@ -119,7 +119,7 @@ private static final class DefaultGracefulShutdownSupport extends GracefulShutdo
private volatile long shutdownStartTimeNanos;

private DefaultGracefulShutdownSupport(Duration quietPeriod, Executor blockingTaskExecutor, Ticker ticker,
ServerMetrics serverMetrics) {
ServerMetrics serverMetrics) {
super(serverMetrics);
quietPeriodNanos = quietPeriod.toNanos();
this.blockingTaskExecutor = blockingTaskExecutor;
Expand Down
18 changes: 8 additions & 10 deletions core/src/main/java/com/linecorp/armeria/server/ServerMetrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class ServerMetrics implements MeterBinder {
private final LongAdder activeHttp1WebSocketRequests = new LongAdder();
private final LongAdder activeHttp1Requests = new LongAdder();
private final LongAdder activeHttp2Requests = new LongAdder();
private final LongAdder pendingResponse = new LongAdder();
private final LongAdder pendingResponses = new LongAdder();

/**
* AtomicInteger is used to read the number of active connections frequently.
Expand Down Expand Up @@ -103,7 +103,7 @@ public long activeHttp2Requests() {
* Returns the number of pending responses.
*/
public long pendingResponses() {
return pendingResponse.longValue();
return pendingResponses.longValue();
}

/**
Expand Down Expand Up @@ -161,12 +161,12 @@ void decreaseActiveConnections() {
activeConnections.decrementAndGet();
}

void increasePendingResponse() {
pendingResponse.increment();
void increasePendingResponses() {
pendingResponses.increment();
}

void decreasePendingResponse() {
pendingResponse.decrement();
void decreasePendingResponses() {
pendingResponses.decrement();
}

@Override
Expand All @@ -191,9 +191,7 @@ public void bindTo(MeterRegistry meterRegistry) {
ImmutableList.of(Tag.of("protocol", "http1.websocket"), Tag.of("state", "active")),
activeHttp1WebSocketRequests);
// pending responses
meterRegistry.gauge(allRequestsMeterName,
ImmutableList.of(Tag.of("protocol", "all"), Tag.of("state", "active")),
pendingResponse);
meterRegistry.gauge("armeria.server.pending.responses", pendingResponses);
}

@Override
Expand All @@ -205,7 +203,7 @@ public String toString() {
.add("pendingHttp2Requests", pendingHttp2Requests)
.add("activeHttp2Requests", activeHttp2Requests)
.add("activeConnections", activeConnections)
.add("pendingResponse", pendingResponse)
.add("pendingResponses", pendingResponses)
.toString();
}
}

0 comments on commit 7417ccd

Please sign in to comment.