Skip to content

api/tools: Use the toolshed tap2pcap - #49392

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:api-tools-toolshed-tap2pcap
Nov 18, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:api-tools-toolshed-tap2pcap

Conversation

@phlax

@phlax phlax commented Nov 18, 2026

Copy link
Copy Markdown
Member

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 #49376 (a rules_python bump).

@envoy_toolshed//tap:defs.bzl (envoyproxy/toolshed#5622, in envoy_toolshed 0.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 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 #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

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>
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #49392 was opened by phlax.

see: more, trace.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 tap2pcap macro 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 phlax changed the title [WIP] api/tools: Use the toolshed tap2pcap api/tools: Use the toolshed tap2pcap Nov 18, 2026
@phlax
phlax marked this pull request as ready for review November 18, 2026 14:35
@phlax
phlax merged commit c111365 into envoyproxy:main Nov 18, 2026
28 checks passed
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>
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.

3 participants