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

Add doc-comment for SimpleLogProcessor and BatchLogProcessor #2468

Merged

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Dec 24, 2024

Changes

Inspired from SpanProcessor docs.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@lalitb lalitb requested a review from a team as a code owner December 24, 2024 13:22
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.1%. Comparing base (6e1032f) to head (36b7e2d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2468   +/-   ##
=====================================
  Coverage   77.1%   77.1%           
=====================================
  Files        124     124           
  Lines      23021   23021           
=====================================
  Hits       17771   17771           
  Misses      5250    5250           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

//! ## Types of Log Processors
//!
//! - **SimpleLogProcessor**: Forwards log records to the exporter immediately
//! after they are emitted. This processor is **synchronous** and is designed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure of the wording "synchronous" as it may not be understood.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll want to mention something closely related to this -
Exporter's Export() method is invoked in the same thread as the log is emitted. If exporter is OTLP/tonic, then this can work only if the provider was constructed in a tokio context?

//! - **SimpleLogProcessor**: Forwards log records to the exporter immediately
//! after they are emitted. This processor is **synchronous** and is designed
//! for debugging or testing purposes. It is **not suitable for production**
//! environments due to its lack of batching, performance optimizations, or support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last part(support for high throughput) is redundant and maybe omitted.

///
/// ```rust
/// use opentelemetry_sdk::logs::{SimpleLogProcessor, LoggerProvider};
/// use opentelemetry::global;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global is not required?

/// let exporter = InMemoryLogExporter::default(); // Replace with an actual exporter
/// let processor = BatchLogProcessor::builder(exporter)
/// .with_batch_config(
/// BatchConfigBuilder::default()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we really need BatchConfigBuilder ? Can we make them part of the BatchLogProcessorBuilder itself?
Not for this PR!

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good doc! I left some nits, good to be followed up later.

@cijothomas cijothomas merged commit 5b86b7f into open-telemetry:main Dec 24, 2024
21 checks passed
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 this pull request may close these issues.

2 participants