Skip to content

Commit

Permalink
Polish mesh data dispatcher: don't generate Instance/Endpoint metrics…
Browse files Browse the repository at this point in the history
… if they are empty. (#12762)
  • Loading branch information
wankai123 authored Nov 12, 2024
1 parent 9e36eac commit 5c5274b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* The index type `BanyanDB.IndexRule.IndexType#TREE` is removed. All indices are using `IndexType#INVERTED` now.
* Add max query size settings to BanyanDB.
* Fix "BanyanDBTraceQueryDAO.queryBasicTraces" doesn't support querying by "trace_id".
* Polish mesh data dispatcher: don't generate Instance/Endpoint metrics if they are empty.

#### UI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,21 @@ private static void dispatchTCPMetrics(TCPServiceMeshMetric.Builder metrics) {

if (org.apache.skywalking.apm.network.common.v3.DetectPoint.server.equals(metrics.getDetectPoint())) {
toTCPService(metrics, minuteTimeBucket);
toTCPServiceInstance(metrics, minuteTimeBucket);
toTCPServiceInstanceTraffic(metrics, minuteTimeBucket);
// Don't generate instance metrics, if no dest instance.
if (StringUtil.isNotEmpty(metrics.getDestServiceInstance())) {
toTCPServiceInstance(metrics, minuteTimeBucket);
toTCPServiceInstanceTraffic(metrics, minuteTimeBucket);
}
}

String sourceService = metrics.getSourceServiceName();
// Don't generate relation, if no source.
if (StringUtil.isNotEmpty(sourceService)) {
toTCPServiceRelation(metrics, minuteTimeBucket);
toTCPServiceInstanceRelation(metrics, minuteTimeBucket);
// Don't generate instance relation, if no source instance.
if (StringUtil.isNotEmpty(metrics.getSourceServiceInstance())) {
toTCPServiceInstanceRelation(metrics, minuteTimeBucket);
}
}
}

Expand All @@ -184,16 +190,25 @@ static void dispatchHTTPMetrics(HTTPServiceMeshMetric.Builder metrics) {

if (org.apache.skywalking.apm.network.common.v3.DetectPoint.server.equals(metrics.getDetectPoint())) {
toService(metrics, minuteTimeBucket);
toServiceInstance(metrics, minuteTimeBucket);
toServiceInstanceTraffic(metrics, minuteTimeBucket);
toEndpoint(metrics, minuteTimeBucket);
// Don't generate instance metrics, if no dest instance.
if (StringUtil.isNotEmpty(metrics.getDestServiceInstance())) {
toServiceInstance(metrics, minuteTimeBucket);
toServiceInstanceTraffic(metrics, minuteTimeBucket);
}
// Don't generate endpoint metrics, if no endpoint.
if (StringUtil.isNotEmpty(metrics.getEndpoint())) {
toEndpoint(metrics, minuteTimeBucket);
}
}

String sourceService = metrics.getSourceServiceName();
// Don't generate relation, if no source.
if (StringUtil.isNotEmpty(sourceService)) {
toServiceRelation(metrics, minuteTimeBucket);
toServiceInstanceRelation(metrics, minuteTimeBucket);
// Don't generate instance relation, if no source instance.
if (StringUtil.isNotEmpty(metrics.getSourceServiceInstance())) {
toServiceInstanceRelation(metrics, minuteTimeBucket);
}
}
}

Expand Down

0 comments on commit 5c5274b

Please sign in to comment.