• 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.Nullable;
22 import javax.annotation.concurrent.Immutable;
23 
24 /**
25  * The value of a {@code Label} associated with a {@code TimeSeries}.
26  *
27  * @since 0.15
28  */
29 @ExperimentalApi
30 @Immutable
31 @AutoValue
32 public abstract class LabelValue {
33 
LabelValue()34   LabelValue() {}
35 
36   /**
37    * Creates a {@link LabelValue}.
38    *
39    * @param value the value of a {@code Label}. {@code null} value indicates an unset {@code
40    *     LabelValue}.
41    * @return a {@code LabelValue}.
42    * @since 0.17
43    */
create(@ullable String value)44   public static LabelValue create(@Nullable String value) {
45     return new AutoValue_LabelValue(value);
46   }
47 
48   /**
49    * Returns the value of this {@link LabelValue}. Returns {@code null} if the value is unset and
50    * supposed to be ignored.
51    *
52    * @return the value.
53    * @since 0.17
54    */
55   @Nullable
getValue()56   public abstract String getValue();
57 }
58