Skip to content

Commit c53c5f1

Browse files
authored
Add code comment about default Log attribute size (#1914)
1 parent 31a3491 commit c53c5f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

opentelemetry-sdk/src/logs/log_emitter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ pub struct LoggerProvider {
4040

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

4548
impl opentelemetry::logs::LoggerProvider for LoggerProvider {

0 commit comments

Comments
 (0)