Repository navigation
api/tools: Use the toolshed tap2pcap - #49392
Merged
Merged
Conversation
The tap2pcap tool shelled out to `od` and to Wireshark's `text2pcap`, and its test compared `tshark` output to a golden file. The CI image has neither tool, so the test only passed while its result was in the remote cache, and failed whenever its action key changed (eg a `rules_python` bump). `@envoy_toolshed//tap:defs.bzl` (envoyproxy/toolshed#5622) writes the PCAP in Python and is tested there, so the tool is now made from that with the v3 trace wrapper, and the test, its fixtures and its line in `do_ci.sh api` are removed. `bazel run @envoy_api//tools:tap2pcap` is unchanged for users, and no longer needs Wireshark. Signed-off-by: Ryan Northey <ryan@synca.io>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the migration to the toolshed tap-to-PCAP converter.
No open issues 🎉
What changed in this PR
Replaces Envoy’s tap-to-PCAP converter with the toolshed implementation, removing its dependency on external Wireshark utilities while preserving the documented Bazel command.
Changes:
- Uses the toolshed
tap2pcapmacro with the v3 trace wrapper. - Removes the local Python converter, Wireshark-dependent test, and fixtures.
- Removes the deleted test’s explicit invocation from API CI.
| File | Description |
|---|---|
ci/do_ci.sh |
Removes the explicit tap2pcap_test invocation. |
api/tools/tap2pcap.py |
Deletes the converter that invoked external utilities. |
api/tools/tap2pcap_test.py |
Deletes the Wireshark-dependent comparison test. |
api/tools/data/tap2pcap_h2_ipv4.txt |
Removes the test’s golden output. |
api/tools/data/tap2pcap_h2_ipv4.pb_text |
Removes the test’s input trace fixture. |
api/tools/BUILD |
Defines the converter through toolshed using v3 trace protos. |
Review effort: Balanced
phlax
marked this pull request as ready for review
November 18, 2026 14:35
jwendell
approved these changes
Nov 18, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
The `tap2pcap` tool (`@envoy_api//tools:tap2pcap`, from the traffic tapping docs) shelled out to `od` and to Wireshark's `text2pcap`, and its test compared `tshark` output to a golden file. The CI image has neither tool, so `@envoy_api//tools:tap2pcap_test` only passed while its result was in the remote cache: the API job reports "Executed 0 out of 5 tests". Anything that changes its action key runs it for real, and it fails with `FileNotFoundError: 'text2pcap'`, as on envoyproxy#49376 (a `rules_python` bump). `@envoy_toolshed//tap:defs.bzl` (envoyproxy/toolshed#5622, in `envoy_toolshed` 0.5.24.envoy from envoyproxy#49389) writes the PCAP in Python and is tested there. This makes the tool from that, with the v3 trace wrapper (`envoy.data.tap.v3`, where the old tool read the frozen `v2alpha` one), and removes `tap2pcap.py`, its test, the two fixtures, and the test's line in `do_ci.sh api`. For users `bazel run @envoy_api//tools:tap2pcap <tap .pb/.pb_text> <pcap path>` is unchanged, and no longer needs Wireshark installed. Other differences, from the toolshed implementation: IPv6 traces are written with correct headers (a known issue of the `text2pcap` path), `as_string` bodies are read as well as `as_bytes`, and a trace that is not a socket buffered trace is an error. Risk Level: Low (a developer tool and its test) Testing: These changes ran in CI on envoyproxy#49376 against a pre-release of the toolshed module, with a temporary target that converted the old `tap2pcap_h2_ipv4.pb_text` fixture with the new tool; the API job passed. The toolshed output for that fixture was also checked with `tshark` by hand: the same six HTTP/2 frames, lengths and times as the old golden file. Nothing in Envoy runs the tool after this change. Docs Changes: N/A (the documented command is unchanged) Release Notes: N/A Signed-off-by: Ryan Northey <ryan@synca.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
tap2pcaptool (@envoy_api//tools:tap2pcap, from the traffic tapping docs) shelled out toodand to Wireshark'stext2pcap, and its test comparedtsharkoutput to a golden file.The CI image has neither tool, so
@envoy_api//tools:tap2pcap_testonly passed while its result was in the remote cache: the API job reports "Executed 0 out of 5 tests". Anything that changes its action key runs it for real, and it fails withFileNotFoundError: 'text2pcap', as on #49376 (arules_pythonbump).@envoy_toolshed//tap:defs.bzl(envoyproxy/toolshed#5622, inenvoy_toolshed0.5.24.envoy from #49389) writes the PCAP in Python and is tested there. This makes the tool from that, with the v3 trace wrapper (envoy.data.tap.v3, where the old tool read the frozenv2alphaone), and removestap2pcap.py, its test, the two fixtures, and the test's line indo_ci.sh api.For users
bazel run @envoy_api//tools:tap2pcap <tap .pb/.pb_text> <pcap path>is unchanged, and no longer needs Wireshark installed. Other differences, from the toolshed implementation: IPv6 traces are written with correct headers (a known issue of thetext2pcappath),as_stringbodies are read as well asas_bytes, and a trace that is not a socket buffered trace is an error.Risk Level: Low (a developer tool and its test)
Testing: These changes ran in CI on #49376 against a pre-release of the toolshed module, with a temporary target that converted the old
tap2pcap_h2_ipv4.pb_textfixture with the new tool; the API job passed. The toolshed output for that fixture was also checked withtsharkby hand: the same six HTTP/2 frames, lengths and times as the old golden file. Nothing in Envoy runs the tool after this change.Docs Changes: N/A (the documented command is unchanged)
Release Notes: N/A