Skip to content

Commit 17fe0ff

Browse files
authored
Update listener observation operation tag to process
This updates the listener observation operation tag according to latest OpenTelemetry recommendations. Signed-off-by: Christian Fredriksson <christian.fredriksson.2@volvocars.com>
1 parent 7bdd0fc commit 17fe0ff

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaListenerObservation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public KeyValues getLowCardinalityKeyValues(KafkaRecordReceiverContext context)
231231
KeyValues keyValues = KeyValues.of(
232232
ListenerLowCardinalityTags.LISTENER_ID.withValue(context.getListenerId()),
233233
ListenerLowCardinalityTags.MESSAGING_SYSTEM.withValue("kafka"),
234-
ListenerLowCardinalityTags.MESSAGING_OPERATION.withValue("receive"),
234+
ListenerLowCardinalityTags.MESSAGING_OPERATION.withValue("process"),
235235
ListenerLowCardinalityTags.MESSAGING_SOURCE_NAME.withValue(context.getSource()),
236236
ListenerLowCardinalityTags.MESSAGING_SOURCE_KIND.withValue("topic")
237237
);
@@ -269,7 +269,7 @@ public KeyValues getHighCardinalityKeyValues(KafkaRecordReceiverContext context)
269269

270270
@Override
271271
public String getContextualName(KafkaRecordReceiverContext context) {
272-
return context.getSource() + " receive";
272+
return context.getSource() + " process";
273273
}
274274

275275
private static @Nullable String getConsumerId(@Nullable String groupId, @Nullable String clientId) {

spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
* @author Christian Mergenthaler
114114
* @author Soby Chacko
115115
* @author Francois Rosiere
116+
* @author Christian Fredriksson
116117
*
117118
* @since 3.0
118119
*/
@@ -377,14 +378,14 @@ private SimpleSpan assertThatListenerSpanTags(Deque<SimpleSpan> spans, int tagSi
377378
Map.entry("messaging.kafka.consumer.group", consumerGroup),
378379
Map.entry("messaging.kafka.message.offset", offset),
379380
Map.entry("messaging.kafka.source.partition", partition),
380-
Map.entry("messaging.operation", "receive"),
381+
Map.entry("messaging.operation", "process"),
381382
Map.entry("messaging.source.kind", "topic"),
382383
Map.entry("messaging.source.name", sourceName),
383384
Map.entry("messaging.system", "kafka")));
384385
if (keyValues.length > 0) {
385386
Arrays.stream(keyValues).forEach(entry -> assertThat(span.getTags()).contains(entry));
386387
}
387-
assertThat(span.getName()).isEqualTo(sourceName + " receive");
388+
assertThat(span.getName()).isEqualTo(sourceName + " process");
388389
return span;
389390
}
390391

@@ -406,7 +407,7 @@ private void assertThatListenerHasTimerWithNameAndTags(MeterRegistryAssert meter
406407
meterRegistryAssert.hasTimerWithNameAndTags("spring.kafka.listener",
407408
KeyValues.of(
408409
"messaging.kafka.consumer.group", consumerGroup,
409-
"messaging.operation", "receive",
410+
"messaging.operation", "process",
410411
"messaging.source.kind", "topic",
411412
"messaging.source.name", destName,
412413
"messaging.system", "kafka",

0 commit comments

Comments
 (0)