pkg/gadgets: Use CO-RE tracer and switch back to bcc for biolatency.
@@ -17,9 +17,12 @@ package biolatency
import (
"fmt"
+ log "github.com/sirupsen/logrus"
+
gadgetv1alpha1 "github.com/kinvolk/inspektor-gadget/pkg/apis/gadget/v1alpha1"
"github.com/kinvolk/inspektor-gadget/pkg/gadgets"
"github.com/kinvolk/inspektor-gadget/pkg/gadgets/biolatency/tracer"
+ coretracer "github.com/kinvolk/inspektor-gadget/pkg/gadgets/biolatency/tracer/core"
standardtracer "github.com/kinvolk/inspektor-gadget/pkg/gadgets/biolatency/tracer/standard"
)
@@ -92,11 +95,20 @@ func (t *Trace) Start(trace *gadgetv1alpha1.Trace) {
}
var err error
+ t.tracer, err = coretracer.NewTracer(trace.Spec.Node)
+ if err != nil {
+ trace.Status.OperationWarning = fmt.Sprint("failed to create core tracer. Falling back to standard one")
+
+ // fallback to standard tracer
+ log.Infof("Gadget %s: falling back to standard tracer. CO-RE tracer failed: %s",
+ trace.Spec.Gadget, err)
+
t.tracer, err = standardtracer.NewTracer(trace.Spec.Node)
if err != nil {
- trace.Status.OperationError = fmt.Sprintf("Failed to start: %s", err)
+ trace.Status.OperationError = fmt.Sprintf("failed to create tracer: %s", err)
return
}
+ }
t.started = true
trace.Status.Output = ""
