merlimat commented on code in PR #22179:
URL: https://github.com/apache/pulsar/pull/22179#discussion_r1511850762
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -386,7 +402,30 @@ protected ConsumerImpl(PulsarClientImpl client, String
topic, ConsumerConfigurat
topicNameWithoutPartition = topicName.getPartitionedTopicName();
+ InstrumentProvider ip = client.instrumentProvider();
+ Attributes attrs = ip.getAttributes(topic);
+ consumersOpenedCounter = ip.newCounter("pulsar.client.session.opened",
Unit.Sessions,
+ "Counter of sessions opened", attrs.toBuilder().put("type",
"consumer").build());
+ consumersClosedCounter = ip.newCounter("pulsar.client.session.closed",
Unit.Sessions,
+ "Counter of sessions closed", attrs.toBuilder().put("type",
"consumer").build());
+ messagesReceivedCounter = ip.newCounter("pulsar.client.received",
Unit.Messages,
+ "Number of messages received", attrs);
+ bytesReceivedCounter = ip.newCounter("pulsar.client.received",
Unit.Bytes,
Review Comment:
eg:
```
# HELP pulsar_client_received_total Number of messages received
# TYPE pulsar_client_received_total counter
pulsar_client_received_total{otel_scope_name="org.apache.pulsar.client",otel_scope_version="3.3.0-SNAPSHOT",pulsar_namespace="public/default",pulsar_tenant="public",pulsar_topic="persistent://public/default/pt"}
122.0
# HELP pulsar_client_received_bytes_total Bytes received
# TYPE pulsar_client_received_bytes_total counter
pulsar_client_received_bytes_total{otel_scope_name="org.apache.pulsar.client",otel_scope_version="3.3.0-SNAPSHOT",pulsar_namespace="public/default",pulsar_tenant="public",pulsar_topic="persistent://public/default/pt"}
124928.0
```
--
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]