Skip to content

Report eBPF service status instead of installation#332

Closed
srikrishnaveturi wants to merge 2 commits into
devfrom
sveturi/dev
Closed

Report eBPF service status instead of installation#332
srikrishnaveturi wants to merge 2 commits into
devfrom
sveturi/dev

Conversation

@srikrishnaveturi

Copy link
Copy Markdown
Contributor

Description

Previously, the eBPF substatus in the GPA VM extension only reported whether the eBPF services (EbpfCore and
NetEbpfExt) were installed. This meant the reported status could show "Success" even when one or both services were
stopped or in a degraded state.

This change updates the eBPF status reporting to query the runtime state (e.g., Running, Stopped) and start type
(e.g., AutoStart) of each eBPF driver service. The substatus now reports Success only when both services are
confirmed running, and Error otherwise — providing more accurate and actionable health information.

High Level Code Changes

proxy_agent_shared/src/service/windows_service.rs:

  • Made query_service_status public so it can be consumed by the new status-check logic.
  • Re-exported ServiceState as a public type for callers to pattern-match on.

proxy_agent_shared/src/service.rs:

  • Added a new check_service_status() function that returns a richer 4-tuple: (is_installed, log_message,
    Option, status_summary). The summary combines the runtime state and start type (e.g., "Running,
    AutoStart").
  • Re-exported ServiceState from the windows_service module.
  • Added a unit test (test_check_service_status) that validates the function against both a non-existent service and
    a freshly installed test service.

proxy_agent_extension/src/service_main.rs:

  • Updated report_ebpf_status() to call check_service_status instead of check_service_installed.
  • The substatus now reports Success/STATUS_CODE_OK only when both EbpfCore and NetEbpfExt are Running; otherwise it
    reports Error/STATUS_CODE_NOT_OK.
  • The formatted message now includes per-driver detail (e.g., "EbpfCore: Running, AutoStart, NetEbpfExt: Running,
    AutoStart").
  • Extended the existing test_get_status unit test to validate the new eBPF substatus content and status/code
    consistency.

Testing Done

Manually replaced the built ProxyAgentExt.exe in a VM and tested the following cases:

  1. Both stopped:
[{"version":"1.0","timestampUTC":"2026-03-30T23:09:31.281","status":{"name":"ProxyAgentVMExtension","operation":"Enable","configurationAppliedTime":"2026-03-30T23:09:31Z","status":"Transitioning","code":0,"formattedMessage":{"lang":"en-US","message":"Started ProxyAgent Extension Monitoring thread."},"substatus":[{"name":"ProxyAgentConnectionSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:09:31.2628404 +00:00:00"}},{"name":"ProxyAgentStatus","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:09:31.2628404 +00:00:00"}},{"name":"ProxyAgentFailedAuthenticationSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:09:31.2628404 +00:00:00"}},{"name":"EbpfStatus","status":"Error","code":4,"formattedMessage":{"lang":"en-US","message":"EbpfCore: Stopped, AutoStart, NetEbpfExt: Stopped, AutoStart"}}]}}]
  1. Both stopped and disabled:
[{"version":"1.0","timestampUTC":"2026-03-30T23:14:18.527","status":{"name":"ProxyAgentVMExtension","operation":"Enable","configurationAppliedTime":"2026-03-30T23:14:18Z","status":"Error","code":0,"formattedMessage":{"lang":"en-US","message":"Started ProxyAgent Extension Monitoring thread."},"substatus":[{"name":"ProxyAgentConnectionSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:14:18.5088976 +00:00:00"}},{"name":"ProxyAgentStatus","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:14:18.5088976 +00:00:00"}},{"name":"ProxyAgentFailedAuthenticationSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:14:18.5088976 +00:00:00"}},{"name":"EbpfStatus","status":"Error","code":4,"formattedMessage":{"lang":"en-US","message":"EbpfCore: Stopped, Disabled, NetEbpfExt: Stopped, Disabled"}}]}}]
  1. One service running and one stopped and disabled:
[{"version":"1.0","timestampUTC":"2026-03-30T23:17:34.847","status":{"name":"ProxyAgentVMExtension","operation":"Enable","configurationAppliedTime":"2026-03-30T23:17:34Z","status":"Error","code":0,"formattedMessage":{"lang":"en-US","message":"Started ProxyAgent Extension Monitoring thread."},"substatus":[{"name":"ProxyAgentConnectionSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:17:34.8289435 +00:00:00"}},{"name":"ProxyAgentStatus","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:17:34.8289435 +00:00:00"}},{"name":"ProxyAgentFailedAuthenticationSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:17:34.8289435 +00:00:00"}},{"name":"EbpfStatus","status":"Error","code":4,"formattedMessage":{"lang":"en-US","message":"EbpfCore: Running, AutoStart, NetEbpfExt: Stopped, Disabled"}}]}}]
  1. Both Services running:
[{"version":"1.0","timestampUTC":"2026-03-30T23:18:50.311","status":{"name":"ProxyAgentVMExtension","operation":"Enable","configurationAppliedTime":"2026-03-30T23:18:50Z","status":"Error","code":0,"formattedMessage":{"lang":"en-US","message":"Started ProxyAgent Extension Monitoring thread."},"substatus":[{"name":"ProxyAgentConnectionSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:18:50.2870472 +00:00:00"}},{"name":"ProxyAgentStatus","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:18:50.2870472 +00:00:00"}},{"name":"ProxyAgentFailedAuthenticationSummary","status":"Transitioning","code":4,"formattedMessage":{"lang":"en-US","message":"Proxy agent aggregate status file is stale. Status timestamp: 2026-03-27 17:34:09.831 +00:00:00, Current time: 2026-03-30 23:18:50.2870472 +00:00:00"}},{"name":"EbpfStatus","status":"Success","code":0,"formattedMessage":{"lang":"en-US","message":"EbpfCore: Running, AutoStart, NetEbpfExt: Running, AutoStart"}}]}}]

@srikrishnaveturi

srikrishnaveturi commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@srikrishnaveturi please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree

@srikrishnaveturi srikrishnaveturi enabled auto-merge (squash) March 31, 2026 18:59
auto-merge was automatically disabled March 31, 2026 21:26

Pull request was closed

@srikrishnaveturi srikrishnaveturi deleted the sveturi/dev branch March 31, 2026 21:26
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