Skip to content

Commit

Permalink
mongo: use db.system instead of db.type (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco authored Sep 10, 2020
1 parent 3ea5332 commit 5997cc3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions instrumentation/go.mongodb.org/mongo-driver/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "go.opentelemetry.io/otel/label"
const (
DBApplicationKey = label.Key("db.application")
DBNameKey = label.Key("db.name")
DBTypeKey = label.Key("db.type")
DBSystemKey = label.Key("db.system")
DBInstanceKey = label.Key("db.instance")
DBUserKey = label.Key("db.user")
DBStatementKey = label.Key("db.statement")
Expand All @@ -35,9 +35,9 @@ func DBName(dbName string) label.KeyValue {
return DBNameKey.String(dbName)
}

// DBType indicates the type of Database.
func DBType(dbType string) label.KeyValue {
return DBTypeKey.String(dbType)
// DBSystem indicates the system of Database.
func DBSystem(dbType string) label.KeyValue {
return DBSystemKey.String(dbType)
}

// DBInstance indicates the instance name of Database.
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/go.mongodb.org/mongo-driver/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (m *monitor) Started(ctx context.Context, evt *event.CommandStartedEvent) {
ResourceName("mongo." + evt.CommandName),
DBInstance(evt.DatabaseName),
DBStatement(string(b)),
DBType("mongo"),
DBSystem("mongodb"),
PeerHostname(hostname),
PeerPort(port),
}
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/go.mongodb.org/mongo-driver/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ func Test(t *testing.T) {
assert.Equal(t, port, s.Attributes[PeerPortKey].AsString())
assert.Contains(t, s.Attributes[DBStatementKey].AsString(), `"test-item":"test-value"`)
assert.Equal(t, "test-database", s.Attributes[DBInstanceKey].AsString())
assert.Equal(t, "mongo", s.Attributes[DBTypeKey].AsString())
assert.Equal(t, "mongodb", s.Attributes[DBSystemKey].AsString())
}

0 comments on commit 5997cc3

Please sign in to comment.