Skip to content

Commit

Permalink
Revert "Avoid expensive resource name computation (#412)" (#420)
Browse files Browse the repository at this point in the history
This reverts commit 9f1e063.
  • Loading branch information
gbbr authored Mar 28, 2019
1 parent b58d56c commit 2555c24
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion contrib/gocql/gocql/gocql.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"strconv"
"strings"

"gopkg.in/DataDog/dd-trace-go.v1/ddtrace"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
Expand Down Expand Up @@ -49,7 +50,14 @@ func WrapQuery(q *gocql.Query, opts ...WrapOption) *Query {
fn(cfg)
}
if cfg.resourceName == "" {
cfg.resourceName = q.Statement()
q := `"` + strings.SplitN(q.String(), "\"", 3)[1] + `"`
q, err := strconv.Unquote(q)
if err != nil {
// avoid having an empty resource as it will cause the trace
// to be dropped.
q = "_"
}
cfg.resourceName = q
}
tq := &Query{q, &params{config: cfg}, context.Background()}
return tq
Expand Down

0 comments on commit 2555c24

Please sign in to comment.