Skip to content

Adoption core logs#2188

Merged
j-chmielewski merged 19 commits intodevfrom
setup-core-logs
Mar 10, 2026
Merged

Adoption core logs#2188
j-chmielewski merged 19 commits intodevfrom
setup-core-logs

Conversation

@j-chmielewski
Copy link
Copy Markdown
Contributor

@j-chmielewski j-chmielewski commented Mar 5, 2026

Related issue: #1925

  • Add Core log capture to interactive proxy and gateway adoption, and show those logs in the UI only on setup failure.
  • Keep logs in a bounded in-memory buffer via the new setup_logs tracing/task-local mechanism.
  • Merge captured Core logs with existing proxy/gateway component logs in setup error SSE responses.
  • Enable component_setup debug logs in the defguard binary so adoption-related debug lines are captured.
  • Add tests for proxy/gateway error log delivery, scoped log capture, nested awaited logs, and buffer bounds.
  • Fix gateway wizard invalid state by redirecting when network_id is missing, avoiding /api/v1/network/null/gateways/setup.
image

@j-chmielewski j-chmielewski changed the title working setup core logs for proxy adoption Adoption core logs Mar 9, 2026
@j-chmielewski j-chmielewski marked this pull request as ready for review March 9, 2026 13:25
Copy link
Copy Markdown

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 adds Core-side log capture for proxy/gateway adoption/setup flows so that bounded, in-memory Core logs can be merged into existing component logs and returned to the UI on setup failures, and fixes a gateway wizard invalid-state route.

Changes:

  • Introduces a task-local setup_logs mechanism (CoreSetupLogLayer + scope_setup_logs) to capture bounded Core tracing output during adoption scopes.
  • Wraps proxy/gateway setup SSE streams to scope Core log capture (including spawned log-reader tasks) and merges captured Core logs into error SSE payloads; enables debug logs for defguard_core::handlers::component_setup.
  • Adds integration/unit tests for log delivery/scoping/bounds and prevents network_id=null gateway wizard routing by redirecting.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web/src/pages/GatewaySetupPage/GatewaySetupPage.tsx Redirects away/reset wizard state when network_id is missing to avoid invalid gateway setup API URLs.
tools/defguard_generator/src/vpn_session_stats.rs Minor transaction borrow adjustment while generating VPN session stats.
crates/defguard_core/tests/integration/api/mod.rs Registers new component setup integration tests.
crates/defguard_core/tests/integration/api/component_setup.rs Adds tests for adoption/setup error SSE log inclusion and setup_logs scoping/bounds.
crates/defguard_core/src/setup_logs.rs Adds task-local, bounded Core tracing log capture layer and scoping helper.
crates/defguard_core/src/lib.rs Exposes the new setup_logs module.
crates/defguard_core/src/handlers/component_setup.rs Scopes Core log capture around proxy/gateway setup flows and merges Core logs into error SSE responses.
crates/defguard_core/Cargo.toml Adds tracing-subscriber dependency required by the new log layer.
crates/defguard/src/main.rs Installs CoreSetupLogLayer and enables component_setup debug logging in the main binary.
Cargo.lock Lockfile update for new dependency.

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

@j-chmielewski j-chmielewski merged commit 4e66375 into dev Mar 10, 2026
3 checks passed
@j-chmielewski j-chmielewski deleted the setup-core-logs branch March 10, 2026 09:52
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.

4 participants