From c8d86ec31502b2237e9bb85be8e2bfbba1647012 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Mon, 8 Jul 2024 11:56:16 -0700 Subject: [PATCH 1/2] Add code comment about default Log attribute size --- opentelemetry-sdk/src/logs/log_emitter.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opentelemetry-sdk/src/logs/log_emitter.rs b/opentelemetry-sdk/src/logs/log_emitter.rs index c26b4f3af7..6fd862fff2 100644 --- a/opentelemetry-sdk/src/logs/log_emitter.rs +++ b/opentelemetry-sdk/src/logs/log_emitter.rs @@ -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 { From 8804a6d71024b92128658a414319f9521513fdc6 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Mon, 8 Jul 2024 12:44:09 -0700 Subject: [PATCH 2/2] fmt --- opentelemetry-sdk/src/logs/log_emitter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opentelemetry-sdk/src/logs/log_emitter.rs b/opentelemetry-sdk/src/logs/log_emitter.rs index 6fd862fff2..9914c7b408 100644 --- a/opentelemetry-sdk/src/logs/log_emitter.rs +++ b/opentelemetry-sdk/src/logs/log_emitter.rs @@ -40,8 +40,8 @@ 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 +// 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;