diff --git a/service/extensions/extensions.go b/service/extensions/extensions.go index c8f632965ca..1ef73b08f1e 100644 --- a/service/extensions/extensions.go +++ b/service/extensions/extensions.go @@ -10,6 +10,7 @@ import ( "sort" "go.uber.org/multierr" + "go.uber.org/zap" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" @@ -46,6 +47,8 @@ func (bes *Extensions) Start(ctx context.Context, host component.Host) error { instanceID, component.NewPermanentErrorEvent(err), ) + // We log with zap.AddStacktrace(zap.DPanicLevel) to avoid adding the stack trace to the error log + extLogger.WithOptions(zap.AddStacktrace(zap.DPanicLevel)).Error("Failed to start extension", zap.Error(err)) return err } bes.telemetry.Status.ReportOKIfStarting(instanceID) diff --git a/service/internal/graph/graph.go b/service/internal/graph/graph.go index cbf7e8538c5..a25a04167cd 100644 --- a/service/internal/graph/graph.go +++ b/service/internal/graph/graph.go @@ -19,6 +19,7 @@ import ( "strings" "go.uber.org/multierr" + "go.uber.org/zap" "gonum.org/v1/gonum/graph" "gonum.org/v1/gonum/graph/simple" "gonum.org/v1/gonum/graph/topo" @@ -70,6 +71,7 @@ func Build(ctx context.Context, set Settings) (*Graph, error) { componentGraph: simple.NewDirectedGraph(), pipelines: make(map[component.ID]*pipelineNodes, len(set.PipelineConfigs)), instanceIDs: make(map[int64]*component.InstanceID), + telemetry: set.Telemetry, } for pipelineID := range set.PipelineConfigs { pipelines.pipelines[pipelineID] = &pipelineNodes{ @@ -423,6 +425,13 @@ func (g *Graph) StartAll(ctx context.Context, host component.Host, reporter stat instanceID, component.NewPermanentErrorEvent(compErr), ) + // We log with zap.AddStacktrace(zap.DPanicLevel) to avoid adding the stack trace to the error log + g.telemetry.Logger.WithOptions(zap.AddStacktrace(zap.DPanicLevel)). + Error("Failed to start component", + zap.Error(compErr), + zap.String("type", instanceID.Kind.String()), + zap.String("id", instanceID.ID.String()), + ) return compErr }