Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NickPoole opened this issue Oct 1, 2024 · 2 comments
Open
Labels
bug Something isn't working Stale triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@NickPoole
Copy link

NickPoole commented Oct 1, 2024

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.

@NickPoole NickPoole added the bug Something isn't working label Oct 1, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 1, 2024
@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 2, 2024
@owent
Copy link
Member

owent commented Oct 7, 2024

According to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#forceflush-1 we can use callback or a event to notify users the result of exporting. It may changes ABI, should we discuss how to implement it? @open-telemetry/cpp-approvers @open-telemetry/cpp-maintainers

Copy link

github-actions bot commented Dec 8, 2024

This issue was marked as stale due to lack of activity.

@github-actions github-actions bot added the Stale label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants