Skip to content

filecoin-station/spark-stats-request-metrics

 
 

Repository files navigation

Cloudflare metrics worker

Couldflare worker used to proxy requests to your application and send metrics to InfluxDB.

Development

  1. Install dependencies
npm install
  1. Copy example files
cp .dev.vars.example .dev.vars
cp wrangler.toml.example wrangler.toml
  1. Edit secrets inside .dev.vars and environment variables inside wrangler.toml files

  2. Run your worker

npm run dev

Deployment (Github Actions)

In order to deploy your worker via Github Actions, you need to have a Cloudflare API token and running instance of InfluxDB.

Add generated API token to Github secrets as CLOUDFLARE_API_TOKEN and authentication token under INFLUX_TOKEN.

Other required environment variables include the following:

  • INFLUX_URL - InfluxDB URL
  • INFLUX_DATABASE - InfluxDB database (bucket) name
  • INFLUX_METRIC_NAME - InfluxDB metric name

After setting up secrets, you can push your code to Github and worker will be deployed to production environment automatically.

About

Cloudflare worker to send metric upon pages to InfluxDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%