Skip to content

Commit

Permalink
contrib/go.mongodb.org/mongo-driver: add span type (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilmour authored Jun 29, 2020
1 parent 99f8eaa commit 057f9e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/go.mongodb.org/mongo-driver/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (m *monitor) Started(ctx context.Context, evt *event.CommandStartedEvent) {
hostname, port := peerInfo(evt)
b, _ := bson.MarshalExtJSON(evt.Command, false, false)
opts := []ddtrace.StartSpanOption{
tracer.SpanType(ext.SpanTypeMongoDB),
tracer.ServiceName(m.cfg.serviceName),
tracer.ResourceName("mongo." + evt.CommandName),
tracer.Tag(ext.DBInstance, evt.DatabaseName),
Expand Down
1 change: 1 addition & 0 deletions contrib/go.mongodb.org/mongo-driver/mongo/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func Test(t *testing.T) {
assert.Equal(t, spans[0].TraceID(), spans[1].TraceID())

s := spans[0]
assert.Equal(t, ext.SpanTypeMongoDB, s.Tag(ext.SpanType))
assert.Equal(t, "mongo", s.Tag(ext.ServiceName))
assert.Equal(t, "mongo.insert", s.Tag(ext.ResourceName))
assert.Equal(t, hostname, s.Tag(ext.PeerHostname))
Expand Down

0 comments on commit 057f9e8

Please sign in to comment.