Skip to content

Support babeltrace2 with fallback to babeltrace #5141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 4, 2025

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 Copilot AI changed the title [WIP] Update to babeltrace2 Support babeltrace2 with fallback to babeltrace Jun 4, 2025
@Copilot Copilot AI requested a review from nibanks June 4, 2025 16:09
Copilot finished work on behalf of nibanks June 4, 2025 16:09
@nibanks
Copy link
Member

nibanks commented Jun 4, 2025

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.

Copy link
Contributor Author

Copilot AI commented Jun 4, 2025

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 finished work on behalf of nibanks June 4, 2025 16:27
@nibanks nibanks marked this pull request as ready for review June 4, 2025 16:41
@nibanks nibanks requested a review from a team as a code owner June 4, 2025 16:41
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.86%. Comparing base (65660c4) to head (500db4c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5141      +/-   ##
==========================================
- Coverage   87.38%   86.86%   -0.53%     
==========================================
  Files          59       59              
  Lines       18037    18037              
==========================================
- Hits        15761    15667      -94     
- Misses       2276     2370      +94     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@sm-msft
Copy link
Contributor

sm-msft commented Jun 4, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to babeltrace2
3 participants