Skip to content

fix: treat missing/disabled endpoint as no-op tracing, not an error - #1088

Open
uzairhameed wants to merge 1 commit into
meshery:masterfrom
uzairhameed:fix/tracing-endpoint-check
Open

fix: treat missing/disabled endpoint as no-op tracing, not an error#1088
uzairhameed wants to merge 1 commit into
meshery:masterfrom
uzairhameed:fix/tracing-endpoint-check

Conversation

@uzairhameed

@uzairhameed uzairhameed commented Aug 11, 2026

Copy link
Copy Markdown

Fixes: #894

Summary

Makes tracing opt-in rather than attempted-by-default:

  • Adds an Enabled *bool field to Config. When nil, tracing is enabled
    only if Endpoint is set. When explicitly false, tracing is always
    disabled regardless of Endpoint.
  • InitTracer now returns nil, nil (a clean no-op, not an error) when
    either no endpoint is configured, or tracing is explicitly disabled.
    Previously, an empty Endpoint caused a hard error.

Why

Meshery Server was logging repeated "connection refused" errors when no
trace collector was configured, because it kept attempting to reach a
default OTLP address. The original scenario (nothing configured at all)
has separately been mitigated in meshery's main.go, but the same
protection was missing at the meshkit layer, leaving any other meshkit
consumer exposed to the same issue.

Scope

This PR is intentionally narrow, per review feedback, and covers only
the opt-in/endpoint-check behavior.

Testing

Unit tests cover: missing service name (unchanged behavior), missing
endpoint (no-op, not an error), explicit disable with an endpoint set,
explicit enable with no endpoint (still a no-op), and explicit enable
with a valid endpoint (returns a real provider). All existing tests
continue to pass.

Related

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • New Features

    • Added an optional setting to explicitly enable or disable tracing.
    • Tracing now operates silently when disabled or when no endpoint is configured.
  • Bug Fixes

    • Missing tracing endpoints no longer cause initialization errors.
    • Improved handling of tracing configuration across supported settings.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eb89aa8f-ecef-4635-b1ed-efc786818a60

📥 Commits

Reviewing files that changed from the base of the PR and between a20efb1 and 37c550e.

📒 Files selected for processing (1)
  • tracing/tracing_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tracing/tracing_test.go

📝 Walkthrough

Walkthrough

Tracing now supports explicit enablement or disablement. Initialization returns no tracing provider when disabled or when no endpoint is configured. Tests cover these states, YAML configuration, and OpenTelemetry global state restoration.

Changes

Tracing activation

Layer / File(s) Summary
Tracing configuration and initialization
tracing/tracing.go
Adds optional Config.Enabled handling. Explicit disablement and empty endpoints return (nil, nil), while service-name validation remains.
Tracing initialization tests
tracing/tracing_test.go
Tests missing endpoints, explicit disablement, explicit enablement, valid endpoint initialization, YAML configuration, global state restoration, and provider shutdown.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • meshery/meshkit#1070: Modifies the same tracing implementation and tests, including disabled or unconfigured tracing behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes satisfy the no-op collector requirement but do not show Meshery environment-variable and Helm integration required by issue #894. Add the Meshery deployment option, environment-variable support, and Helm values configuration required by issue #894.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main tracing behavior change.
Out of Scope Changes check ✅ Passed The code and tests remain focused on configurable tracing behavior and related initialization paths.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tracing/tracing_test.go`:
- Around line 36-74: Add a table-driven test case exercising
InitTracerFromYamlConfig with YAML containing an endpoint and enabled: false,
and assert it returns no error with a nil provider. Keep the existing direct
Config cases unchanged and ensure the test validates the Enabled YAML tag and
disabled-tracing behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e045fb81-68ed-4335-9bf0-52b1d6631801

📥 Commits

Reviewing files that changed from the base of the PR and between cf39c57 and a20efb1.

📒 Files selected for processing (2)
  • tracing/tracing.go
  • tracing/tracing_test.go

Comment thread tracing/tracing_test.go
Signed-off-by: Uzair Hameed <uzairhameed98@gmail.com>
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.

Allow the configuration of distributed tracing to be disabled

1 participant