Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: span naming #54

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func (*Channel) nameWhenPublish(exchange string) string {
if exchange == "" {
exchange = "(default)"
}
return exchange + " publish"
return "publish " + exchange
}

func (*Channel) nameWhenConsume(queue string) string {
if queueAnonymous(queue) {
queue = "(anonymous)"
}
return queue + " process"
return "process " + queue
}

func (ch *Channel) startConsumerSpan(msg *amqp091.Delivery, queue string, operation attribute.KeyValue) {
Expand All @@ -87,6 +87,7 @@ func (ch *Channel) startConsumerSpan(msg *amqp091.Delivery, queue string, operat
// Create a span
attrs := []attribute.KeyValue{
operation,
semconv.MessagingOperationName("process"),
semconv.MessagingDestinationAnonymous(queueAnonymous(queue)),
semconv.MessagingDestinationName(queue),
semconv.MessagingDestinationPublishAnonymous(msg.Exchange == ""),
Expand Down Expand Up @@ -158,7 +159,7 @@ func (ch *Channel) PublishWithDeferredConfirmWithContext(
// Create a span.
attrs := []attribute.KeyValue{
semconv.MessagingOperationTypePublish,
semconv.MessagingOperationName("send"),
semconv.MessagingOperationName("publish"),
semconv.MessagingDestinationAnonymous(exchange == ""),
semconv.MessagingDestinationName(exchange),
// todo messaging.client.id
Expand Down
Loading