Skip to content

LoggerProvider::ForceFlush() doesn't return false on failed log exports #3075

@NickPoole

Description

@NickPoole

Describe your environment
Using OtlpGrpcLogRecordExporter or OtlpHttpLogRecordExporter log export failures are ignored at the LogRecordProcessor layer.
SimpleLogRecordProcessor has a comment that failures on LogRecordExporter::Export() should be surfaced, but BatchLogRecordProcessor just blindly calls LogRecordExporter::Export().
There's no programmatic way to ensure that logs are reaching their target destination and not being dropped from the LogRecordProcessor or LoggerProvider.

Steps to reproduce
Modify the https://github.com/open-telemetry/opentelemetry-cpp/blob/main/examples/otlp/http_log_main.cc example to call and report on the result of ForceFlush(), then run the example against an address that's not an OTLP endpoint. ForceFlush() will report true.

What is the expected behavior?
I was expecting ForceFlush() to report false if the LogRecordExporter::Export() call had failed.

What is the actual behavior?
ForceFlush() returns true regardless of the logs failing to export.

Additional context
Turning up the global logging level, it is possible to observe error events, but that's not the same as being able to check for successful logging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalebugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions