Skip to content

Commit

Permalink
[#9905] Fix kafka on call tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehong-kim committed May 2, 2023
1 parent 5169040 commit 6267cb9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
*
* <h3>Library Sandbox (7500 ~ 7999)</h3>
*
* <h3>Cache & File Library (8000 ~ 8899) Fast Histogram</h3>
* <h3>Cache & File Library (8000 ~ 8299) Fast Histogram</h3>
* <table>
* <tr><td>8050</td><td>MEMCACHED</td></tr>
* <tr><td>8051</td><td>MEMCACHED_FUTURE_GET</td></tr>
Expand All @@ -208,12 +208,20 @@
* <tr><td>8251</td><td><i>RESERVED</i></td></tr>
* <tr><td>8260</td><td><i>RESERVED</i></td></tr>
* <tr><td>8280</td><td><i>ETCD</i></td></tr>
* </table>
*
* <h3>Message Broker Library (8300 ~ 8799)</h3>
* <table>
* <tr><td>8300</td><td>RABBITMQ</td></tr>
* <tr><td>8310</td><td><i>ACTIVEMQ_CLIENT</i></td></tr>
* <tr><td>8311</td><td><i>ACTIVEMQ_CLIENT_INTERNAL</i></td></tr>
* <tr><td>8660</td><td><i>KAFKA_CLIENT</i></td></tr>
* <tr><td>8661</td><td><i>KAFKA_CLIENT_INTERNAL</i></td></tr>
* <tr><td>8662</td><td><i>KAFKA_STREAMS</i></td></tr>
* </table>
*
* <h3>HBase Library (8800 ~ 8899)</h3>
* <table>
* <tr><td>8800</td><td>HBASE_CLIENT</td></tr>
* <tr><td>8801</td><td><i>HBASE_CLIENT_ADMIN</i></td></tr>
* <tr><td>8802</td><td><i>HBASE_CLIENT_TABLE</i></td></tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -28,10 +28,13 @@ public enum ServiceTypeCategory {
SERVER((short)1000, (short)1999),
DATABASE((short)2000, (short)2999),
LIBRARY((short)5000, (short)7999),
CACHE_LIBRARY((short)8000, (short)8999, BaseHistogramSchema.FAST_SCHEMA),
CACHE_LIBRARY((short)8000, (short)8299, BaseHistogramSchema.FAST_SCHEMA),
MESSAGE_BROKER((short)8300, (short)8799),
HBASE((short)8800, (short)8899),
CACHE_LIBRARY_SANDBOX((short)8900, (short)8999, BaseHistogramSchema.FAST_SCHEMA),
RPC((short)9000, (short)9999);


private final short minCode;
private final short maxCode;
private final HistogramSchema histogramSchema;
Expand All @@ -41,17 +44,17 @@ public enum ServiceTypeCategory {
ServiceTypeCategory(short minCode, short maxCode) {
this(minCode, maxCode, BaseHistogramSchema.NORMAL_SCHEMA);
}

ServiceTypeCategory(short minCode, short maxCode, HistogramSchema histogramSchema) {
this.minCode = minCode;
this.maxCode = maxCode;
this.histogramSchema = Objects.requireNonNull(histogramSchema, "histogramSchema");
}

public boolean contains(short code) {
return minCode <= code && code <= maxCode;
return minCode <= code && code <= maxCode;
}

public boolean contains(ServiceType type) {
return contains(type.getCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ private CallTreeNode changeNodeToVirtualNode(final CallTree originalCallTree) {
CallTreeNode originalNode = originalCallTree.getRoot();
CallTreeNode newCallTreeNode = new CallTreeNode(this.root, originalNode.getAlign());

CallTreeNode child = originalNode.getChild();
newCallTreeNode.setChild(child);

child.setParent(newCallTreeNode);
if (originalNode.hasChild()) {
CallTreeNode child = originalNode.getChild();
newCallTreeNode.setChild(child);
child.setParent(newCallTreeNode);
}

return newCallTreeNode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ private boolean usedLink(Link link) {
}
int size = nodeList.size();
if (size > 1) {
boolean result = false;
for (Node node : nodeList) {
if (putNodeToLink(link, node, true)) {
return true;
result = true;
}
}
return result;
} else if (size == 1) {
Node node = nodeList.get(0);
if (putNodeToLink(link, node, false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecoder;
import com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecoderV0;
import com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecodingContext;
import com.navercorp.pinpoint.common.trace.ServiceTypeCategory;
import com.navercorp.pinpoint.common.util.CollectionUtils;
import com.navercorp.pinpoint.common.util.LRUCache;
import com.navercorp.pinpoint.io.SpanVersion;
Expand All @@ -53,6 +54,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
* @author emeroad
* @author Taejin Koo
Expand Down Expand Up @@ -208,22 +210,24 @@ private List<SpanBo> bindSpanChunk(ListMultimap<AgentKey, SpanBo> spanMap, List<
AgentKey agentKey = newAgentKey(spanChunkBo);
List<SpanBo> matchedSpanBoList = spanMap.get(agentKey);
if (CollectionUtils.hasLength(matchedSpanBoList)) {
final int spanIdCollisionSize = matchedSpanBoList.size();
if (spanIdCollisionSize > 1) {
// exceptional case dump
logger.warn("spanIdCollision {}", matchedSpanBoList);
}

int agentLevelCollisionCount = 0;
final int spanIdCollisionSize = matchedSpanBoList.size();
boolean ignoreCollision = false;
for (SpanBo spanBo : matchedSpanBoList) {
if (ServiceTypeCategory.MESSAGE_BROKER.contains(spanBo.getServiceType())) {
ignoreCollision = true;
}
if (isChildSpanChunk(spanBo, spanChunkBo)) {
spanBo.addSpanChunkBo(spanChunkBo);
agentLevelCollisionCount++;
}
}
if (agentLevelCollisionCount > 1) {
// exceptional case dump
logger.warn("agentLevelCollision {}", matchedSpanBoList);

if (Boolean.FALSE == ignoreCollision) {
if (agentLevelCollisionCount > 1 || spanIdCollisionSize > 1) {
// exceptional case dump
logger.warn("Collision agentLevel={}, spanId={}, matchedSpanBoList={}", agentLevelCollisionCount, spanIdCollisionSize, matchedSpanBoList);
}
}
} else {
if (logger.isInfoEnabled()) {
Expand Down

0 comments on commit 6267cb9

Please sign in to comment.