diff --git a/CHANGES.md b/CHANGES.md index bef8de241..319019009 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Release Notes. 8.12.0 ------------------ * Fix `Shenyu plugin`'s NPE in reading read trace ID when IgnoredTracerContext is used in the context. +* Fix `onHalfClose` using span operation name `/Request/onComplete` but not `/Request/onHalfClose` #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/Constants.java b/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/Constants.java index a5e8dfac8..a037c0639 100644 --- a/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/Constants.java +++ b/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/Constants.java @@ -40,6 +40,13 @@ public class Constants { */ public static final String REQUEST_ON_MESSAGE_OPERATION_NAME = "/Request/onMessage"; + /** + * Operation name for request completed all message sending. + *

+ * However, the call may still be cancelled. + */ + public static final String REQUEST_ON_HALF_CLOSE_OPERATION_NAME = "/Request/onHalfClose"; + /** * Operation name for client has completed request sending, there are no more incoming request. *

diff --git a/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/server/TracingServerCallListener.java b/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/server/TracingServerCallListener.java index 6e150b19c..3b0c830a9 100644 --- a/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/server/TracingServerCallListener.java +++ b/apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/server/TracingServerCallListener.java @@ -28,7 +28,7 @@ import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; import static org.apache.skywalking.apm.plugin.grpc.v1.Constants.REQUEST_ON_CANCEL_OPERATION_NAME; -import static org.apache.skywalking.apm.plugin.grpc.v1.Constants.REQUEST_ON_COMPLETE_OPERATION_NAME; +import static org.apache.skywalking.apm.plugin.grpc.v1.Constants.REQUEST_ON_HALF_CLOSE_OPERATION_NAME; import static org.apache.skywalking.apm.plugin.grpc.v1.Constants.REQUEST_ON_MESSAGE_OPERATION_NAME; import static org.apache.skywalking.apm.plugin.grpc.v1.Constants.SERVER; import org.apache.skywalking.apm.plugin.grpc.v1.OperationNameFormatUtil; @@ -93,7 +93,7 @@ public class TracingServerCallListener extends ForwardingServerCallList @Override public void onHalfClose() { - final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_COMPLETE_OPERATION_NAME); + final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_HALF_CLOSE_OPERATION_NAME); span.setComponent(ComponentsDefine.GRPC); span.setLayer(SpanLayer.RPC_FRAMEWORK); ContextManager.continued(contextSnapshot); diff --git a/test/plugin/scenarios/correlation-autotag-scenario/config/expectedData.yaml b/test/plugin/scenarios/correlation-autotag-scenario/config/expectedData.yaml index 64b1f7e0b..219bff5c1 100644 --- a/test/plugin/scenarios/correlation-autotag-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/correlation-autotag-scenario/config/expectedData.yaml @@ -211,7 +211,7 @@ segmentItems: skipAnalysis: false tags: - {key: rpc.status_code, value: OK} - - operationName: Greeter.sayHello/server/Request/onComplete + - operationName: Greeter.sayHello/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework diff --git a/test/plugin/scenarios/grpc-generic-call-scenario/config/expectedData.yaml b/test/plugin/scenarios/grpc-generic-call-scenario/config/expectedData.yaml index 0d214640a..5e2d11774 100644 --- a/test/plugin/scenarios/grpc-generic-call-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/grpc-generic-call-scenario/config/expectedData.yaml @@ -32,7 +32,7 @@ segmentItems: skipAnalysis: false tags: - {key: rpc.status_code, value: OK} - - operationName: org.apache.skywalking.apm.testcase.grpc.proto.TestServiceDynamic.unary/server/Request/onComplete + - operationName: org.apache.skywalking.apm.testcase.grpc.proto.TestServiceDynamic.unary/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework diff --git a/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml b/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml index a7786d6e2..ced663423 100644 --- a/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml @@ -162,7 +162,7 @@ segmentItems: tags: - {key: rpc.status_code, value: OK} skipAnalysis: 'false' - - operationName: GreeterBlocking.sayHello/server/Request/onComplete + - operationName: GreeterBlocking.sayHello/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework @@ -220,7 +220,7 @@ segmentItems: tags: - {key: rpc.status_code, value: OK} skipAnalysis: 'false' - - operationName: Greeter.sayHello/server/Request/onComplete + - operationName: Greeter.sayHello/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework @@ -307,7 +307,7 @@ segmentItems: - {key: message, value: ''} - {key: stack, value: not null} skipAnalysis: 'false' - - operationName: GreeterBlockingError.sayHello/server/Request/onComplete + - operationName: GreeterBlockingError.sayHello/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework diff --git a/test/plugin/scenarios/shenyu-2.4.x-grpc-scenario/config/expectedData.yaml b/test/plugin/scenarios/shenyu-2.4.x-grpc-scenario/config/expectedData.yaml index 675ec1a21..bce4b38b9 100644 --- a/test/plugin/scenarios/shenyu-2.4.x-grpc-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/shenyu-2.4.x-grpc-scenario/config/expectedData.yaml @@ -126,7 +126,7 @@ segmentItems: skipAnalysis: false tags: - { key: rpc.status_code, value: OK } - - operationName: echo.EchoServiceJSON.echo/server/Request/onComplete + - operationName: echo.EchoServiceJSON.echo/server/Request/onHalfClose parentSpanId: -1 spanId: 0 spanLayer: RPCFramework