Skip to content

Commit 42d7f11

Browse files
committed
Fix Kafka Connect test to expect quoted PostgreSQL identifiers in span names
PostgreSQL JDBC driver uses double-quoted identifiers (e.g. INSERT INTO "person"), so the query summary correctly includes quotes per the semantic conventions spec. Updated test expectations accordingly: - Single message: INSERT "person" - Multi-topic batch: BATCH INSERT "person"
1 parent 9eb894f commit 42d7f11

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

instrumentation/kafka/kafka-connect-2.6/testing/src/test/java/io/opentelemetry/instrumentation/kafkaconnect/v2_6/PostgresKafkaConnectSinkTaskTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class PostgresKafkaConnectSinkTaskTest extends KafkaConnectSinkTaskBaseTest {
7272
private static final String DB_SELECT_SPAN_NAME = "SELECT " + DATABASE_NAME;
7373
private static final String DB_INSERT_SPAN_NAME =
7474
emitStableDatabaseSemconv()
75-
? "INSERT " + DB_TABLE_PERSON
75+
? "INSERT \"" + DB_TABLE_PERSON + "\""
76+
: "INSERT " + DATABASE_NAME + "." + DB_TABLE_PERSON;
77+
private static final String DB_BATCH_INSERT_SPAN_NAME =
78+
emitStableDatabaseSemconv()
79+
? "BATCH INSERT \"" + DB_TABLE_PERSON + "\""
7680
: "INSERT " + DATABASE_NAME + "." + DB_TABLE_PERSON;
7781
private static final String CONNECTOR_NAME = "test-postgres-connector";
7882
private static final String TOPIC_NAME = "test-postgres-topic";
@@ -330,7 +334,7 @@ void testMultiTopic() throws Exception {
330334
selectAssertion,
331335
selectAssertion,
332336
span ->
333-
span.hasName(DB_INSERT_SPAN_NAME)
337+
span.hasName(DB_BATCH_INSERT_SPAN_NAME)
334338
.hasKind(SpanKind.CLIENT)
335339
.hasParent(trace.getSpan(0)));
336340
},

0 commit comments

Comments
 (0)