evanderkoogh / otel-cf-workers

An OpenTelemetry compatible library for instrumenting and exporting traces for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
210 stars 40 forks source link

Feature request: Config Function #1

Closed Skye-31 closed 1 year ago

Skye-31 commented 1 year ago

Following up from Discord, being able to define config similarly to how vite does it, via a function that takes request and env would be very useful!

RichiCoder1 commented 1 year ago

@evanderkoogh this is supported, no? https://github.com/evanderkoogh/otel-cf-workers/blob/main/src/sdk.ts#L130

Might be worth updating the readme with instructions on how to use this.

evanderkoogh commented 1 year ago

I am in the middle of a massive refactor and that particular code hasn't been released yet, so I haven't updated the readme just yet.

But I will absolutely do when the code is stable again.

evanderkoogh commented 1 year ago

This is now in the latest “alpha” release 1.0.0-alpha.3.

And way cooler than I expected, you can create a configuration for every single request, because you are passed the trigger for that request.