Description
Here
requires metrics is not null and metrics.histogram is a function
If metrics is not enabled, mock Statsd will be used:
|
const statsd = config.statsd.enabled |
|
? new StatsD({ |
|
...config.statsd, |
|
errorHandler: (err) => { |
|
// eslint-disable-next-line no-use-before-define |
|
log.error('statsd.error', err); |
|
}, |
|
}) |
|
: { |
|
increment: () => {}, |
|
timing: () => {}, |
|
close: () => {}, |
|
}; |
However it lacks of function histogram
metrics is initialized here :
|
function resolveMetrics() { |
|
if (Container.has(StatsD)) { |
|
return Container.get(StatsD); |
|
} |
|
} |
Solution:
- Either set metrics to undefined if metrics is not enabled, like here
|
const metrics = config.metrics?.host |
|
? new StatsD({ |
|
...config.metrics, |
|
errorHandler: (err) => { |
|
// eslint-disable-next-line no-use-before-define |
|
logger.error('statsd.error', { err }); |
|
}, |
|
}) |
|
: undefined; |
- Or mock
histogram function (and possibly other functions)
┆Issue is synchronized with this Jira Task
Description
Here
fxa/packages/fxa-shared/db/redis.ts
Line 210 in 4dfbfbc
If metrics is not enabled, mock Statsd will be used:
fxa/packages/fxa-auth-server/bin/key_server.js
Lines 43 to 55 in 4dfbfbc
However it lacks of function
histogrammetrics is initialized here :
fxa/packages/fxa-auth-server/lib/redis.js
Lines 19 to 23 in 4dfbfbc
Solution:
fxa/packages/fxa-graphql-api/src/scripts/must-change-password.ts
Lines 38 to 46 in 4dfbfbc
histogramfunction (and possibly other functions)┆Issue is synchronized with this Jira Task