Skip to content

Commit 4702698

Browse files
committed
Revert "Monitors DB queries for metadata"
This reverts commit b97ec46. Apparently this produces more traffic than New Relic can handle on the free plan.
1 parent b97ec46 commit 4702698

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

db/postgres.go

+3-7
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,14 @@ func (p *PostgreSQL) GetCompany(id string) (string, error) {
128128
if err != nil {
129129
return "", fmt.Errorf("error converting cnpj %s to integer: %w", id, err)
130130
}
131+
131132
ctx := context.Background()
132133
if p.newRelic != nil {
133134
txn := p.newRelic.StartTransaction("GetCompany")
134135
ctx = newrelic.NewContext(ctx, txn)
135136
defer txn.End()
136137
}
138+
137139
rows, err := p.pool.Query(ctx, p.sql["get"], n)
138140
if err != nil {
139141
return "", fmt.Errorf("error looking for cnpj %d: %w", n, err)
@@ -176,13 +178,7 @@ func (p *PostgreSQL) MetaSave(k, v string) error {
176178

177179
// MetaRead reads a key/value pair from the metadata table.
178180
func (p *PostgreSQL) MetaRead(k string) (string, error) {
179-
ctx := context.Background()
180-
if p.newRelic != nil {
181-
txn := p.newRelic.StartTransaction("MetaRead")
182-
ctx = newrelic.NewContext(ctx, txn)
183-
defer txn.End()
184-
}
185-
rows, err := p.pool.Query(ctx, p.sql["meta_read"], k)
181+
rows, err := p.pool.Query(context.Background(), p.sql["meta_read"], k)
186182
if err != nil {
187183
return "", fmt.Errorf("error looking for metadata key %s: %w", k, err)
188184
}

0 commit comments

Comments
 (0)