Skip to content

Conversation

@ddelnano
Copy link
Member

@ddelnano ddelnano commented Jun 10, 2025

Summary: Move test demo apps out of Bazel to ease Go version deprecation and support testing offsetgen instrumentation

This change is intended to help in two areas. The first is to decouple stirling's go version test matrix from Pixie's Go build. Our test suite currently builds all its go binaries with bazel, which means Pixie's go dependencies must accommodate all go versions used in our tests. This slows down upgrading our dependencies and go version.

The second is that in order to facilitate more memory efficient Go uprobes. I've implemented an opentelemetry-go-instrumentation offsetgen based version in #2207, #2212, pixie-io/opentelemetry-go-instrumentation#1. This instrumentation works by computing Go struct and function argument offsets ahead of time (avoiding expensive DWARF parsing at runtime) and applying the correct offset based on a binary's buildinfo. Unfortunately rules_go does not yet support populating the buildinfo section like the standard Go toolchain. We can eventually switch to this once it's implemented (bazel-contrib/rules_go#3090), but until then these images can serve an additional purpose.

Relevant Issues: N/A

Type of change: /kind feature

Test Plan: Verified the following:

  • Verified both images build for all the Go versions specified
  • Integrated images built from this branch into http2_trace_bpf_test and go_tls_trace_bpf_test. These work for the existing DWARF based uprobes and the offsetgen based ones

@ddelnano ddelnano requested review from a team as code owners June 10, 2025 16:41
Comment on lines -35 to -37
"@com_github_sirupsen_logrus//:logrus",
"@com_github_spf13_pflag//:pflag",
"@com_github_spf13_viper//:viper",
Copy link
Member Author

@ddelnano ddelnano Jun 10, 2025

Choose a reason for hiding this comment

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

These were removed to make the Dockerfile logic as simple as possible. By removing additional dependencies, the Dockerfile only needs to run a single go get (two in the case of go_grpc_tls_pl)

COPY greetpb greetpb
RUN go mod init px.dev/pixie/src/stirling/testing/demo_apps/go_grpc_tls_pl/server && \
go get google.golang.org/grpc@${GOOGLE_GOLANG_GRPC} && \
go get github.com/gogo/protobuf/proto && \
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be removed if the greetpb package didn't use gogo. I tried to make this change, but it appears that Pixie's go_proto_library hardcodes the gogo compiler.

Since gogo is deprecated, my assumption is that this won't break for older go versions (go get always fetches the newest version and won't install an older, compatible version)

Comment on lines -28 to -29
"@com_github_spf13_pflag//:pflag",
"@com_github_spf13_viper//:viper",
Copy link
Member Author

Choose a reason for hiding this comment

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

As mentioned above, any non essential packages were removed to make the Dockerfile logic as simple as possible.

Comment on lines 19 to 25
declare -A GO_VERSIONS=(
["1.18"]="v0.35.0"
["1.19"]="v0.35.0"
["1.20"]="v0.35.0"
["1.21"]="v0.35.0"
["1.22"]="v0.35.0"
)
Copy link
Member Author

Choose a reason for hiding this comment

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

The bulk of this shell script logic could be refactored to a single file. That would allow us to consolidate the go version to dependency mapping for both golang.org/x/net and google.golang.org/grpc. I wanted to get some feedback on this direction before doing so, but thought that would be something to include in this PR.

@ddelnano ddelnano force-pushed the ddelnano/add-go-offsetgen-compatible-images branch from 2117bfa to 6e4f8c0 Compare June 10, 2025 16:49
…ns and for offsetgen testing

Signed-off-by: Dom Del Nano <[email protected]>
@ddelnano ddelnano force-pushed the ddelnano/add-go-offsetgen-compatible-images branch from 6e4f8c0 to f7355b6 Compare June 10, 2025 20:05
ddelnano added 2 commits June 16, 2025 13:37
Signed-off-by: Dom Del Nano <[email protected]>
Signed-off-by: Dom Del Nano <[email protected]>
@ddelnano ddelnano merged commit 3cc2cc1 into pixie-io:main Jul 2, 2025
27 checks passed
@ddelnano ddelnano deleted the ddelnano/add-go-offsetgen-compatible-images branch July 3, 2025 00:36
ddelnano added a commit that referenced this pull request Jul 17, 2025
Summary: Remove unused bazel go sdks in favor of docker build images

#2217 introduced a mechanism for building stirling's test demo apps
outside of bazel. This allows us to decouple our test build dependencies
from Pixie's own Go dependencies and also aids in testing the upcoming
low memory Go uprobes (see that PR for a more detailed description).

Relevant Issues: N/A

Type of change: /kind cleanup

Test Plan: Existing tests pass

---------

Signed-off-by: Dom Del Nano <[email protected]>
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