• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018, OpenCensus Authors
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  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.opencensus.metrics;
18 
19 import com.google.auto.value.AutoValue;
20 import io.opencensus.common.ExperimentalApi;
21 import javax.annotation.concurrent.Immutable;
22 
23 /**
24  * The key of a {@code Label} associated with a {@code MetricDescriptor}.
25  *
26  * @since 0.15
27  */
28 @ExperimentalApi
29 @Immutable
30 @AutoValue
31 public abstract class LabelKey {
32 
LabelKey()33   LabelKey() {}
34 
35   /**
36    * Creates a {@link LabelKey}.
37    *
38    * @param key the key of a {@code Label}.
39    * @param description a human-readable description of what this label key represents.
40    * @return a {@code LabelKey}.
41    * @since 0.17
42    */
create(String key, String description)43   public static LabelKey create(String key, String description) {
44     return new AutoValue_LabelKey(key, description);
45   }
46 
47   /**
48    * Returns the key of this {@link LabelKey}.
49    *
50    * @return the key.
51    * @since 0.17
52    */
getKey()53   public abstract String getKey();
54 
55   /**
56    * Returns the description of this {@link LabelKey}.
57    *
58    * @return the description.
59    * @since 0.17
60    */
getDescription()61   public abstract String getDescription();
62 }
63