Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #568 from wrijeff/v1x_temp
Browse files Browse the repository at this point in the history
MAINT: restore traceGroup backward compatibility (#564)
  • Loading branch information
wrijeff authored May 5, 2021
2 parents ed1b8c1 + 1bb550d commit d3d6a72
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"type": "keyword"
},
"traceGroup": {
"ignore_above": 1024,
"type": "keyword"
},
"traceGroupFields": {
"properties": {
"name": {
"ignore_above": 1024,
"type": "keyword"
},
"endTime": {
"type": "date_nanos"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public Map<String, Object> getAttributes() {
return attributes;
}

@JsonUnwrapped(prefix="traceGroup.")
@JsonUnwrapped
public TraceGroup getTraceGroup() {
return traceGroup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
import java.util.Objects;

public class TraceGroup {
@JsonProperty("traceGroup")
private final String name;
@JsonProperty("traceGroupFields.endTime")
private final String endTime;
@JsonProperty("traceGroupFields.statusCode")
private final Integer statusCode;
@JsonProperty("traceGroupFields.durationInNanos")
private final Long durationInNanos;

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ private int getMissingTraceGroupFieldsSpanCount(List<Record<String>> records) th
for (Record<String> record: records) {
final String spanJson = record.getData();
Map<String, Object> spanMap = OBJECT_MAPPER.readValue(spanJson, new TypeReference<Map<String, Object>>() {});
final String traceGroupName = (String) spanMap.get("traceGroup.name");
final String traceGroupEndTime = (String) spanMap.get("traceGroup.endTime");
final Number traceGroupDurationInNanos = (Number) spanMap.get("traceGroup.durationInNanos");
final Number traceGroupStatusCode = (Number) spanMap.get("traceGroup.statusCode");
final String traceGroupName = (String) spanMap.get("traceGroup");
final String traceGroupEndTime = (String) spanMap.get("traceGroupFields.endTime");
final Number traceGroupDurationInNanos = (Number) spanMap.get("traceGroupFields.durationInNanos");
final Number traceGroupStatusCode = (Number) spanMap.get("traceGroupFields.statusCode");
if (Stream.of(traceGroupName, traceGroupEndTime, traceGroupDurationInNanos, traceGroupStatusCode).allMatch(Objects::isNull)) {
count += 1;
}
Expand Down

0 comments on commit d3d6a72

Please sign in to comment.