Skip to content

Restore OpenTelemetry stdin schema support for headers and correct sample_rate docs#7042

Merged
lpcox merged 5 commits into
mainfrom
copilot/compliance-fix-gateway-schema
Jun 5, 2026
Merged

Restore OpenTelemetry stdin schema support for headers and correct sample_rate docs#7042
lpcox merged 5 commits into
mainfrom
copilot/compliance-fix-gateway-schema

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

The stdin JSON schema still rejected gateway.opentelemetry.headers even though the implementation already parsed and applied it. Separately, the docs regressed to claim JSON stdin support for sampleRate, which is not implemented.

  • Schema/runtime alignment

    • Extend the schema fix-up path to inject headers into opentelemetryConfig
    • Keep the change in the existing runtime schema compatibility layer instead of expanding feature surface elsewhere
    • Preserve current behavior for the already-supported stdin → tracing conversion path
  • Regression coverage

    • Add schema-level coverage that asserts headers is present in the fixed OpenTelemetry schema
    • Add stdin loading coverage that verifies configs with gateway.opentelemetry.headers now pass validation and populate tracing config
  • Documentation correction

    • Update the OpenTelemetry configuration table to mark sample_rate as TOML-only
    • Remove the inaccurate sampleRate (JSON stdin) claim while keeping CLI support documentation intact
  • Behavioral example

    {
      "gateway": {
        "port": 8080,
        "domain": "localhost",
        "apiKey": "test-key",
        "opentelemetry": {
          "endpoint": "https://otel-collector.example.com",
          "headers": "X-Test=value"
        }
      }
    }

    This config is now accepted by stdin schema validation and the headers value is propagated into the runtime tracing configuration.

Copilot AI changed the title [WIP] Fix compliance gap for gateway.opentelemetry schema Restore OpenTelemetry stdin schema support for headers and correct sample_rate docs Jun 5, 2026
Copilot finished work on behalf of lpcox June 5, 2026 13:58
Copilot AI requested a review from lpcox June 5, 2026 13:58
@lpcox lpcox marked this pull request as ready for review June 5, 2026 14:38
Copilot AI review requested due to automatic review settings June 5, 2026 14:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores alignment between the embedded JSON stdin schema and the gateway’s existing OpenTelemetry runtime behavior by allowing gateway.opentelemetry.headers, and it corrects documentation that incorrectly claimed JSON stdin support for sampleRate.

Changes:

  • Extend the schema “fix-up” layer to inject headers into opentelemetryConfig so stdin validation no longer rejects a supported field.
  • Add tests that (1) assert the schema injection and (2) verify stdin loading accepts gateway.opentelemetry.headers and propagates it into Gateway.Tracing.
  • Update OpenTelemetry docs to mark sample_rate as TOML-only (still supported via CLI), removing the inaccurate JSON stdin claim.
Show a summary per file
File Description
internal/config/validation_schema.go Injects headers into the fixed Draft-7 schema for opentelemetryConfig to match runtime support.
internal/config/load_from_stdin_coverage_test.go Adds stdin coverage ensuring gateway.opentelemetry.headers validates and maps to runtime tracing config.
internal/config/fetch_and_fix_schema_test.go Adds schema-level test coverage for the headers property injection.
docs/CONFIGURATION.md Corrects docs to indicate sample_rate is TOML-only (not supported via JSON stdin).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment thread internal/config/validation_schema.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lpcox
Copy link
Copy Markdown
Collaborator

lpcox commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 5, 2026

@copilot fix the failing ci check https://github.com/github/gh-aw-mcpg/actions/runs/27022710054/job/79754594049?pr=7042

Fixed in 5cf8bb8. I investigated the failing lint job and removed duplicate TestCopyTrimmedStringIntMap* declarations from internal/strutil/util_test.go (the canonical tests remain in internal/strutil/copy_trimmed_string_int_map_test.go), which resolves the go vet redeclaration failure on the PR merge check.

Copilot finished work on behalf of lpcox June 5, 2026 15:15
@lpcox lpcox merged commit 0c7c661 into main Jun 5, 2026
16 checks passed
@lpcox lpcox deleted the copilot/compliance-fix-gateway-schema branch June 5, 2026 15:21
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
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.

[compliance] Compliance Gap: gateway.opentelemetry schema missing fields (headers blocked, sampleRate doc regression) — commit 27fc0d0

3 participants