1
1
package datadog .trace .common .metrics ;
2
2
3
+ import static java .nio .charset .StandardCharsets .ISO_8859_1 ;
4
+
3
5
import datadog .communication .serialization .GrowableBuffer ;
4
6
import datadog .communication .serialization .WritableFormatter ;
5
7
import datadog .communication .serialization .msgpack .MsgPackWriter ;
6
8
import datadog .trace .api .ProcessTags ;
7
9
import datadog .trace .api .WellKnownTags ;
8
10
import datadog .trace .bootstrap .instrumentation .api .UTF8BytesString ;
9
-
10
11
import java .util .List ;
11
12
12
- import static java .nio .charset .StandardCharsets .ISO_8859_1 ;
13
-
14
13
public final class SerializingMetricWriter implements MetricWriter {
15
14
16
15
private static final byte [] SEQUENCE = "Seq" .getBytes (ISO_8859_1 );
@@ -36,9 +35,12 @@ public final class SerializingMetricWriter implements MetricWriter {
36
35
private static final byte [] IS_TRACE_ROOT = "IsTraceRoot" .getBytes (ISO_8859_1 );
37
36
private static final byte [] SPAN_KIND = "SpanKind" .getBytes (ISO_8859_1 );
38
37
private static final byte [] PEER_TAGS = "PeerTags" .getBytes (ISO_8859_1 );
39
- // Is trace root is a tristate (0 unknown, 1 true, 2 false)
40
- public static final int IS_TRACE_ROOT_TRUE = 1 ;
41
- public static final int IS_TRACE_ROOT_FALSE = 2 ;
38
+
39
+ @ SuppressWarnings ("unused" ) // Kept for representing all possible states
40
+ public static final int TRISTATE_UNKNOWN = 0 ;
41
+
42
+ public static final int TRISTATE_TRUE = 1 ;
43
+ public static final int TRISTATE_FALSE = 2 ;
42
44
43
45
private final WellKnownTags wellKnownTags ;
44
46
private final WritableFormatter writer ;
@@ -122,7 +124,7 @@ public void add(MetricKey key, AggregateMetric aggregate) {
122
124
writer .writeBoolean (key .isSynthetics ());
123
125
124
126
writer .writeUTF8 (IS_TRACE_ROOT );
125
- writer .writeInt (key .isTraceRoot () ? IS_TRACE_ROOT_TRUE : IS_TRACE_ROOT_FALSE );
127
+ writer .writeInt (key .isTraceRoot () ? TRISTATE_TRUE : TRISTATE_FALSE );
126
128
127
129
writer .writeUTF8 (SPAN_KIND );
128
130
writer .writeUTF8 (key .getSpanKind ());
0 commit comments