Skip to content

Add privacy-safe configurable OpenTelemetry tracing - #24

Merged
rodion-m merged 3 commits into
mainfrom
agent/privacy-safe-otel
Aug 4, 2026
Merged

Add privacy-safe configurable OpenTelemetry tracing#24
rodion-m merged 3 commits into
mainfrom
agent/privacy-safe-otel

Conversation

@rodion-m

@rodion-m rodion-m commented Aug 4, 2026

Copy link
Copy Markdown
Member

What changed

  • instrument inbound Starlette and outbound HTTPX requests with correlated OpenTelemetry spans
  • sanitize exported spans by removing headers, URL queries, client/session/resource identifiers, exception messages, and stack traces
  • support standard generic and traces-specific OTLP endpoint variables
  • make HTTP access logging configurable for hardened deployments
  • suppress FastMCP logs when FASTMCP_LOG_ENABLED=false to avoid retaining rejected payloads

Why

These two telemetry commits were created after OAuth PR #23 merged and were never published. This ports them onto the current main without changing the OAuth challenge or token-exchange behavior.

Validation

  • uvx --from uv==0.11.28 uv sync --locked --extra test
  • uvx --from uv==0.11.28 uv run python -m pytest src/tests/ -q — 200 passed
  • uvx --from uv==0.11.28 uv run python smoke_test.py — 6 passed

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@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: fcc2fcfc1c

ℹ️ 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/core/observability.py
Comment on lines +38 to +40
"url.full",
"url.query",
"user_agent.original",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Strip the legacy HTTP request-target attribute

When an OTLP endpoint is configured and the server receives HTTP traffic, the pinned Starlette/ASGI instrumentation can emit the legacy http.target attribute containing the raw path and query string. This denylist removes http.url and the newer url.* fields but forwards http.target unchanged, so query parameters—including tokens or user-supplied text—can still reach the telemetry backend; add the legacy request-target key to the sanitizer and cover it in the privacy test.

Useful? React with 👍 / 👎.

@rodion-m
rodion-m merged commit b20b1ba into main Aug 4, 2026
6 checks passed
@rodion-m
rodion-m deleted the agent/privacy-safe-otel branch August 4, 2026 16:21

@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: 80b77f5300

ℹ️ 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 pyproject.toml
# Security exception: cryptography 50.0.0 fixes GHSA-g6cj-pr64-35w5 and was
# released inside the normal quarantine window. Keep the exception package-
# scoped so all unrelated dependencies remain subject to the seven-day delay.
exclude-newer-package = { cryptography = "2026-08-01T00:00:00Z" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep cryptography behind the seven-day quarantine

Remove this exception or retain cryptography 49.0.0 until the quarantine expires: this August 4 commit makes the lock select 50.0.0 even though uv.lock records its artifacts as uploaded on July 31, only about four days earlier. This directly bypasses the repository's mandatory seven-day waiting period for versioned dependencies.

AGENTS.md reference: AGENTS.md:L22-L27

Useful? React with 👍 / 👎.

Comment thread src/core/observability.py
Comment on lines +128 to +130
otlp_endpoint = os.environ.get(
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"
) or os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Redact credentials from the OTLP endpoint log

When OTEL_EXPORTER_OTLP_TRACES_ENDPOINT contains URI credentials or a query-based access token, selecting it here causes the later info-level log to serialize the complete value as endpoint, exposing that credential in normal production logs. Log only a redacted destination such as scheme and host rather than the raw endpoint.

Useful? React with 👍 / 👎.

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