-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MetricsRegistry and High Cardinality #1977
Comments
Notes to myself on some details of the issueHere is the base metricset that the Node.js APM agent will send every metricsInterval:
After a transaction we get these breakdown metrics:
which forever will be included in metricsInterval metrics reporting even if their value is zero for a that interval:
If you have an app that has fairly high cardinality of transaction name, as simulated in the following (see "HERE"): const apm = require('./').start({
cloudProvider: 'none',
centralConfig: false,
captureExceptions: false,
logLevel: 'debug',
metricsInterval: 10,
apiRequestTime: 5
})
const crypto = require('crypto')
const http = require('http')
const hostname = '127.0.0.1'
const port = 3000
const server = http.createServer((req, res) => {
apm.setTransactionName('tx id ' + crypto.randomBytes(2).toString('hex')) // <--- HERE
res.writeHead(200, { 'content-type': 'text/plain' })
res.end('pong')
})
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`)
}) then it gets really bad after a number of requests. Thereafter every
|
* feat: no longer sends counting metrics with a count of zero and removes them from the metrics cache/registry Closes: #1977
* feat: no longer sends counting metrics with a count of zero and removes them from the metrics cache/registry Closes: elastic#1977
We've received reports that the current implementation of our metrics registry can create situations where a service or application with a large number of distinct URLs will create a large number of distinct transaction names which, in turn, will create a large number of unique "metric names + labels/dimensions" instances which, over time, can overwhelm APM Server with traffic. This is particularly concerning when a low traffic endpoint creates a metric once that is rarely incremented, but continues to be reported because it was seen once.
In other words, the High Cardinality problem.
The
captureBreakdown
method is where these problematic metrics originate.Our current workaround is to recommend that users use the
setTransactionName
API method to reduce the unique transaction names being generated.This issue is track whether other users are seeing similiar issues with this and discuss possible work around (ejecting stale metrics, allowing configuration of what breakdown metrics are reported, etc,)
The text was updated successfully, but these errors were encountered: