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

mongo: use db.system instead of db.type #335

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
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
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())
}