-
Notifications
You must be signed in to change notification settings - Fork 871
/
SemconvStability.java
54 lines (43 loc) · 1.3 KB
/
SemconvStability.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.api.internal;
import static java.util.Arrays.asList;
import java.util.HashSet;
import java.util.Set;
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public final class SemconvStability {
private static final boolean emitOldHttpSemconv;
private static final boolean emitStableHttpSemconv;
static {
boolean old = true;
boolean stable = false;
String value = ConfigPropertiesUtil.getString("otel.semconv-stability.opt-in");
if (value != null) {
Set<String> values = new HashSet<>(asList(value.split(",")));
if (values.contains("http")) {
old = false;
stable = true;
}
// no else -- technically it's possible to set "http,http/dup", in which case we should emit
// both sets of attributes
if (values.contains("http/dup")) {
old = true;
stable = true;
}
}
emitOldHttpSemconv = old;
emitStableHttpSemconv = stable;
}
public static boolean emitOldHttpSemconv() {
return emitOldHttpSemconv;
}
public static boolean emitStableHttpSemconv() {
return emitStableHttpSemconv;
}
private SemconvStability() {}
}