Skip to content

Commit 4f89905

Browse files
bramweltclaude
andcommitted
fix(review): address PR #121 review feedback
Address review comments from copilot-pull-request-reviewer: - client.go: add messaging.operation.type="publish" to producer span attributes in publishWithSpan to match documented semconv schema - client.go: add messaging.operation.type="process" to consumer span attributes in SubscribeWithTransportMessenger to match documented semconv schema - client.go: remove unconditional span.SetStatus(codes.Ok) after handler returns; leave status unset on success per OTel spec, only set Error on panic/failures - tracing_test.go: rename subtest to "Set/Get round-trip preserves values" — the body only exercises carrier.Set/Get, not a propagator Resolves 4 review threads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Issue: LFXV2-1743 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
1 parent 923c34f commit 4f89905

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

internal/infrastructure/nats/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func (c *NATSClient) publishWithSpan(ctx context.Context, subject string, data [
119119
trace.WithAttributes(
120120
attribute.String("messaging.system", "nats"),
121121
attribute.String("messaging.destination.name", subject),
122+
attribute.String("messaging.operation.type", "publish"),
122123
attribute.Int("messaging.message.body.size", len(data)),
123124
),
124125
)
@@ -177,6 +178,7 @@ func (c *NATSClient) SubscribeWithTransportMessenger(ctx context.Context, subjec
177178
trace.WithAttributes(
178179
attribute.String("messaging.system", "nats"),
179180
attribute.String("messaging.destination.name", subject),
181+
attribute.String("messaging.operation.type", "process"),
180182
attribute.Int("messaging.message.body.size", len(msg.Data)),
181183
),
182184
)
@@ -197,7 +199,6 @@ func (c *NATSClient) SubscribeWithTransportMessenger(ctx context.Context, subjec
197199
}()
198200

199201
handler(msgCtx, transportMsg)
200-
span.SetStatus(codes.Ok, "")
201202
})
202203
}
203204

internal/infrastructure/nats/tracing_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestNatsHeaderCarrier_TextMapCarrier(t *testing.T) {
8888
var _ propagation.TextMapCarrier = natsHeaderCarrier{}
8989
})
9090

91-
t.Run("inject and extract round-trip via propagator", func(t *testing.T) {
91+
t.Run("Set/Get round-trip preserves values", func(t *testing.T) {
9292
header := make(natsgo.Header)
9393
carrier := natsHeaderCarrier(header)
9494

0 commit comments

Comments
 (0)