Skip to content

Commit

Permalink
fix: set span kind to client for otelgorm
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv committed May 27, 2022
1 parent 23d10df commit 0250bbd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions otelgorm/internal/e2etest/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestEndToEnd(t *testing.T) {
require: func(t *testing.T, spans []sdktrace.ReadOnlySpan) {
require.Equal(t, 1, len(spans))
require.Equal(t, "gorm.Row", spans[0].Name())
require.Equal(t, trace.SpanKindClient, spans[0].SpanKind())

m := attrMap(spans[0].Attributes())

Expand Down
2 changes: 1 addition & 1 deletion otelgorm/otelgorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (p otelPlugin) Initialize(db *gorm.DB) (err error) {

func (p *otelPlugin) before(spanName string) gormHookFunc {
return func(tx *gorm.DB) {
tx.Statement.Context, _ = p.tracer.Start(tx.Statement.Context, spanName)
tx.Statement.Context, _ = p.tracer.Start(tx.Statement.Context, spanName, trace.WithSpanKind(trace.SpanKindClient))
}
}

Expand Down

0 comments on commit 0250bbd

Please sign in to comment.