diff --git a/internal/resources/fetching/manager/manager.go b/internal/resources/fetching/manager/manager.go index edb282258a..60fce6a072 100644 --- a/internal/resources/fetching/manager/manager.go +++ b/internal/resources/fetching/manager/manager.go @@ -135,7 +135,7 @@ func (m *Manager) fetchSingle(ctx context.Context, k string, cycleMetadata cycle case context.DeadlineExceeded: return fmt.Errorf("fetcher %s reached a timeout after %v seconds", k, m.timeout.Seconds()) case context.Canceled: - return fmt.Errorf("fetcher %s was canceled", k) + return fmt.Errorf("fetcher %s %s", k, ctx.Err().Error()) default: return fmt.Errorf("fetcher %s failed with an unknown error: %v", k, ctx.Err()) } diff --git a/internal/resources/utils/clog/clog.go b/internal/resources/utils/clog/clog.go index 73079d5594..84b059befc 100644 --- a/internal/resources/utils/clog/clog.go +++ b/internal/resources/utils/clog/clog.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/elastic/elastic-agent-libs/logp" + "go.uber.org/zap" ) type Logger struct { @@ -50,6 +51,7 @@ func (l *Logger) With(args ...any) *Logger { } func NewLogger(selector string, options ...logp.LogOption) *Logger { + options = append(options, zap.AddCallerSkip(1)) logger := logp.NewLogger(selector).WithOptions(options...) return &Logger{logger} }