Skip to content

fix(telemetry): accept memory profiler settings on all platforms - #293

Merged
TheJokr merged 1 commit into
cloudflare:mainfrom
LubabaKhalid:fix/memory-profiler-settings-all-platforms
Oct 30, 2026
Merged

TheJokr merged 1 commit into
cloudflare:mainfrom
LubabaKhalid:fix/memory-profiler-settings-all-platforms

Conversation

@LubabaKhalid

Copy link
Copy Markdown
Contributor

TelemetrySettings::memory_profiler only exists on Linux. A config generated on Linux (for example with Cli's --generate) includes a memory_profiler section, and since unknown fields are rejected by default, loading that same config on macOS fails. This makes it awkward to share one config between a Linux deployment and local development on a Mac.

The settings struct itself has nothing Linux-specific, only the profiler does. This change gates the settings module, its re-export and the memory_profiler field on the memory-profiling feature alone. The profiler, the /pprof/* routes and the startup code that applies these settings stay Linux-only, so on other platforms the section is accepted but has no effect. The field docs (which also show up in generated configs) now say so.

On Linux the compiled code is unchanged. The only difference on other platforms is that TelemetrySettings gains the memory_profiler field, which also means configs generated there now match the ones generated on Linux.

Testing

  • New settings test that parses a TelemetrySettings config containing a memory_profiler section. It passes trivially on Linux; the macOS CI job is the one that exercises the fix.
  • cargo test -p foundations --test settings.
  • cargo clippy -p foundations --all-targets with the CI lint flags, cargo check with memory-profiling,logging, memory-profiling,logging,settings and logging,settings, and rustfmt --check --edition 2024.

Closes #84

`TelemetrySettings::memory_profiler` only existed on Linux. A config
generated on Linux includes the `memory_profiler` section, and with
`settings_deny_unknown_fields_by_default` that section is rejected as an
unknown field on macOS and other platforms, so the same config cannot be
used for local development.

Gate the settings on the `memory-profiling` feature only. The profiler
itself stays Linux-only, so on other platforms the settings are accepted
but have no effect.
@LubabaKhalid

Copy link
Copy Markdown
Contributor Author

@TheJokr this makes the memory profiler settings available on all platforms, so a config generated on Linux also loads on macOS. Could you take a look when you have a moment? Thanks!

@TheJokr
TheJokr merged commit e46ad4b into cloudflare:main Oct 30, 2026
19 checks passed
@TheJokr TheJokr mentioned this pull request Oct 30, 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.

Telemetry config generated on Linux platforms does not work on non-Linux platforms on 4.0

2 participants