Copilot commented on code in PR #37659:
URL: https://github.com/apache/shardingsphere/pull/37659#discussion_r2668193766
##########
agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/advice/OpenTelemetryJDBCExecutorCallbackAdvice.java:
##########
@@ -42,7 +42,9 @@ protected void recordExecuteInfo(final Span parentSpan, final
TargetAdviceObject
final ConnectionProperties
connectionProps, final DatabaseType databaseType) {
Tracer tracer =
GlobalOpenTelemetry.getTracer(OpenTelemetryConstants.TRACER_NAME);
SpanBuilder spanBuilder = tracer.spanBuilder(OPERATION_NAME);
- spanBuilder.setParent(Context.current().with(parentSpan));
+ if (null != parentSpan) {
+ spanBuilder.setParent(Context.current().with(parentSpan));
+ }
Review Comment:
The test coverage for null parent span handling is missing for
OpenTelemetryJDBCExecutorCallbackAdvice. While
OpenTelemetrySQLParserEngineAdvice has a test case
assertMethodWithoutParentSpan that tests the scenario when
RootSpanContext.set(null) is called, there is no equivalent test for
OpenTelemetryJDBCExecutorCallbackAdvice. Since both classes received the same
null safety improvements, they should have equivalent test coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]