diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index c2ebaf95551e..1a508e2ef4c6 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -7,6 +7,7 @@ * Fix wrong layer of metric `user error` in DynamoDB monitoring. * Support to bind TLS status as a part of component for service topology. +* Fix component ID priority bug. #### Documentation diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceCallRelationDispatcher.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceCallRelationDispatcher.java index 83f46da5f49a..e2aa91f5dbea 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceCallRelationDispatcher.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceCallRelationDispatcher.java @@ -72,7 +72,7 @@ private Optional tlsStatus(String tlsMode) { // component ID, mtls = 142 return Optional.of(142); case Const.TLS_MODE.TLS: - // component ID, mtls = 130 + // component ID, tls = 130 return Optional.of(130); case Const.TLS_MODE.NON_TLS: default: diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogService.java index c10e77c05898..7a17b950158b 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogService.java @@ -128,6 +128,6 @@ private void init() throws InitialComponentCatalogException { public boolean compare(int componentA, int componentB) { final Integer priorityA = componentIDPriorities.getOrDefault(componentA, 50); final Integer priorityB = componentIDPriorities.getOrDefault(componentB, 50); - return priorityA.compareTo(priorityB) > 0; + return priorityA.compareTo(priorityB) < 0; } } diff --git a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogFileTest.java b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogFileTest.java index 6181490fc633..704582d9df82 100644 --- a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogFileTest.java +++ b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/config/ComponentLibraryCatalogFileTest.java @@ -37,12 +37,12 @@ public void testInitAndSettings() { @Test public void testPriority() { ComponentLibraryCatalogService service = new ComponentLibraryCatalogService(); - Assertions.assertEquals(false, service.compare(service.getComponentId("Unknown"), service.getComponentId("tcp"))); - Assertions.assertEquals(false, service.compare(service.getComponentId("tcp"), service.getComponentId("tls"))); - Assertions.assertEquals(false, service.compare(service.getComponentId("tls"), service.getComponentId("rpc"))); - Assertions.assertEquals(false, service.compare(service.getComponentId("rpc"), service.getComponentId("http"))); - Assertions.assertEquals(false, service.compare(service.getComponentId("http"), service.getComponentId("https"))); - Assertions.assertEquals(false, service.compare(service.getComponentId("https"), service.getComponentId("SpringMVC"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("Unknown"), service.getComponentId("tcp"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("tcp"), service.getComponentId("tls"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("tls"), service.getComponentId("rpc"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("rpc"), service.getComponentId("http"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("http"), service.getComponentId("https"))); + Assertions.assertEquals(true, service.compare(service.getComponentId("https"), service.getComponentId("SpringMVC"))); // Equal priority Assertions.assertEquals(false, service.compare(service.getComponentId("Dubbo"), service.getComponentId("SpringMVC")));