Skip to content

Commit

Permalink
chore: Verified MySQL host:port metric is recorded (newrelic#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr authored Jul 24, 2024
1 parent 16866da commit 74176f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/versioned/mysql/basic.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ tap.test('Basic run through mysql functionality', { timeout: 30 * 1000 }, functi
for (const query of agent.queries.samples.values()) {
t.ok(query.total > 0, 'the samples should have positive duration')
}

const metrics = agent.metrics._metrics.unscoped
const hostPortMetric = Object.entries(metrics).find((entry) =>
/Datastore\/instance\/MySQL\/[0-9a-zA-Z.-]+\/3306/.test(entry[0])
)
t.ok(hostPortMetric, 'has host:port metric')
t.equal(hostPortMetric[1].callCount, 1, 'host:port metric has been incremented')

t.end()
})
})
Expand Down
8 changes: 8 additions & 0 deletions test/versioned/mysql2/basic.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ tap.test('Basic run through mysql functionality', { timeout: 30 * 1000 }, functi
for (const sample of agent.queries.samples.values()) {
t.ok(sample.total > 0, 'the samples should have positive duration')
}

const metrics = agent.metrics._metrics.unscoped
const hostPortMetric = Object.entries(metrics).find((entry) =>
/Datastore\/instance\/MySQL\/[0-9a-zA-Z.-]+\/3306/.test(entry[0])
)
t.ok(hostPortMetric, 'has host:port metric')
t.equal(hostPortMetric[1].callCount, 1, 'host:port metric has been incremented')

t.end()
})
})
Expand Down

0 comments on commit 74176f7

Please sign in to comment.