Cloudflare Workers

Reports on waitUntil, so nothing is added to the response path.

Take the write key

Everything this install sends is tagged with it, so one key per environment keeps staging out of your production numbers.

Generating…

Install

One package, in the service you are instrumenting.

npm i @clearplane/workers

Add it to Cloudflare Workers

Paste this where the request path is assembled. The account callback is the only part you have to fill in — it is what turns a request into a customer.

ts
import { withClearplane } from "@clearplane/workers";

export default withClearplane({
  async fetch(request, env, ctx) {
    return handle(request);
  },
});

Name this install

Name it for the deployment rather than the framework. Two Next.js apps in one workspace is the normal case, and “Next.js” twice helps nobody.

Environment

Events land in events_cloudflare_workers and are queryable from Chat, models, and SQL.