open-telemetry / open-telemetry/opentelemetry-cpp

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

Open
#3,075 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale triage/accepted
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/otlp/http_log_main.cc and trace LoggerProvider::ForceFlush() through LogRecordProcessor, SimpleLogRecordProcessor, and BatchLogRecordProcessor. Reproduce the behavior against a non-OTLP endpoint, then verify that ForceFlush() reports false when LogRecordExporter::Export() fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.