You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/02/27 02:19:23 UTC

[skywalking] branch ref-register created (now 56ae26a)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a change to branch ref-register
in repository https://gitbox.apache.org/repos/asf/skywalking.git.


      at 56ae26a  Support ref endpoint name register

This branch includes the following new commits:

     new 56ae26a  Support ref endpoint name register

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking] 01/01: Support ref endpoint name register

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch ref-register
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 56ae26a0b1fe32c8dfe8ec5c8ea716bb1a7c891b
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Feb 27 10:18:57 2020 +0800

    Support ref endpoint name register
---
 .../service/EndpointInventoryRegister.java         |  4 ++--
 .../service/IEndpointInventoryRegister.java        |  2 +-
 .../standardization/ReferenceIdExchanger.java      | 24 +++++++---------------
 3 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
index 5452818..330ee65 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java
@@ -69,8 +69,8 @@ public class EndpointInventoryRegister implements IEndpointInventoryRegister {
     }
 
     @Override
-    public int get(int serviceId, String endpointName, int detectPoint) {
-        return getCacheService().getEndpointId(serviceId, endpointName, detectPoint);
+    public int get(int serviceId, String endpointName, DetectPoint detectPoint) {
+        return getCacheService().getEndpointId(serviceId, endpointName, detectPoint.ordinal());
     }
 
     @Override
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java
index c29ef6f..581f8d0 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java
@@ -25,7 +25,7 @@ public interface IEndpointInventoryRegister extends Service {
 
     int getOrCreate(int serviceId, String endpointName, DetectPoint detectPoint);
 
-    int get(int serviceId, String endpointName, int detectPoint);
+    int get(int serviceId, String endpointName, DetectPoint detectPoint);
 
     void heartbeat(int endpointId, long heartBeatTime);
 }
diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java
index 911c922..5203b86 100644
--- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java
+++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java
@@ -139,29 +139,19 @@ public class ReferenceIdExchanger implements IdExchanger<ReferenceDecorator> {
                 standardBuilder.setNetworkAddressId(networkAddressId);
                 standardBuilder.setNetworkAddress(Const.EMPTY_STRING);
             }
-        } else {
-            /**
-             * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span.
-             */
         }
         return exchanged;
     }
 
     /**
-     * Endpoint in ref could be local or exit span's operation name. Especially if it is local span operation name,
-     * exchange may not happen at agent, such as Java agent, then put literal endpoint string in the header, Need to try
-     * to get the id by assuming the endpoint name is detected at server, local or client.
-     * <p>
-     * If agent does the exchange, then always use endpoint id.
+     * @since 6.6.0 The endpoint in the ref should be server endpoint only. The agent will/should use `-1`, when it can't
+     * find the endpoint of entry span in the current tracing context when build the ref.
+     * @since 5.0 Endpoint in ref could be local or exit span's operation name. Especially if it is local span operation
+     * name, * exchange may not happen at agent, such as Java agent, then put literal endpoint string in the header,
+     * Need to try * to get the id by assuming the endpoint name is detected at server, local or client. * <p> * If
+     * agent does the exchange, then always use endpoint id.
      */
     private int getEndpointId(int serviceId, String endpointName) {
-        int endpointId = endpointInventoryRegister.get(serviceId, endpointName, DetectPoint.SERVER.ordinal());
-        if (endpointId == Const.NONE) {
-            endpointId = endpointInventoryRegister.get(serviceId, endpointName, DetectPoint.CLIENT.ordinal());
-            if (endpointId == Const.NONE) {
-                endpointId = endpointInventoryRegister.get(serviceId, endpointName, DetectPoint.UNRECOGNIZED.ordinal());
-            }
-        }
-        return endpointId;
+        return endpointInventoryRegister.getOrCreate(serviceId, endpointName, DetectPoint.SERVER);
     }
 }