diff --git a/test/versioned/mysql/basic.tap.js b/test/versioned/mysql/basic.tap.js index 75fa098501..b57dc9efdc 100644 --- a/test/versioned/mysql/basic.tap.js +++ b/test/versioned/mysql/basic.tap.js @@ -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() }) }) diff --git a/test/versioned/mysql2/basic.tap.js b/test/versioned/mysql2/basic.tap.js index 85726ca52b..26da21b8d4 100644 --- a/test/versioned/mysql2/basic.tap.js +++ b/test/versioned/mysql2/basic.tap.js @@ -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() }) })