Configuring Metronome
Metronome has a few configurations that can help you track only what you need.
To use this file to an existing configuration, you can use the information in the installation guides of your current Remix adapter.
metronome.config.js
has the following props that can be used to configure the metronome:
Property | Type | Default Value |
---|---|---|
ignoredRoutes | (string | RegExp)[] | |
ignoredPathnames | (string | RegExp)[] | ["/healthcheck"] |
ignoreHeadMethod | boolean | true |
ignoredRoutes
This property controls the routes that will be ignored by the metronome. The routes will be ignored if they match any of the values in this array.
/*** @type {import('@metronome-sh/config').MetronomeConfig}*/module.exports = {ignoredRoutes: ["root"], // Ignores the root route};
This option only ignores the loaders and actions invocations for a specific route. For example, if you have the following routes:
root.tsx
tasks.tsx
tasks.$taskId.tsx
Having the configuration above, only the loader at root.tsx
will get ignored when you make a GET
request to /tasks/123
.
If you want to ignore all, you may need to use ignoredPathnames
instead.
ignoredPathnames
This property controls the pathnames that will be ignored. It will ignore all loaders and actions that match the pathname.
/*** @type {import('@metronome-sh/config').MetronomeConfig}*/module.exports = {// Ignores healthcheck as paths that matches /tasks/test...ignoredPathnames: ["/healthcheck", /^\/tasks\/test.*/],};
If you for example, have the following routes:
root.tsx
healthcheck.tsx
Having the configuration above, you make a GET
request to /healthcheck
, both the loaders at root.tsx
and healthcheck.tsx
will be ignored.
ignoreHeadMethod
This property controls whether the HEAD
method will be ignored.
/*** @type {import('@metronome-sh/config').MetronomeConfig}*/module.exports = {ignoreHeadMethod: true,};