File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -21,21 +21,20 @@ var (
2121// WrapConnector allows wrapping a database driver.Connector which eliminates
2222// the need to register ocsql as an available driver.Driver.
2323func WrapConnector (dc driver.Connector , options ... TraceOption ) driver.Connector {
24- opts := TraceOptions {
25- InstanceName : defaultInstanceName ,
24+ o := TraceOptions {}
25+ for _ , option := range options {
26+ option (& o )
2627 }
27- for _ , o := range options {
28- o (& opts )
28+ if o .InstanceName == "" {
29+ o .InstanceName = defaultInstanceName
30+ } else {
31+ o .DefaultAttributes = append (o .DefaultAttributes , trace .StringAttribute ("sql.instance" , o .InstanceName ))
2932 }
30- opts .DefaultAttributes = append (
31- opts .DefaultAttributes ,
32- trace .StringAttribute ("sql.instance" , opts .InstanceName ),
33- )
3433
3534 return & ocDriver {
3635 parent : dc .Driver (),
3736 connector : dc ,
38- options : opts ,
37+ options : o ,
3938 }
4039}
4140
You can’t perform that action at this time.
0 commit comments