1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.http; 17 18 import software.amazon.awssdk.annotations.SdkPublicApi; 19 import software.amazon.awssdk.metrics.MetricCategory; 20 import software.amazon.awssdk.metrics.MetricLevel; 21 import software.amazon.awssdk.metrics.SdkMetric; 22 23 /** 24 * Metrics collected by HTTP clients for HTTP/2 operations. See {@link HttpMetric} for metrics that are available on both HTTP/1 25 * and HTTP/2 operations. 26 */ 27 @SdkPublicApi 28 public final class Http2Metric { 29 /** 30 * The local HTTP/2 window size in bytes for the stream that this request was executed on. 31 * 32 * <p>See https://http2.github.io/http2-spec/#FlowControl for more information on HTTP/2 window sizes. 33 */ 34 public static final SdkMetric<Integer> LOCAL_STREAM_WINDOW_SIZE_IN_BYTES = 35 metric("LocalStreamWindowSize", Integer.class, MetricLevel.TRACE); 36 37 /** 38 * The remote HTTP/2 window size in bytes for the stream that this request was executed on. 39 * 40 * <p>See https://http2.github.io/http2-spec/#FlowControl for more information on HTTP/2 window sizes. 41 */ 42 public static final SdkMetric<Integer> REMOTE_STREAM_WINDOW_SIZE_IN_BYTES = 43 metric("RemoteStreamWindowSize", Integer.class, MetricLevel.TRACE); 44 Http2Metric()45 private Http2Metric() { 46 } 47 metric(String name, Class<T> clzz, MetricLevel level)48 private static <T> SdkMetric<T> metric(String name, Class<T> clzz, MetricLevel level) { 49 return SdkMetric.create(name, clzz, level, MetricCategory.CORE, MetricCategory.HTTP_CLIENT); 50 } 51 } 52