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

Exporter::force_flush() interface missing for Logs #2261

Open
lalitb opened this issue Oct 29, 2024 · 1 comment · May be fixed by #2276
Open

Exporter::force_flush() interface missing for Logs #2261

lalitb opened this issue Oct 29, 2024 · 1 comment · May be fixed by #2276

Comments

@lalitb
Copy link
Member

lalitb commented Oct 29, 2024

The logs specification requires that the exporter implements force_flush as described here: - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#forceflush-2. This function can be asynchronous, but if so, the exporter should offer a way to inform the provider of its status.

Apart from that, the force_flush() interface are different for traces and metrics:

Traces:

fn force_flush(&mut self) -> BoxFuture<'static, ExportResult> {

Metrics:

async fn force_flush(&self) -> MetricResult<()>;

Looking closer, both interfaces are indeed asynchronous. For traces, the interface returns a Future, making it naturally async, while for metrics, it’s defined using async fn. Although the difference isn’t major, the async fn approach in metrics does look cleaner, more straightforward interface.

@lalitb
Copy link
Member Author

lalitb commented Oct 29, 2024

As discussed with @ThomsonTan, the BatchLogProcessor::force_flush should:

  • Clear the current batch queue by exporting all logs in it (i.e., calling exporter::export).
  • Then, call exporter::force_flush() on the exporter.

The OTLP exporters don’t batch logs; they ensure logs are exported before the export() method returns, so their force_flush can remain empty.

@ThomsonTan ThomsonTan linked a pull request Nov 5, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant