vitalics / playwright-prometheus-remote-write-reporter

Playwright prometheus remote write reporter. Send your metrics to prometheus in realtime.
https://www.npmjs.com/package/playwright-prometheus-remote-write-reporter?activeTab=readme
MIT License
11 stars 3 forks source link

feat: custom env support #13

Closed vitalics closed 3 months ago

vitalics commented 3 months ago

After researching, I decided to implement my own.

Closes #8

support custom env. By default we collect process.env. But you can define it's own env variables to send by pass in your config next option:

// utils.ts
export default function mapEnvs(envs: Record<string, string|undefined>){
  // do smth with envs: hide, mask, whatever.
  return {}
}
// playwright.config.ts
export default defineConfig({
// ...
  reporter: [
    ['playwright-prometheus-remote-write-reporter', {
      // env: {} // empty env variables will be send
      // env: {key: 'value'} // key:value will be send to prometheus.
     // env: undefined // same as set process.env. Send all envs in process
     env: mapEnvs(process.env) // mapEnvs - you custom function to hide/mask some env variables
    }]
  ],
// ...
})