|
@@ -44,6 +44,24 @@ public class SpanTagsProcess implements AggregateFunction<PojoSpan, SpanTagsMetr
|
|
if (code >= 400) {
|
|
if (code >= 400) {
|
|
accumulator.setHttpErrorCount(1 + accumulator.getHttpErrorCount());
|
|
accumulator.setHttpErrorCount(1 + accumulator.getHttpErrorCount());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ switch (value.SpanKind) {
|
|
|
|
+ case 1:
|
|
|
|
+ accumulator.setSpanKindInternalCount(1 + accumulator.getSpanKindInternalCount());
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ accumulator.setSpanKindServerCount(1 + accumulator.getSpanKindServerCount());
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ accumulator.setSpanKindClientCount(1 + accumulator.getSpanKindClientCount());
|
|
|
|
+ break;
|
|
|
|
+ case 4:
|
|
|
|
+ accumulator.setSpanKindProducerCount(1 + accumulator.getSpanKindProducerCount());
|
|
|
|
+ break;
|
|
|
|
+ case 5:
|
|
|
|
+ accumulator.setSpanKindConsumerCount(1 + accumulator.getSpanKindConsumerCount());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
return accumulator;
|
|
return accumulator;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -70,7 +88,10 @@ public class SpanTagsProcess implements AggregateFunction<PojoSpan, SpanTagsMetr
|
|
String tableSuffix = StringUtils.getDurationString(windowDuration);
|
|
String tableSuffix = StringUtils.getDurationString(windowDuration);
|
|
String endpointSql = String.format("insert into span_metrics_%s " +
|
|
String endpointSql = String.format("insert into span_metrics_%s " +
|
|
"(timestamp, app_name, service_name, span_count, http_count, http_error_count,\n" +
|
|
"(timestamp, app_name, service_name, span_count, http_count, http_error_count,\n" +
|
|
- "rpc_count, database_count) values (?,?,?,?,?,?,?,?)", tableSuffix);
|
|
|
|
|
|
+ "rpc_count, database_count, span_kind_internal, span_kind_server, " +
|
|
|
|
+ "span_kind_client, span_kind_producer, span_kind_consumer) values " +
|
|
|
|
+ "(?,?,?,?,?,?,?,?, ?, ?, ?, ?, ?)",
|
|
|
|
+ tableSuffix);
|
|
base
|
|
base
|
|
.keyBy(PojoSpan::getServiceName)
|
|
.keyBy(PojoSpan::getServiceName)
|
|
.window(TumblingEventTimeWindows.of(windowDuration))
|
|
.window(TumblingEventTimeWindows.of(windowDuration))
|
|
@@ -88,6 +109,11 @@ public class SpanTagsProcess implements AggregateFunction<PojoSpan, SpanTagsMetr
|
|
ps.setLong(6, meta.getHttpErrorCount());
|
|
ps.setLong(6, meta.getHttpErrorCount());
|
|
ps.setLong(7, meta.getRpcCount());
|
|
ps.setLong(7, meta.getRpcCount());
|
|
ps.setLong(8, meta.getDatabaseCount());
|
|
ps.setLong(8, meta.getDatabaseCount());
|
|
|
|
+ ps.setLong(9, meta.getSpanKindInternalCount());
|
|
|
|
+ ps.setLong(10, meta.getSpanKindServerCount());
|
|
|
|
+ ps.setLong(11, meta.getSpanKindClientCount());
|
|
|
|
+ ps.setLong(12, meta.getSpanKindProducerCount());
|
|
|
|
+ ps.setLong(13, meta.getSpanKindConsumerCount());
|
|
},
|
|
},
|
|
jdbcConnectionOptions
|
|
jdbcConnectionOptions
|
|
));
|
|
));
|