Skip to content

Commit

Permalink
fix: Updated the kafkajs node metrics to remove /Named from the n…
Browse files Browse the repository at this point in the history
…ame (#2458)
  • Loading branch information
bizob2828 committed Aug 13, 2024
1 parent 41f33c8 commit 37ce113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/instrumentation/kafkajs/record-linking-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function recordLinkingMetrics({ agent, brokers, topic, producer = true }) {
const kind = producer === true ? 'Produce' : 'Consume'
for (const broker of brokers) {
agent.metrics
.getOrCreateMetric(`MessageBroker/Kafka/Nodes/${broker}/${kind}/Named/${topic}`)
.getOrCreateMetric(`MessageBroker/Kafka/Nodes/${broker}/${kind}/${topic}`)
.incrementCallCount()
}
}
8 changes: 4 additions & 4 deletions test/versioned/kafkajs/kafka.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tap.test('send records correctly', (t) => {
t.equal(sendMetric.callCount, 1)

const produceTrackingMetric = agent.metrics.getMetric(
`MessageBroker/Kafka/Nodes/${broker}/Produce/Named/${topic}`
`MessageBroker/Kafka/Nodes/${broker}/Produce/${topic}`
)
t.equal(produceTrackingMetric.callCount, 1)
}
Expand Down Expand Up @@ -205,7 +205,7 @@ tap.test('sendBatch records correctly', (t) => {
t.equal(sendMetric.callCount, 1)

const produceTrackingMetric = agent.metrics.getMetric(
`MessageBroker/Kafka/Nodes/${broker}/Produce/Named/${topic}`
`MessageBroker/Kafka/Nodes/${broker}/Produce/${topic}`
)
t.equal(produceTrackingMetric.callCount, 1)

Expand Down Expand Up @@ -262,7 +262,7 @@ tap.test('consume outside of a transaction', async (t) => {
t.equal(sendMetric.callCount, 1)

const consumeTrackingMetric = agent.metrics.getMetric(
`MessageBroker/Kafka/Nodes/${broker}/Consume/Named/${topic}`
`MessageBroker/Kafka/Nodes/${broker}/Consume/${topic}`
)
t.equal(consumeTrackingMetric.callCount, 1)

Expand Down Expand Up @@ -376,7 +376,7 @@ tap.test('consume batch inside of a transaction', async (t) => {
t.equal(sendMetric.callCount, 1)

const consumeTrackingMetric = agent.metrics.getMetric(
`MessageBroker/Kafka/Nodes/${broker}/Consume/Named/${topic}`
`MessageBroker/Kafka/Nodes/${broker}/Consume/${topic}`
)
t.equal(consumeTrackingMetric.callCount, 1)

Expand Down

0 comments on commit 37ce113

Please sign in to comment.