@Override
    protected void onBeforeHandling(Request request) {
        if (monitoringHandlerPaths.stream()
                .anyMatch(pathPrefix -> request.getHttpURI().getPath().startsWith(pathPrefix))){
            return;
        }
        Connection connection = request.getConnectionMetaData().getConnection();
        if (isHttpServerConnection(connection)) {
            ConnectionMetrics metrics = this.connectionsMetrics.computeIfAbsent(
                    connection,
                    () -> new ConnectionMetrics(getConnector(request).getConnectorMetricContext()));
            metrics.requests.incrementAndGet();
        }
    }
Aggregates connection specific metrics such as {@link MetricDefinitions#REQUESTS_PER_CONNECTION}.

@author bjorncs
container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionMetricAggregator.java