Skip to content

Conversation

@markovejnovic
Copy link
Collaborator

Summary

  • Add [telemetry] config block with vendor (bool, default false) and collector-url (optional string) for configuring OpenTelemetry trace export
  • Make OTLP dependencies always-included (remove __otlp_export feature flag) so telemetry is runtime-configurable
  • Refactor Trc tracing builder to accept telemetry config and create per-endpoint OTLP batch exporters
  • Reorder main.rs to load config before tracing init so telemetry settings are available
  • Add vendor telemetry opt-in prompt to onboarding wizard (default: yes)

Resolves MES-717

Config example

[telemetry]
vendor = true
collector-url = "https://my-collector.example.com"

Both vendor and collector-url can be active simultaneously — each gets its own independent OTLP batch exporter.

Remaining work

Grafana Alloy deployment at telemetry.priv.mesa.dev is tracked separately as infrastructure work.

Test plan

  • 7 new unit tests for TelemetryConfig deserialization and endpoints() logic
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • All 50 tests pass
  • Manual: run onboarding wizard, verify telemetry prompt appears after org setup
  • Manual: set vendor = true in config, verify OTLP exporter initializes (check "Telemetry export enabled" log)

@mesa-dot-dev
Copy link

mesa-dot-dev bot commented Feb 12, 2026

Mesa Description

Summary

  • Add [telemetry] config block with vendor (bool, default false) and collector-url (optional string) for configuring OpenTelemetry trace export
  • Make OTLP dependencies always-included (remove __otlp_export feature flag) so telemetry is runtime-configurable
  • Refactor Trc tracing builder to accept telemetry config and create per-endpoint OTLP batch exporters
  • Reorder main.rs to load config before tracing init so telemetry settings are available
  • Add vendor telemetry opt-in prompt to onboarding wizard (default: yes)

Resolves MES-717

Config example

[telemetry]
vendor = true
collector-url = "https://my-collector.example.com"

Both vendor and collector-url can be active simultaneously — each gets its own independent OTLP batch exporter.

Remaining work

Grafana Alloy deployment at telemetry.priv.mesa.dev is tracked separately as infrastructure work.

Test plan

  • 7 new unit tests for TelemetryConfig deserialization and endpoints() logic
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • All 50 tests pass
  • Manual: run onboarding wizard, verify telemetry prompt appears after org setup
  • Manual: set vendor = true in config, verify OTLP exporter initializes (check "Telemetry export enabled" log)

Description generated by Mesa. Update settings

@markovejnovic
Copy link
Collaborator Author

LGTM, but needs testing

@markovejnovic markovejnovic self-assigned this Feb 12, 2026
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 0453e34...491ab6d

Analysis

  1. Telemetry initialization happens up front for every execution path, which could impact performance in paths that don't need tracing capabilities.

  2. The exporter lifecycle is tightly coupled to process lifecycle (initialization, daemonization, shutdown), which may create issues with fork-safety and accurate success reporting.

  3. Early failures before config loading fall back to eprintln!, creating inconsistent command-line user experience depending on whether tracing was initialized.

  4. System correctness now depends on config validation and process lifecycle management rather than cargo features, introducing new potential points of failure.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

5 files reviewed | 1 comments | Edit Agent SettingsRead Docs

std::process::exit(1);
}

let trc_handle = Trc::default()
Copy link

Choose a reason for hiding this comment

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

Medium

Because tracing (and therefore the OTLP exporters) is initialized here before we know whether --daemonize is requested, the process forks after with_telemetry(..).init() has already built the BatchSpanProcessor threads (see Trc::build_otel_provider). Forking a multi‑threaded process is not fork‑safe: the daemonized child only contains the main thread, so the exporter worker threads are gone and queued spans will never flush when the daemon is running with telemetry enabled. To avoid silently breaking telemetry for daemonized runs, the OTLP provider needs to be instantiated only after the daemon fork (or re‑initialized inside the child) instead of before daemonize::Daemonize::start().

Fix in Cursor • Fix in Claude

Prompt for Agent
Task: Address review feedback left on GitHub.
Repository: mesa-dot-dev/gitfs#36
File: src/main.rs#L69
Action: Open this file location in your editor, inspect the highlighted code, and resolve the issue described below.

Feedback:
Because tracing (and therefore the OTLP exporters) is initialized here before we know whether `--daemonize` is requested, the process forks *after* `with_telemetry(..).init()` has already built the `BatchSpanProcessor` threads (see `Trc::build_otel_provider`). Forking a multi‑threaded process is not fork‑safe: the daemonized child only contains the main thread, so the exporter worker threads are gone and queued spans will never flush when the daemon is running with telemetry enabled. To avoid silently breaking telemetry for daemonized runs, the OTLP provider needs to be instantiated only after the daemon fork (or re‑initialized inside the child) instead of before `daemonize::Daemonize::start()`.

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