Skip to content

Commit

Permalink
Backport grafana#451. Fix for skip go tracers.
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski committed Nov 20, 2023
1 parent 18dcad4 commit eb48c85
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
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

0 comments on commit eb48c85

Please sign in to comment.