Skip to content

Commit

Permalink
* fix review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wzy19930507 committed Apr 3, 2024
1 parent 2982214 commit a382e45
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public KeyName[] getHighCardinalityKeyNames() {

/**
* Low cardinality tags.
*
* @author Christian Mergenthaler
* @author Wang Zhiyang
*
* @since 3.2
*/
public enum ListenerLowCardinalityTags implements KeyName {

Expand All @@ -93,6 +88,7 @@ public String asString() {

/**
* Messaging system.
* @since 3.2
*/
MESSAGING_SYSTEM {

Expand All @@ -106,6 +102,7 @@ public String asString() {

/**
* Messaging operation.
* @since 3.2
*/
MESSAGING_OPERATION {

Expand All @@ -119,6 +116,7 @@ public String asString() {

/**
* Messaging source name.
* @since 3.2
*/
MESSAGING_SOURCE_NAME {

Expand All @@ -132,6 +130,7 @@ public String asString() {

/**
* Messaging source kind.
* @since 3.2
*/
MESSAGING_SOURCE_KIND {

Expand All @@ -145,6 +144,7 @@ public String asString() {

/**
* Messaging the consumer group.
* @since 3.2
*/
MESSAGING_CONSUMER_GROUP {

Expand All @@ -160,10 +160,6 @@ public String asString() {

/**
* High cardinality tags.
*
* @author Wang Zhiyang
* @author Christian Mergenthaler
*
* @since 3.2
*/
public enum ListenerHighCardinalityTags implements KeyName {
Expand Down Expand Up @@ -224,13 +220,6 @@ public String asString() {

/**
* Default {@link KafkaListenerObservationConvention} for Kafka listener key values.
*
* @author Gary Russell
* @author Christian Mergenthaler
* @author Wang Zhiyang
*
* @since 3.0
*
*/
public static class DefaultKafkaListenerObservationConvention implements KafkaListenerObservationConvention {

Expand Down Expand Up @@ -276,7 +265,7 @@ public String getContextualName(KafkaRecordReceiverContext context) {
return context.getSource() + " receive";
}

private String getConsumerId(KafkaRecordReceiverContext context, @Nullable String clientId) {
private static String getConsumerId(KafkaRecordReceiverContext context, @Nullable String clientId) {
if (StringUtils.hasText(clientId)) {
return context.getGroupId() + " - " + clientId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.header.Header;

import org.springframework.lang.Nullable;

import io.micrometer.observation.transport.ReceiverContext;

/**
Expand Down Expand Up @@ -89,10 +91,21 @@ public String getListenerId() {
return this.listenerId;
}

/**
* Return the consumer group id.
* @return the consumer group id.
* @since 3.2
*/
public String getGroupId() {
return this.groupId;
}

/**
* Return the client id.
* @return the client id.
* @since 3.2
*/
@Nullable
public String getClientId() {
return this.clientId;
}
Expand Down

0 comments on commit a382e45

Please sign in to comment.