diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f2b77a0728..4b94cc4a29e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ - Deprecate `service.ConfigServiceTelemetry`, `service.ConfigServiceTelemetryLogs`, and `service.ConfigServiceTelemetryMetrics` (#5565) +### 💡 Enhancements 💡 + +- `exporter/logging`: Skip "bad file descriptor" sync errors (#5585) + ### 🧰 Bug fixes 🧰 - Fix initialization of the OpenTelemetry MetricProvider. (#5571) diff --git a/exporter/loggingexporter/known_sync_error.go b/exporter/loggingexporter/known_sync_error.go index 86c8b6a11da..76ececa30a7 100644 --- a/exporter/loggingexporter/known_sync_error.go +++ b/exporter/loggingexporter/known_sync_error.go @@ -22,15 +22,25 @@ import ( "syscall" ) +var knownSyncErrors = []error{ + // sync /dev/stdout: invalid argument + syscall.EINVAL, + // sync /dev/stdout: not supported + syscall.ENOTSUP, + // sync /dev/stdout: inappropriate ioctl for device + syscall.ENOTTY, + // sync /dev/stdout: bad file descriptor + syscall.EBADF, +} + // knownSyncError returns true if the given error is one of the known -// non-actionable errors returned by Sync on Linux and macOS: -// -// Linux: -// - sync /dev/stdout: invalid argument -// -// macOS: -// - sync /dev/stdout: inappropriate ioctl for device -// +// non-actionable errors returned by Sync on Linux and macOS. func knownSyncError(err error) bool { - return errors.Is(err, syscall.EINVAL) || errors.Is(err, syscall.ENOTSUP) || errors.Is(err, syscall.ENOTTY) + for _, syncError := range knownSyncErrors { + if errors.Is(err, syncError) { + return true + } + } + + return false }