Skip to content

Move opentelemetry_excluded_urls onto OpenTelemetryConfig; pin sibling-path exclusions#132

Merged
lesnik512 merged 4 commits into
mainfrom
feat/otel-excluded-urls-home
Jun 24, 2026
Merged

Move opentelemetry_excluded_urls onto OpenTelemetryConfig; pin sibling-path exclusions#132
lesnik512 merged 4 commits into
mainfrom
feat/otel-excluded-urls-home

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Resolves the proportionate slice of architecture-review candidate 4 (OTel's stringly-typed cross-config reads).

  • Move opentelemetry_excluded_urls onto OpenTelemetryConfig. It was OTel's own setting but declared three times on the framework configs (FastAPIConfig/LitestarConfig/FastStreamConfig) and never on OpenTelemetryConfig — which forced _build_excluded_urls to read it via getattr. Now one declaration, typed access. Inherited by every OTel-composing config (incl. FreeConfig, where it's inert).
  • Pin the genuine cross-instrument reads with a test. prometheus_metrics_path / health_checks_path belong to other instruments and are optionally absent (OTel runs in FreeConfig), so their defensive getattr(..., None) stays — but a new test now asserts the metrics path is always excluded and the health path is excluded iff opentelemetry_generate_health_check_spans=False. A rename or policy regression now fails loudly; previously it was silent.

Why

The four getattrs in _build_excluded_urls are two different things. One is a misplaced own-field (fix it); three are genuine optional siblings (keep the defensive read, but test it). Full reasoning, and why the "contribution mechanism" refactor was rejected (worsens locality, fails the deletion test), in the change bundle.

Not done (deliberately)

  • No contribution-mechanism refactor — _build_excluded_urls keeps the exclusion policy in one readable method.
  • pyroscope_endpoint getattr (line 174) left as-is — it's a span-processor decision, not part of URL exclusion.

Verification

201 passed, 100% coverage; just lint clean (ruff + ty). Spot-checked FreeConfig(opentelemetry_excluded_urls=["/x"]) constructs (field now inherited).

🤖 Generated with Claude Code

lesnik512 and others added 4 commits June 24, 2026 12:04
Pins the genuine cross-instrument reads in _build_excluded_urls (prometheus_metrics_path,
health_checks_path + the generate_health_check_spans conditional) so a rename or policy
regression fails loudly. Characterizes existing behavior; no production change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The field was OTel's own setting but declared three times on the framework configs
and read via getattr. Move it to OpenTelemetryConfig (one declaration, typed access
in _build_excluded_urls). Inherited by all OTel-composing configs including FreeConfig
(inert there). The prometheus/health getattrs stay — those are genuine optional siblings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 1870504 into main Jun 24, 2026
7 checks passed
@lesnik512 lesnik512 deleted the feat/otel-excluded-urls-home branch June 24, 2026 09:15
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