-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
Would be a quality of life improvement to add sql server support into apmsql and then also apmgormv2.
There are ways to set this up in your project eg.
apmsql.Register("sqlserver", &mssql.Driver{}, apmsql.WithDSNParser(ParseDSN))
dialect := &sqlserver.Dialector{
Config: &sqlserver.Config{
DriverName: apmsql.DriverPrefix + sqlserver.Dialector{}.Name(),
DSN: dsn,
},
}
db, err := gorm.Open(dialect, &gorm.Config{
Logger: logger.Default.LogMode(logLevel),
})
func ParseDSN(name string) apmsql.DSNInfo {
cfg, _, err := msdsn.Parse(name)
if err != nil {
return apmsql.DSNInfo{}
}
return apmsql.DSNInfo{
Address: cfg.Host,
Port: int(cfg.Port),
Database: cfg.Database,
User: cfg.User,
}
}While the above allows sql server to be traced, you lack some quality of life features with the span data.
You will see generic as the driver type as it cannot resolve the correct driver name.
Describe the solution you'd like
I would like sqlserver to be added as another supported driver in module/apmgormv2/driver and module/apmsql. Can use the code above to support this along with being able to return the correct driver name from sqlutil/drivername.go
I will open a pull request for this feature

