Configuring Metronome

Metronome has a few configurations that can help you track only what you need. The
metronome.config.js
file has the following props that can be used to configure the metronome:

Default Config file

When you run
metronome init
it will create a
metronome.config.js
file in the root of your project. This file will have the following default configuration:
metronome.config.js
/**
* @type {import('@metronome-sh/config').MetronomeConfig}
*/
module.exports = {
ignoredRoutes: [],
ignoredPathnames: ["/healthcheck"],
ignoreHeadMethod: true,
};

Config Properties

PropertyTypeDefault Value
ignoredRoutes
(string | RegExp)[]
ignoredPathnames
(string | RegExp)[]
["/healthcheck"]
ignoreHeadMethod
boolean
true

ignoredRoutes

This property controls the routes that will be ignored by the Metronome. Metronome will ignore all loaders and actions that match the route.
metronome.config.js
/**
* @type {import('@metronome-sh/config').MetronomeConfig}
*/
module.exports = {
// Ignores the root route
ignoredRoutes: ["root"],
ignoredPathnames: ["/healthcheck"],
ignoreHeadMethod: true,
};
With the configuration above, the
root
route will be always ignored.

ignoredPathnames

This property controls the pathnames that will be ignored. Metronome will ignore all loaders and actions that match the pathname.
metronome.config.js
/**
* @type {import('@metronome-sh/config').MetronomeConfig}
*/
module.exports = {
ignoredRoutes: [],
// Ignores the healthcheck and all loaders and actions
// that contains "tasks" in the pathname
ignoredPathnames: ["/healthcheck", /^\/tasks\/.*/],
ignoreHeadMethod: true,
};
For example, having
healthcheck.tsx
,
tasks.tsx
and
tasks.$taskId.tsx
route files and the configuration above, the
/healthcheck
and
/tasks/123
loader or action will be ignored while
/tasks
will still be tracked.

ignoreHeadMethod

This property controls if the
HEAD
method will be ignored. Metronome will ignore all the requests that match the method.
metronome.config.js
/**
* @type {import('@metronome-sh/config').MetronomeConfig}
*/
module.exports = {
ignoredRoutes: [],
ignoredPathnames: ["/healthcheck"],
// Tracks the HEAD method
ignoreHeadMethod: true,
};