msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Support babeltrace2 with fallback to babeltrace

Open Copilot opened this issue 10 months ago • 4 comments

This PR adds support for babeltrace2 while maintaining backward compatibility with babeltrace. Recent changes in lab environments have made babeltrace2 the default installation while babeltrace is no longer available by default.

Changes Made

Scripts Updated

  • scripts/log_wrapper.sh: Added detection logic to try babeltrace2 first, then fallback to babeltrace
  • scripts/log.ps1:
    • Added Get-BabeltraceCommand helper function for version detection
    • Updated all babeltrace invocations to use appropriate syntax for each version
  • scripts/prepare-machine.ps1: Modified installation to try babeltrace2 first with fallback to babeltrace

Documentation

  • docs/Diagnostics.md: Updated to mention both tools and provide usage examples for each

Implementation Details

The solution detects which babeltrace version is available and uses the appropriate command syntax:

# babeltrace2 (preferred)
babeltrace2 --names all <directory>

# babeltrace (fallback) 
babeltrace --names all <directory>

For PowerShell scripts, the implementation uses a helper function:

function Get-BabeltraceCommand {
    if (Get-Command babeltrace2 -ErrorAction SilentlyContinue) {
        return "babeltrace2"
    } elseif (Get-Command babeltrace -ErrorAction SilentlyContinue) {
        return "babeltrace"
    } else {
        throw "Neither babeltrace2 nor babeltrace is available"
    }
}

Backward Compatibility

All changes maintain full backward compatibility. Systems with only babeltrace installed will continue to work unchanged, while systems with babeltrace2 will automatically use the newer version.

Fixes #5048.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Jun 04 '25 15:06 Copilot

Our Build workflows are failing on Linux runs with the following:

prepare-machine.ps1: /home/runner/work/_temp/e5228a59-cbad-4f55-8f8a-76a143aba382.ps1:2
Line |
   2 |  scripts/prepare-machine.ps1 -ForBuild -Tls quictls
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The term '!sudo' is not recognized as a name of a cmdlet, function,
     | script file, or executable program. Check the spelling of the name, or
     | if a path was included, verify that the path is correct and try again.

nibanks avatar Jun 04 '25 16:06 nibanks

Our Build workflows are failing on Linux runs with the following:

prepare-machine.ps1: /home/runner/work/_temp/e5228a59-cbad-4f55-8f8a-76a143aba382.ps1:2

...

Fixed the PowerShell syntax error in prepare-machine.ps1. The issue was using bash-style ! and 2>/dev/null instead of proper PowerShell try-catch syntax. Commit 500db4c addresses this issue.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar Jun 04 '25 16:06 Copilot

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 85.34%. Comparing base (65660c4) to head (17648b2). :warning: Report is 118 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5141      +/-   ##
==========================================
- Coverage   87.38%   85.34%   -2.04%     
==========================================
  Files          59       59              
  Lines       18037    18605     +568     
==========================================
+ Hits        15761    15878     +117     
- Misses       2276     2727     +451     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 04 '25 17:06 codecov[bot]

There is commented script in scripts/run_endpoints.sh that refers to babeltrace cmds. Should this be updated or ignored or removed?

Rest looks good to me.

sm-msft avatar Jun 04 '25 18:06 sm-msft

There is commented script in scripts/run_endpoints.sh that refers to babeltrace cmds. Should this be updated or ignored or removed?

Rest looks good to me.

Updated the commented babeltrace commands in scripts/run_endpoint.sh to support babeltrace2 with fallback to babeltrace, following the same detection pattern used in other scripts. Commit ebef950 addresses this.

Copilot avatar Sep 04 '25 22:09 Copilot

@copilot Please address the open comments

Addressed both open comments: fixed the typo in BabelTraceFile variable name and removed the lttng live streaming comment block. Commit 21ed584 addresses these issues.

Copilot avatar Sep 06 '25 00:09 Copilot