Metronome Vite Plugin Configuration
Metronome has a few configurations that can help you track only what you need. In vite, instead of using a config file, you can pass the configuration as a plugin option.MetronomeConfig interface
export interface MetronomeConfig {
endpoint?: string | null;
apiKey?: string | null;
ignoredRoutes?: (string | RegExp)[];
ignoredPathnames?: (string | RegExp)[];
unstable_sourceMaps?: boolean;
debug?: boolean;
}
Config Properties
Property | Type | Default Value |
---|---|---|
endpoint | string | |
apiKey* | string | |
ignoredRoutes | (string | RegExp)[] | |
ignoredPathnames | (string | RegExp)[] | ["/healthcheck"] |
unstable_sourceMaps | boolean | false |
debug | boolean | false |
Because Metronome configuration gets bundled with your server code, it's not recommended to use the apiKey property to set your api key. Instead, use the environment variable.
METRONOME_API_KEY
Usage
vite.config.js
// ...
export default defineConfig({
plugins: [
remix(),
tsconfigPaths(),
metronome({
// The endpoint prop is not needed if you're using Metronome Cloud
endpoint: "https://metronome.example.com",
ignoredPathnames: ["/healthcheck", /^\/tasks\/.*/],
ignoredRoutes: ["root"],
}),
],
});