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.metrics; 17 18 import software.amazon.awssdk.annotations.SdkPublicApi; 19 20 /** 21 * The {@code MetricLevel} associated with a {@link SdkMetric}, similar to log levels, defines the 'scenario' in which the metric 22 * is useful. This makes it easy to reduce the cost of metric publishing (e.g. by setting it to {@link #INFO}), and then increase 23 * it when additional data level is needed for debugging purposes (e.g. by setting it to {@link #TRACE}. 24 */ 25 @SdkPublicApi 26 public enum MetricLevel { 27 /** 28 * The metric level that includes every other metric level, as well as some highly-technical metrics that may only be useful 29 * in very specific performance or failure scenarios. 30 */ 31 TRACE, 32 33 /** 34 * The "default" metric level that includes metrics that are useful for identifying <i>why</i> errors or performance issues 35 * are occurring within the SDK. This excludes technical metrics that are only useful in very specific performance or failure 36 * scenarios. 37 */ 38 INFO, 39 40 /** 41 * Includes metrics that report <i>when</i> API call errors are occurring within the SDK. This <b>does not</b> include all 42 * of the information that may be generally useful when debugging <i>why</i> errors are occurring (e.g. latency). 43 */ 44 ERROR; 45 includesLevel(MetricLevel level)46 public boolean includesLevel(MetricLevel level) { 47 return this.compareTo(level) <= 0; 48 } 49 } 50