Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
fix(observability): don't let an unreachable telemetry collector down the app
Sergey Kozyrenkod6fa58e5d48e
diff --git a/backend/cmd/pentagi/main.go b/backend/cmd/pentagi/main.goindex 1cebf233..046476b3 100644--- a/backend/cmd/pentagi/main.go+++ b/backend/cmd/pentagi/main.go@@ -57,14 +57,18 @@ func main() {logrus.SetLevel(logrus.InfoLevel)}+ // Telemetry is optional: degrade to a no-op observer on init failure instead+ // of killing the process, so an unreachable collector can't take the app down.lfclient, err := obs.NewLangfuseClient(ctx, cfg)if err != nil && !errors.Is(err, obs.ErrNotConfigured) {- log.Fatalf("Unable to create langfuse client: %v\n", err)+ logrus.WithError(err).Warn("langfuse telemetry disabled: client init failed")+ lfclient = nil}otelclient, err := obs.NewTelemetryClient(ctx, cfg)if err != nil && !errors.Is(err, obs.ErrNotConfigured) {- log.Fatalf("Unable to create telemetry client: %v\n", err)+ logrus.WithError(err).Warn("opentelemetry disabled: client init failed")+ otelclient = nil}obs.InitObserver(ctx, lfclient, otelclient, []logrus.Level{diff --git a/backend/pkg/observability/otelclient.go b/backend/pkg/observability/otelclient.goindex b48c9e48..e159bccc 100644--- a/backend/pkg/observability/otelclient.go+++ b/backend/pkg/observability/otelclient.go@@ -32,6 +32,7 @@ const (DefaultMetricTimeout = time.Second * 10DefaultTraceInterval = time.Second * 30DefaultTraceTimeout = time.Second * 10+ DefaultDialTimeout = time.Second * 10)type TelemetryClient interface {@@ -100,8 +101,13 @@ func NewTelemetryClient(ctx context.Context, cfg *config.Config) (TelemetryCliengrpc.WithTransportCredentials(insecure.NewCredentials()),}+ // Bound the blocking dial so a set-but-unreachable collector can't hang+ // startup forever (the signal context has no deadline).+ dialCtx, cancel := context.WithTimeout(ctx, DefaultDialTimeout)+ defer cancel()+conn, err := grpc.DialContext(- ctx,+ dialCtx,cfg.TelemetryEndpoint,opts...,)