Skip to content

Commit 25855cf

Browse files
committed
Add tags to receive observation
1 parent 946d30a commit 25855cf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/com/rabbitmq/client/observation/micrometer/MicrometerObservationCollector.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.rabbitmq.client.*;
1818
import com.rabbitmq.client.observation.ObservationCollector;
19+
import io.micrometer.common.KeyValues;
1920
import io.micrometer.observation.Observation;
2021
import io.micrometer.observation.ObservationRegistry;
2122
import java.io.IOException;
@@ -56,8 +57,6 @@ public void publish(
5657
byte[] body,
5758
ConnectionInfo connectionInfo)
5859
throws IOException {
59-
// TODO: Is this for fire and forget or request reply too? If r-r then we have to have 2
60-
// contexts
6160
Map<String, Object> headers;
6261
if (properties.getHeaders() == null) {
6362
headers = new HashMap<>();
@@ -103,13 +102,14 @@ public Consumer basicConsume(String queue, String consumerTag, Consumer consumer
103102
@Override
104103
public GetResponse basicGet(BasicGetCall call, String queue) {
105104
return Observation.createNotStarted("rabbitmq.receive", registry)
105+
.highCardinalityKeyValues(
106+
KeyValues.of(
107+
RabbitMqObservationDocumentation.LowCardinalityTags.MESSAGING_OPERATION.withValue(
108+
"receive"),
109+
RabbitMqObservationDocumentation.LowCardinalityTags.MESSAGING_SYSTEM.withValue(
110+
"rabbitmq")))
106111
.observe(
107112
() -> {
108-
try {
109-
Thread.sleep(100);
110-
} catch (InterruptedException e) {
111-
throw new RuntimeException(e);
112-
}
113113
GetResponse response = call.get();
114114
if (response != null) {
115115
Map<String, Object> headers;

0 commit comments

Comments
 (0)