From 74176f77f70247a3cf65b1b49c5414279b4eeca6 Mon Sep 17 00:00:00 2001 From: James Sumners Date: Wed, 24 Jul 2024 10:48:30 -0400 Subject: [PATCH] chore: Verified MySQL host:port metric is recorded (#2400) --- test/versioned/mysql/basic.tap.js | 8 ++++++++ test/versioned/mysql2/basic.tap.js | 8 ++++++++ 2 files changed, 16 insertions(+) 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() }) })