-
Notifications
You must be signed in to change notification settings - Fork 1.2k
merge v5.13.5 release #1499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge v5.13.5 release #1499
Conversation
…type issue (#1481) Co-authored-by: liujianjun.ljj <[email protected]>
Co-authored-by: liujianjun.ljj <[email protected]>
Co-authored-by: liujianjun.ljj <[email protected]>
…1482) (cherry picked from commit d20062f) Co-authored-by: 辰霖 <[email protected]>
…oo many ping problem (#1483) Co-authored-by: liujianjun.ljj <[email protected]>
…s scene (#1484) Co-authored-by: liujianjun.ljj <[email protected]>
Co-authored-by: liujianjun.ljj <[email protected]>
Co-authored-by: liujianjun.ljj <[email protected]>
* support stream event log * support stream event log * support stream event log * support stream event log --------- Co-authored-by: liujianjun.ljj <[email protected]>
Co-authored-by: liujianjun.ljj <[email protected]>
…elease_merge # Conflicts: # all/pom.xml # bom/pom.xml # core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java # core/api/src/main/java/com/alipay/sofa/rpc/common/Version.java # pom.xml # remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java # remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java # remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/server/triple/TripleServer.java
WalkthroughThis update introduces enhanced tracing and event logging for streaming RPCs. It adds new event constants, span event encoders, and event reporters to the tracing subsystem, expands client and server interceptors for detailed span event creation, and updates test configurations. The service registration logic is simplified, and dependency versions are updated. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ClientInterceptor
participant Tracer
participant ServerInterceptor
participant Server
Client->>ClientInterceptor: sendMessage(request)
ClientInterceptor->>Tracer: record CLIENT_SEND_EVENT (size, seqId, etc.)
ClientInterceptor->>Server: send(request)
Server->>ServerInterceptor: onMessage(request)
ServerInterceptor->>Tracer: record SERVER_RECEIVE_EVENT (size, seqId, etc.)
ServerInterceptor->>Server: process(request)
Server->>ServerInterceptor: sendMessage(response)
ServerInterceptor->>Tracer: record SERVER_SEND_EVENT (size, seqId, etc.)
ServerInterceptor->>Client: send(response)
Client->>ClientInterceptor: onMessage(response)
ClientInterceptor->>Tracer: record CLIENT_RECEIVE_EVENT (size, seqId, etc.)
Estimated code review effort4 (~90 minutes) Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java (1)
74-80
: Configuration improvements with excessive timeout concern.The explicit
ApplicationConfig
andappName
query parameter are good additions that support the enhanced tracing features. However, the timeout of 1,000,000ms (~16.7 minutes) seems excessive for integration tests.Consider reducing the timeout to a more reasonable value (e.g., 30000ms) unless this extreme timeout is specifically needed for the streaming scenarios being tested.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java (1)
243-243
: Consider adding message size validation.While the size calculation is correct, consider adding validation for extremely large messages that might indicate serialization issues or potential DoS attacks.
You could add a check for message size limits to prevent potential issues:
if (message instanceof GeneratedMessageV3) { messageSize = ((GeneratedMessageV3) message).getSerializedSize(); + // Consider adding size validation + if (messageSize > MAX_MESSAGE_SIZE_THRESHOLD) { + LOGGER.warn("Large message size detected: {} bytes", messageSize); + } Object reqSize = internalContext.getAttachment(RpcConstants.INTERNAL_KEY_REQ_SIZE);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
all/pom.xml
(1 hunks)bom/pom.xml
(1 hunks)core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
(1 hunks)core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java
(2 hunks)core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInvokeContext.java
(1 hunks)remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java
(7 hunks)remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java
(3 hunks)remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/server/triple/TripleServer.java
(3 hunks)remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java
(1 hunks)test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java
(2 hunks)test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java
(3 hunks)test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/ark/MultiClassLoaderTest.java
(1 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/RpcSofaTracer.java
(5 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java
(3 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java
(1 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java
(1 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java
(1 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcEventTags.java
(1 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/TracerRecord.java
(2 hunks)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/type/RpcTracerLogEnum.java
(1 hunks)
🧠 Learnings (14)
📓 Common learnings
Learnt from: EvenLjj
PR: sofastack/sofa-rpc#1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
Learnt from: EvenLjj
PR: sofastack/sofa-rpc#1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/type/RpcTracerLogEnum.java (1)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/server/triple/TripleServer.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java (3)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/RpcSofaTracer.java (2)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java (3)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
🧬 Code Graph Analysis (6)
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (1)
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (1)
RpcConstants
(28-747)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java (1)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (1)
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (1)
RpcConstants
(28-747)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java (1)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java (1)
core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java (1)
RpcConfigKeys
(28-155)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java (2)
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java (1)
CommonUtils
(30-278)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: EvenLjj
PR: sofastack/sofa-rpc#1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
Learnt from: EvenLjj
PR: sofastack/sofa-rpc#1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/type/RpcTracerLogEnum.java (1)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java (1)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/server/triple/TripleServer.java (2)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java (3)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/RpcSofaTracer.java (2)
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java (3)
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java:290-303
Timestamp: 2025-05-08T06:34:38.670Z
Learning: In SOFA-RPC's Triple protocol adapter, the server detects invocation type (streaming/sync) from gRPC method descriptors but intentionally doesn't propagate this to request properties or headers. This is by design to maintain compatibility with clients of different versions, as the server should rely on client-provided values rather than overriding them.
Learnt from: EvenLjj
PR: #1488
File: remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java:105-120
Timestamp: 2025-05-08T06:59:23.963Z
Learning: In SOFA RPC, TripleTracerAdapter.serverReceived() sets the invocation type on the SofaRequest based on the gRPC method type (CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING), but the SofaRequest.isAsync() method does not directly recognize these streaming types as asynchronous. According to EvenLjj, some modification in TripleTracerAdapter.serverReceived makes sofaRequest.isAsync() return true for streaming requests.
Learnt from: EvenLjj
PR: #1488
File: tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java:34-36
Timestamp: 2025-05-08T06:50:45.709Z
Learning: In the SOFA RPC tracer framework, JsonStringBuilder instances in SpanEncoder implementations are provided by the tracer core, which is responsible for solving thread safety/concurrency issues rather than individual encoder implementations.
🧬 Code Graph Analysis (6)
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (1)
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (1)
RpcConstants
(28-747)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java (1)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (1)
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (1)
RpcConstants
(28-747)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java (1)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java (1)
core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java (1)
RpcConfigKeys
(28-155)
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java (2)
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java (1)
CommonUtils
(30-278)tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcSpanTags.java (1)
RpcSpanTags
(24-192)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: sca
🔇 Additional comments (32)
test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/ark/MultiClassLoaderTest.java (1)
155-155
: LGTM! Correct bug fix.The change correctly aligns the export call with the newly created
providerConfig3
instance, fixing the inconsistency whereproviderConfig2.export()
was being called instead.all/pom.xml (1)
65-65
: Confirm tracer version 3.1.10 presence and security status.The
sofa-tracer-core
version bump to 3.1.10 inall/pom.xml
(line 65) is valid on Maven Central, but the OSS Index API returned no structured output when checking for vulnerabilities. Please manually verify thatcom.alipay:sofa-tracer-core:3.1.10
has no known security issues (e.g., via OSS Index, NVD, Snyk) before merging.
- File: all/pom.xml, line 65
bom/pom.xml (1)
58-58
: LGTM! Consistent version update.The tracer version update is consistent with the corresponding change in
all/pom.xml
, ensuring unified dependency management across the project.tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/TracerRecord.java (1)
21-21
: LGTM! Well-documented streaming metric addition.The new
R0
constant for streaming first response latency is properly documented and aligns with the enhanced tracing capabilities for streaming RPCs introduced in this release.Also applies to: 37-37
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/type/RpcTracerLogEnum.java (1)
31-32
: LGTM! Consistent event logging infrastructure extension.The new
RPC_CLIENT_EVENT
andRPC_SERVER_EVENT
constants properly extend the logging infrastructure to support event-based tracing, following the established naming and parameter conventions.core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInvokeContext.java (1)
108-112
: LGTM! Efficient context management with conditional setting.The implementation correctly uses identity comparison to avoid unnecessary ThreadLocal operations when the current context is already the target context. This optimization supports the enhanced tracing lifecycle management efficiently.
Note: The method name
resetContext
might be slightly misleading since it doesn't always reset - considersetContextIfDifferent
for clarity, though the current name aligns with the intended use case.test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (2)
87-92
: Good enhancement: Explicit application configuration and URL parameters.The explicit
ApplicationConfig
setup and addition ofappName=triple-server
query parameter improve test clarity and align with the enhanced tracing capabilities introduced in this PR. This configuration supports proper application identification in RPC tracing scenarios.
125-130
: Good test coverage addition for unary calls.The new
testTripleSayHello
method provides valuable coverage for unary RPC calls, complementing the existing streaming test methods. The test is simple, focused, and follows the established testing patterns.core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java (1)
585-587
: Good addition: Connection timing measurement for enhanced tracing.The timing measurement for
getAvailableClientTransport
provides valuable performance insights as part of the enhanced RPC tracing capabilities. The implementation is efficient with minimal overhead and integrates well with the existing context management system.The captured timing data will be useful for identifying connection bottlenecks in production environments.
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java (1)
65-68
: Good: Explicit application configuration for provider.Adding explicit
ApplicationConfig
with "triple-server" name improves test clarity and aligns with the enhanced tracing capabilities.tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcServerEventJsonEncoder.java (1)
28-39
: LGTM! Clean implementation of server event JSON encoder.The implementation follows the established pattern for RPC event encoders:
- Properly extends
AbstractRpcEventJsonEncoder
- Uses the standard encoding flow: reset buffer, append timestamp, delegate to
appendSlot()
, and finalize- Leverages
RpcSpanTags.TIMESTAMP
constant for consistency- Integrates well with the new event-based tracing infrastructure
Based on the retrieved learnings, thread safety is appropriately handled by the tracer core's
JsonStringBuilder
management.tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/factory/ReporterFactory.java (4)
21-21
: Import addition supports new event reporting functionality.The import of
SpanEventDiskReporter
is appropriately added to support the newbuildEventReport
method.
34-34
: Good practice: Making constant immutable.Converting
REPORT_TYPE
toprivate static final
improves code quality by making the configuration constant immutable and properly scoped.
39-39
: Simplified variable initialization.Removing the explicit
null
initialization is cleaner since Java initializes object references tonull
by default.
53-57
: New factory method for event reporting.The
buildEventReport
method provides a clean factory interface for creatingSpanEventDiskReporter
instances. The method signature and implementation are correct, directly returning the reporter without additional configuration logic.tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/RpcClientEventJsonEncoder.java (1)
28-39
: Well-implemented JSON encoder for client events.The
RpcClientEventJsonEncoder
class correctly extendsAbstractRpcEventJsonEncoder
and implements theencode
method following the established pattern:
- Properly resets the buffer at the start
- Uses
appendBegin
with the correct timestamp field fromRpcSpanTags.TIMESTAMP
- Leverages the inherited
appendSlot
method for common span data- Correctly finalizes with
appendEnd
and returns the JSON stringThe implementation is clean and integrates well with the event reporting framework.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/tags/RpcEventTags.java (1)
23-39
: Well-designed constants class for event tags.The
RpcEventTags
class provides a clean centralized registry of standardized tag keys for RPC event logging. The constants are properly declared aspublic static final
and follow consistent naming conventions:
- Constants use appropriate UPPER_SNAKE_CASE naming
- Values use camelCase consistent with JSON field conventions
- Covers essential event attributes: stream ID, sequence ID, event type, status, size, thread name, and attributes
This design promotes consistency across the event reporting system and makes tag key management maintainable.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (1)
290-303
: Correct implementation of invocation type classification.The addition of method type detection and invocation type setting is well-implemented:
- Properly extracts
MethodType
from the gRPC method descriptor- Uses a comprehensive switch statement covering all streaming types:
CLIENT_STREAMING
→INVOKER_TYPE_CLIENT_STREAMING
SERVER_STREAMING
→INVOKER_TYPE_SERVER_STREAMING
BIDI_STREAMING
→INVOKER_TYPE_BI_STREAMING
- Default case →
INVOKER_TYPE_SYNC
- Sets the invocation type on
SofaRequest
before posting theServerReceiveEvent
This enhancement enables proper classification of streaming vs synchronous calls, supporting the enhanced event-based tracing functionality introduced in this release.
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/log/event/AbstractRpcEventJsonEncoder.java (2)
33-36
: Well-designed abstract encoder base class.The abstract class properly implements the
SpanEncoder<SofaTracerSpan>
interface with a protectedJsonStringBuilder
buffer field that allows subclass access. Based on retrieved learnings, thread safety forJsonStringBuilder
instances is handled by the tracer core, so this approach is appropriate.
37-72
: Comprehensive span data extraction and encoding logic.The
appendSlot
method systematically extracts and encodes span data:Span Context Data (lines 38-47):
- Correctly extracts trace ID and span ID from
SofaTracerSpanContext
- Properly retrieves local and remote application names from span tags
Event Data Processing (lines 49-71):
- Safely checks for null event data before processing
- Handles three tag value types appropriately:
- String tags: Direct key-value appending
- Number tags: Proper null checking and string conversion
- Boolean tags: Direct boolean value handling
- Uses
CommonUtils.isNotEmpty()
for safe map iteration, preventing NPEsThe implementation provides a solid foundation for JSON encoding with proper error handling and type conversions.
core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConstants.java (2)
140-155
: LGTM! Well-structured event constants for streaming RPC tracing.The new streaming event constants follow the established naming conventions and are properly documented. They provide clear semantic meaning for client/server send/receive events.
695-697
: Good addition for tracking streaming response latency.The
INTERNAL_KEY_CLIENT_FIRST_STREAM_RESP_NANO
constant follows the established pattern for internal keys and provides a clear metric for measuring the time to first response in streaming scenarios.tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/RpcSofaTracer.java (3)
100-108
: Excellent addition of event-based reporting alongside digest reporting.The integration of client and server event reporters follows the established pattern and properly extends the SofaTracer builder. This provides enhanced tracing capabilities for streaming RPCs.
160-168
: Clean implementation of event report generation.The
generateEventReport
method follows the same pattern as the existinggenerateReporter
method, maintaining consistency in the codebase. The use ofReporterFactory.buildEventReport
properly delegates to the factory for event-specific reporter creation.
420-427
: Good addition of streaming first response time metric.The R0 timing entry properly captures the first stream response latency and converts it from nanoseconds to microseconds, maintaining consistency with other timing metrics.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/server/triple/TripleServer.java (1)
110-110
: Good refactoring to simplify service registration management.Using interface ID strings as map keys instead of ProviderConfig objects is more efficient and cleaner. The removal of the explicit invoker counter in favor of checking
invokerMap.isEmpty()
simplifies the code while maintaining the same functionality.Also applies to: 269-269, 406-406, 413-413, 423-423
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ClientHeaderClientInterceptor.java (3)
74-82
: Good optimization by pre-caching context objects.Pre-caching the contexts, request, trace context, and span at the beginning of the interceptCall method avoids repeated lookups and improves performance.
110-122
: Well-implemented message size tracking and first response timing.The code correctly:
- Tracks the first response time for streaming metrics
- Safely handles null checks when accumulating message sizes
- Only performs size calculations for protobuf messages
145-161
: Robust context lifecycle management in finally block.The finally block ensures proper cleanup of contexts even in error scenarios. The conditional reset based on async request type prevents interference with synchronous calls.
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java (3)
78-78
: Good use of AtomicBoolean to prevent duplicate trace completion.The
traceEnd
AtomicBoolean ensures that trace sending happens exactly once, preventing duplicate trace events in concurrent scenarios.Also applies to: 155-155
149-166
: Comprehensive error handling in close method.The close method properly:
- Preserves error descriptions when causes exist
- Creates StatusRuntimeException when no cause is provided
- Ensures trace completion for error cases
- Properly cleans up contexts
289-296
: Excellent exception handling in doOnHalfClose.The try-catch block in
doOnHalfClose
ensures that any exceptions duringsuper.onHalfClose()
are properly converted to gRPC Status and the call is closed gracefully. This prevents unhandled exceptions from propagating.
if (spanEventData != null && originalSpan != null) { | ||
if (throwable != null) { | ||
spanEventData.addTag(RpcEventTags.STATUS, TracerResultCode.RPC_RESULT_RPC_FAILED); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent method usage for adding size tag.
There's an inconsistency in how the size tag is added to SpanEventData:
- Line 134 uses:
spanEventData.addTag(RpcEventTags.SIZE, messageSize)
- Line 243 uses:
spanEventData.getEventTagWithNumber().put(RpcEventTags.SIZE, messageSize)
Both should use the same approach for consistency.
Apply this diff to maintain consistency:
-spanEventData.getEventTagWithNumber().put(RpcEventTags.SIZE, messageSize);
+spanEventData.addTag(RpcEventTags.SIZE, messageSize);
Also applies to: 243-243
🤖 Prompt for AI Agents
In
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/interceptor/ServerReqHeaderInterceptor.java
at lines 134 and 243, the method used to add the size tag to SpanEventData is
inconsistent. To fix this, update line 243 to use
spanEventData.addTag(RpcEventTags.SIZE, messageSize) instead of
spanEventData.getEventTagWithNumber().put(RpcEventTags.SIZE, messageSize),
ensuring both lines use the addTag method for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM;
cherry pick v5.13.4 & v5.13.5
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores