Skip to content

Commit

Permalink
Encode enums as numbers in logging OTLP exporters (#4783)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Oct 17, 2022
1 parent 250a2f0 commit 5be58c5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Expand Up @@ -43,7 +43,7 @@ public void writeBool(ProtoFieldInfo field, boolean value) throws IOException {

@Override
protected void writeEnum(ProtoFieldInfo field, ProtoEnumInfo enumValue) throws IOException {
generator.writeStringField(field.getJsonName(), enumValue.getJsonName());
generator.writeNumberField(field.getJsonName(), enumValue.getEnumNumber());
}

@Override
Expand Down
Expand Up @@ -110,7 +110,7 @@ void log() throws Exception {
+ " },"
+ " \"logRecords\": [{"
+ " \"timeUnixNano\":\"1631533710000000\","
+ " \"severityNumber\":\"SEVERITY_NUMBER_INFO\","
+ " \"severityNumber\":9,"
+ " \"severityText\":\"INFO\","
+ " \"body\": {"
+ " \"stringValue\":\"body2\""
Expand All @@ -137,7 +137,7 @@ void log() throws Exception {
+ " },"
+ " \"logRecords\": [{"
+ " \"timeUnixNano\":\"1631533710000000\","
+ " \"severityNumber\":\"SEVERITY_NUMBER_INFO\","
+ " \"severityNumber\":9,"
+ " \"severityText\":\"INFO\","
+ " \"body\": {"
+ " \"stringValue\":\"body1\""
Expand Down
Expand Up @@ -122,7 +122,7 @@ void log() throws Exception {
+ " \"timeUnixNano\": \"2\","
+ " \"asDouble\": 4.0"
+ " }],"
+ " \"aggregationTemporality\": \"AGGREGATION_TEMPORALITY_CUMULATIVE\","
+ " \"aggregationTemporality\": 2,"
+ " \"isMonotonic\": true"
+ " }"
+ " }]"
Expand Down Expand Up @@ -151,7 +151,7 @@ void log() throws Exception {
+ " \"timeUnixNano\": \"2\","
+ " \"asDouble\": 4.0"
+ " }],"
+ " \"aggregationTemporality\": \"AGGREGATION_TEMPORALITY_CUMULATIVE\","
+ " \"aggregationTemporality\": 2,"
+ " \"isMonotonic\": true"
+ " }"
+ " }]"
Expand Down
Expand Up @@ -126,11 +126,11 @@ void log() throws Exception {
+ " \"traceId\": \"12340000000043211234000000004321\","
+ " \"spanId\": \"8765000000005678\","
+ " \"name\": \"testSpan2\","
+ " \"kind\": \"SPAN_KIND_CLIENT\","
+ " \"kind\": 3,"
+ " \"startTimeUnixNano\": \"500\","
+ " \"endTimeUnixNano\": \"1501\","
+ " \"status\": {"
+ " \"code\": \"STATUS_CODE_ERROR\""
+ " \"code\": 2"
+ " }"
+ " }]"
+ " }, {"
Expand All @@ -148,7 +148,7 @@ void log() throws Exception {
+ " \"traceId\": \"12345678876543211234567887654321\","
+ " \"spanId\": \"8765432112345678\","
+ " \"name\": \"testSpan1\","
+ " \"kind\": \"SPAN_KIND_INTERNAL\","
+ " \"kind\": 1,"
+ " \"startTimeUnixNano\": \"100\","
+ " \"endTimeUnixNano\": \"1100\","
+ " \"attributes\": [{"
Expand All @@ -173,7 +173,7 @@ void log() throws Exception {
+ " }]"
+ " }],"
+ " \"status\": {"
+ " \"code\": \"STATUS_CODE_OK\""
+ " \"code\": 1"
+ " }"
+ " }]"
+ " }]"
Expand Down

0 comments on commit 5be58c5

Please sign in to comment.