Skip to content

Commit 74176f7

Browse files
authoredJul 24, 2024··
chore: Verified MySQL host:port metric is recorded (#2400)
1 parent 16866da commit 74176f7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎test/versioned/mysql/basic.tap.js

+8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ tap.test('Basic run through mysql functionality', { timeout: 30 * 1000 }, functi
9292
for (const query of agent.queries.samples.values()) {
9393
t.ok(query.total > 0, 'the samples should have positive duration')
9494
}
95+
96+
const metrics = agent.metrics._metrics.unscoped
97+
const hostPortMetric = Object.entries(metrics).find((entry) =>
98+
/Datastore\/instance\/MySQL\/[0-9a-zA-Z.-]+\/3306/.test(entry[0])
99+
)
100+
t.ok(hostPortMetric, 'has host:port metric')
101+
t.equal(hostPortMetric[1].callCount, 1, 'host:port metric has been incremented')
102+
95103
t.end()
96104
})
97105
})

‎test/versioned/mysql2/basic.tap.js

+8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ tap.test('Basic run through mysql functionality', { timeout: 30 * 1000 }, functi
9292
for (const sample of agent.queries.samples.values()) {
9393
t.ok(sample.total > 0, 'the samples should have positive duration')
9494
}
95+
96+
const metrics = agent.metrics._metrics.unscoped
97+
const hostPortMetric = Object.entries(metrics).find((entry) =>
98+
/Datastore\/instance\/MySQL\/[0-9a-zA-Z.-]+\/3306/.test(entry[0])
99+
)
100+
t.ok(hostPortMetric, 'has host:port metric')
101+
t.equal(hostPortMetric[1].callCount, 1, 'host:port metric has been incremented')
102+
95103
t.end()
96104
})
97105
})

0 commit comments

Comments
 (0)
Please sign in to comment.