Skip to content

Commit

Permalink
Add code comment about default Log attribute size
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas committed Jul 8, 2024
1 parent 31a3491 commit c8d86ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions opentelemetry-sdk/src/logs/log_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub struct LoggerProvider {

/// Default logger name if empty string is provided.
const DEFAULT_COMPONENT_NAME: &str = "rust.opentelemetry.io/sdk/logger";
// According to a Go-specific study mentioned on https://go.dev/blog/slog,
// up to 5 attributes is the most common case. We have chosen 8 as the default
// capacity for attributes to avoid reallocation in common scenarios.
const PREALLOCATED_ATTRIBUTE_CAPACITY: usize = 8;

impl opentelemetry::logs::LoggerProvider for LoggerProvider {
Expand Down

0 comments on commit c8d86ec

Please sign in to comment.