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

fixing systemwide command reporting #219

Merged
merged 1 commit into from
Jul 28, 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
5 changes: 4 additions & 1 deletion pkg/beyla/beyla.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ func (i *Instrumenter) FindTarget(ctx context.Context) error {
if err != nil {
return fmt.Errorf("can't find an instrument executable: %w", err)
}
if i.ctxInfo.ServiceName == "" {
// If system-wide tracing is set, we don't use the initially-found
// executable name as service name, as it might be anything.
// We'll use the service name as traced from eBPF
if i.ctxInfo.ServiceName == "" && !i.config.EBPF.SystemWide {
i.ctxInfo.ServiceName = i.tracer.ELFInfo.ExecutableName()
}
return nil
Expand Down
8 changes: 7 additions & 1 deletion pkg/internal/export/prom/prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ func labelNamesGRPC(cfg *PrometheusConfig) []string {
// by labelNamesGRPC
func (r *metricsReporter) labelValuesGRPC(span *transform.HTTPRequestSpan) []string {
// serviceNameKey, rpcMethodKey, rpcSystemGRPC, rpcGRPCStatusCodeKey
names := []string{r.cfg.ServiceName, span.Path, "grpc", strconv.Itoa(span.Status)}
// In some situations e.g. system-wide instrumentation, the global service name
// is empty and we need to take the name from the trace
var svcName = r.cfg.ServiceName
if svcName == "" {
svcName = span.ServiceName
}
names := []string{svcName, span.Path, "grpc", strconv.Itoa(span.Status)}
if r.cfg.ServiceNamespace != "" {
names = append(names, r.cfg.ServiceNamespace)
}
Expand Down
3 changes: 0 additions & 3 deletions test/integration/suites_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ func TestSuite_Java_PID(t *testing.T) {
// same as Test suite for java, but using the system_wide instrumentation
// TODO: Fix the service name, mimir seems to work with what we have, but not Prometheus
func TestSuite_Java_SystemWide(t *testing.T) {

t.Skip("this test fails in main tag. Skipping temporarily until we fix it ASAP")

compose, err := docker.ComposeSuite("docker-compose-java.yml", path.Join(pathOutput, "test-suite-java-system-wide.log"))
compose.Env = append(compose.Env, `SYSTEM_WIDE=TRUE`, `JAVA_EXECUTABLE_NAME=`, `JAVA_TEST_MODE=-native`)
require.NoError(t, err)
Expand Down