storage/cockroachkv: add application name to the db connection string.

CockroachDB collects query metrics and separates them by application name and we were not setting the correct application name for the cockroachkv client. This PR calls our existing function that appends it to the connection string.
Change-Id: I4a97ed248c31f8b187c680d84b45472f0d50fd7e
This commit is contained in:
Simon Guindon 2020-01-10 15:11:08 -05:00
parent 67b5528dc6
commit 5a1b2f49f4

View File

@ -14,6 +14,7 @@ import (
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/private/dbutil"
"storj.io/storj/private/dbutil/pgutil"
"storj.io/storj/storage"
"storj.io/storj/storage/cockroachkv/schema"
)
@ -34,6 +35,8 @@ type Client struct {
// New instantiates a new cockroachkv client given db URL
func New(dbURL string) (*Client, error) {
dbURL = pgutil.CheckApplicationName(dbURL)
db, err := sql.Open("cockroach", dbURL)
if err != nil {
return nil, err