Skip to content

feat: custom fetcher - #2

Open
sittiponghaus wants to merge 4 commits into
context-labs:mainfrom
sittiponghaus:main
Open

sittiponghaus wants to merge 4 commits into
context-labs:mainfrom
sittiponghaus:main

Conversation

@sittiponghaus

@sittiponghaus sittiponghaus commented Dec 18, 2025

Copy link
Copy Markdown

Add custom fetcher support for export via VPC Bindings


Note

Low Risk
Optional API with default fetch preserves existing behavior; custom fetch only affects OTLP HTTP export routing when configured.

Overview
Adds an optional fetcher (Fetcher['fetch']) so OTLP telemetry can be sent through a bound implementation (e.g. Workers VPC fetch) instead of only the global fetch.

OTLPTransport and OTLPTransportConfig accept fetcher, defaulting to fetch, and export requests use unwrap(this.fetcher). OTLPExporterConfig / OTLPExporter store the same optional fetcher in the constructor. README adds a Custom Fetcher example wiring trace exporter and log transport from env.VPC_BINDING.

Reviewed by Cursor Bugbot for commit d61092f. Bugbot is set up for automated code reviews on this repo. Configure here.

@sittiponghaus

Copy link
Copy Markdown
Author

Is this repository open to contributions?

@ifharry

ifharry commented Feb 24, 2026

Copy link
Copy Markdown

Hey! yes it is - whats the usecase for this? (mb just noticed the think); right now we just use the default fetch under the hood, if you resolve the conflicts on this happy to merge, it should be allowed for the logger and tracer preferably! :)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d61092f. Configure here.

Comment thread src/exporter.ts
constructor(config: OTLPExporterConfig) {
this.url = config.url
this.headers = Object.assign({}, DEFAULT_OTLP_HEADERS, config.headers)
this.fetcher = config.fetcher ?? fetch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom fetcher unused in exporter

High Severity

OTLPExporter accepts and stores config.fetcher, but send still calls global fetch via unwrap(fetch) instead of this.fetcher. Custom fetchers (including VPC bindings shown in the README) are ignored for traces, while OTLPTransport correctly uses this.fetcher.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d61092f. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants