Skip to content

feat: support OTLP export through an HTTP forward proxy - #148

Open
enternal111 wants to merge 8 commits into
DEVtheOPS:mainfrom
enternal111:feat/otlp-export-proxy
Open

enternal111 wants to merge 8 commits into
DEVtheOPS:mainfrom
enternal111:feat/otlp-export-proxy

Conversation

@enternal111

Copy link
Copy Markdown

Which problem is this PR solving?

Networks that require an outbound HTTP proxy currently cannot export telemetry: the Node.js OTLP HTTP exporters create their own agents and ignore HTTP(S)_PROXY, and opentelemetry-js has no released support for OTEL_EXPORTER_OTLP_PROXY_URL yet (open-telemetry/opentelemetry-js#6932, which also relies on a Node-native agent option that other runtimes such as Bun do not implement).

Short description of the changes

  • New otlpProxyUrl option, read from OPENCODE_OTLP_PROXY_URL or the standard OTEL_EXPORTER_OTLP_PROXY_URL, following the same precedence style as the other OTLP settings.
  • When set, an https-proxy-agent is wired into the HTTP exporters through the official httpAgentOptions agent factory, so gRPC is unaffected and no exporter is patched.
  • The startup connectivity probe targets the proxy when one is configured, since the collector host itself is usually not resolvable on such networks.

How Has This Been Tested?

  • bun run typecheck
  • bun run lint
  • bun test (unit suite green, including new config resolution and exporter construction tests)
  • Manual end-to-end: exporting traces through an authenticating corporate proxy to a public OTLP endpoint

Networks that require an outbound proxy currently cannot export
telemetry: the Node.js OTLP HTTP exporters create their own agents and
ignore HTTP(S)_PROXY, and opentelemetry-js has no released support for
OTEL_EXPORTER_OTLP_PROXY_URL yet (open-telemetry/opentelemetry-js#6932,
which also relies on a Node-native agent option that other runtimes
such as Bun do not implement).

Add an otlpProxyUrl option, read from OPENCODE_OTLP_PROXY_URL or
OTEL_EXPORTER_OTLP_PROXY_URL, that wires an https-proxy-agent into the
HTTP exporters through the official httpAgentOptions agent factory.
The connectivity probe targets the proxy when one is configured.
Applying the proxy agent unconditionally broke exporters pointed at a
local collector (for example an OpenTelemetry collector on 127.0.0.1):
the request was tunneled to the proxy, which cannot reach the user''s
loopback, and every export failed silently. Bypass the proxy for
loopback hosts and for hosts matching the standard NO_PROXY list, and
make the startup probe follow the same decision.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T09:58:44.032695Z 5cd57b6 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2eee83551

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/otel.ts Resolved
Comment thread src/config.ts Resolved
Comment thread src/otel.ts Resolved
…back

Use HttpProxyAgent for http: endpoints so the proxy receives a plain
HTTP request instead of a CONNECT to a non-TLS port, and remove the
OTEL_EXPORTER_OTLP_PROXY_URL fallback to keep configuration scoped to
the OPENCODE_ namespace. Strip unrequested comments per the repository
convention.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c34a791901

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plugin.ts Resolved
The gRPC exporter does not use the HTTP proxy agent, so the connectivity
probe should target the collector endpoint rather than the proxy when
the protocol is grpc.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5647d9f906

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bun.lock Resolved
Comment thread src/otel.ts Resolved
Match NO_PROXY entries against both hostname and hostname:port so an
entry like collector.example.com:4318 bypasses as expected, and
regenerate bun.lock against registry.npmjs.org to drop mirror URLs
introduced by the local development proxy.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@enternal111

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ecd2f49fbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/otel.ts Resolved
Match any 127.x.x.x address so collectors bound to non-standard
loopback addresses also bypass the proxy.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e441bdc9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/otel.ts Resolved
Infer the default port (443 for https, 80 for http) when the endpoint
omits it so a NO_PROXY entry like example.com:443 matches
https://example.com as expected.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64aa1abcbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/otel.ts Resolved
Match only four-octet IPv4 addresses starting with 127 so a DNS name
such as 127.example.com does not bypass the proxy.
@enternal111

Copy link
Copy Markdown
Author

@codex review

@enternal111

Copy link
Copy Markdown
Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 5cd57b6545

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant