Skip to content
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

Fix support for skipping Go tracers #451

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/internal/discover/attacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ func (ta *TraceAttacher) getTracer(ie *Instrumentable) (*ebpf.ProcessTracer, boo
case svc.InstrumentableGolang:
// gets all the possible supported tracers for a go program, and filters out
// those whose symbols are not present in the ELF functions list
programs = filterNotFoundPrograms(newGoTracersGroup(ta.Cfg, ta.Metrics), ie.Offsets)
if ta.Cfg.Discovery.SkipGoSpecificTracers {
programs = newNonGoTracersGroup(ta.Cfg, ta.Metrics)
} else {
programs = filterNotFoundPrograms(newGoTracersGroup(ta.Cfg, ta.Metrics), ie.Offsets)
}
case svc.InstrumentableJava, svc.InstrumentableNodejs, svc.InstrumentableRuby, svc.InstrumentablePython, svc.InstrumentableDotnet, svc.InstrumentableGeneric, svc.InstrumentableRust:
// We are not instrumenting a Go application, we override the programs
// list with the generic kernel/socket space filters
Expand Down
1 change: 1 addition & 0 deletions test/integration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ services:
BEYLA_OPEN_PORT: "${BEYLA_OPEN_PORT}"
BEYLA_DISCOVERY_POLL_INTERVAL: 500ms
BEYLA_EXECUTABLE_NAME: "${BEYLA_EXECUTABLE_NAME}"
BEYLA_SKIP_GO_SPECIFIC_TRACERS: "${BEYLA_SKIP_GO_SPECIFIC_TRACERS}"
BEYLA_SERVICE_NAMESPACE: "integration-test"
BEYLA_METRICS_INTERVAL: "10ms"
BEYLA_BPF_BATCH_TIMEOUT: "10ms"
Expand Down
13 changes: 13 additions & 0 deletions test/integration/red_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ func testREDMetricsOldHTTP(t *testing.T) {
})
}
}

// this needs to be removed once we figure out why Gorilla async didn't work.
func testREDMetricsShortHTTP(t *testing.T) {
for _, testCaseURL := range []string{
instrumentedServiceStdURL,
} {
t.Run(testCaseURL, func(t *testing.T) {
waitForTestComponents(t, testCaseURL)
testREDMetricsForHTTPLibrary(t, testCaseURL, "testserver", "integration-test")
})
}
}

func testREDMetricsForHTTPLibrary(t *testing.T, url, svcName, svcNs string) {
path := "/basic/" + rndStr()

Expand Down
11 changes: 11 additions & 0 deletions test/integration/suites_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ func TestSuite_OldestGoVersion(t *testing.T) {
t.Run("BPF pinning folder unmounted", testBPFPinningUnmounted)
}

func TestSuite_SkipGoTracers(t *testing.T) {
compose, err := docker.ComposeSuite("docker-compose.yml", path.Join(pathOutput, "test-suite-skip-go-tracers.log"))
compose.Env = append(compose.Env, `BEYLA_SKIP_GO_SPECIFIC_TRACERS=1`)
require.NoError(t, err)
require.NoError(t, compose.Up())
t.Run("RED metrics", testREDMetricsShortHTTP)
t.Run("BPF pinning folder mounted", testBPFPinningMounted)
require.NoError(t, compose.Close())
t.Run("BPF pinning folder unmounted", testBPFPinningUnmounted)
}

func TestSuite_GRPCExport(t *testing.T) {
compose, err := docker.ComposeSuite("docker-compose.yml", path.Join(pathOutput, "test-suite-grpc-export.log"))
compose.Env = append(compose.Env, "INSTRUMENTER_CONFIG_SUFFIX=-grpc-export")
Expand Down