From 9534fbb7fb29c95149c7920a8897c15f5d9ff546 Mon Sep 17 00:00:00 2001
From: Antonio Jimenez <antonjim@cisco.com>
Date: Thu, 27 Jul 2023 16:43:12 +0200
Subject: [PATCH] Apply PR feedback

---
 exporter/exporterhelper/README.md   | 4 ++--
 exporter/exporterhelper/common.go   | 5 ++---
 exporter/otlpexporter/config.go     | 9 ++++-----
 exporter/otlphttpexporter/README.md | 4 ++--
 exporter/otlphttpexporter/config.go | 9 ++++-----
 5 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/exporter/exporterhelper/README.md b/exporter/exporterhelper/README.md
index 267e6759667..6642305d32c 100644
--- a/exporter/exporterhelper/README.md
+++ b/exporter/exporterhelper/README.md
@@ -24,8 +24,8 @@ The following configuration options can be modified:
       [the batch processor](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor)
       is used, the metric `batch_send_size` can be used for estimation)
 - `timeout` (default = 5s): Time to wait per individual attempt to send data to a backend
-- `sampled_logger`: Enables/disables sampling of logging messages, which caps the CPU and I/O load of logging while keeping a representative subset of your logs.
-  - `enabled` (default = true)
+- `sampled_logger`: Enables/disables sampling of logging messages.
+  - `enabled` (default = true). When setting `debug` log level the sampling will be disabled regardless of the value of this property.
 
 The `initial_interval`, `max_interval`, `max_elapsed_time`, and `timeout` options accept 
 [duration strings](https://pkg.go.dev/time#ParseDuration),
diff --git a/exporter/exporterhelper/common.go b/exporter/exporterhelper/common.go
index 5ba4de32729..e648ee252c8 100644
--- a/exporter/exporterhelper/common.go
+++ b/exporter/exporterhelper/common.go
@@ -27,10 +27,9 @@ func NewDefaultTimeoutSettings() TimeoutSettings {
 	}
 }
 
-// SampledLoggerSettings configures the logger sampler, which caps the CPU and I/O load of logging while keeping a representative subset of your logs.
-// Its purpose is to balance between the need for comprehensive logging and the potential performance impact of logging too much data.
+// SampledLoggerSettings configures the logger sampler.
 type SampledLoggerSettings struct {
-	// Enable/disable the sampledLogger
+	// Enable/disable the sampledLogger. When setting `debug` log level the sampling will be disabled regardless of the value of this property.
 	Enabled bool `mapstructure:"enabled"`
 }
 
diff --git a/exporter/otlpexporter/config.go b/exporter/otlpexporter/config.go
index a255de9922b..54a38f19406 100644
--- a/exporter/otlpexporter/config.go
+++ b/exporter/otlpexporter/config.go
@@ -13,12 +13,11 @@ import (
 
 // Config defines configuration for OTLP exporter.
 type Config struct {
-	exporterhelper.TimeoutSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
-	exporterhelper.QueueSettings   `mapstructure:"sending_queue"`
-	exporterhelper.RetrySettings   `mapstructure:"retry_on_failure"`
-
-	configgrpc.GRPCClientSettings        `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
+	exporterhelper.TimeoutSettings       `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
+	exporterhelper.QueueSettings         `mapstructure:"sending_queue"`
+	exporterhelper.RetrySettings         `mapstructure:"retry_on_failure"`
 	exporterhelper.SampledLoggerSettings `mapstructure:"sampled_logger"`
+	configgrpc.GRPCClientSettings        `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
 }
 
 var _ component.Config = (*Config)(nil)
diff --git a/exporter/otlphttpexporter/README.md b/exporter/otlphttpexporter/README.md
index 58c476d7349..6c5d59806b9 100644
--- a/exporter/otlphttpexporter/README.md
+++ b/exporter/otlphttpexporter/README.md
@@ -31,8 +31,8 @@ The following settings can be optionally configured:
 - `timeout` (default = 30s): HTTP request time limit. For details see https://golang.org/pkg/net/http/#Client
 - `read_buffer_size` (default = 0): ReadBufferSize for HTTP client.
 - `write_buffer_size` (default = 512 * 1024): WriteBufferSize for HTTP client.
-- `sampled_logger`: Enables/disables sampling of logging messages, which caps the CPU and I/O load of logging while keeping a representative subset of your logs.
-    - `enabled` (default = true)
+- `sampled_logger`: Enables/disables sampling of logging messages.
+    - `enabled` (default = true). When setting `debug` log level the sampling will be disabled regardless of the value of this property.
 
 Example:
 
diff --git a/exporter/otlphttpexporter/config.go b/exporter/otlphttpexporter/config.go
index dce222046d7..2c2dee71cb0 100644
--- a/exporter/otlphttpexporter/config.go
+++ b/exporter/otlphttpexporter/config.go
@@ -13,9 +13,10 @@ import (
 
 // Config defines configuration for OTLP/HTTP exporter.
 type Config struct {
-	confighttp.HTTPClientSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
-	exporterhelper.QueueSettings  `mapstructure:"sending_queue"`
-	exporterhelper.RetrySettings  `mapstructure:"retry_on_failure"`
+	confighttp.HTTPClientSettings        `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
+	exporterhelper.QueueSettings         `mapstructure:"sending_queue"`
+	exporterhelper.RetrySettings         `mapstructure:"retry_on_failure"`
+	exporterhelper.SampledLoggerSettings `mapstructure:"sampled_logger"`
 
 	// The URL to send traces to. If omitted the Endpoint + "/v1/traces" will be used.
 	TracesEndpoint string `mapstructure:"traces_endpoint"`
@@ -25,8 +26,6 @@ type Config struct {
 
 	// The URL to send logs to. If omitted the Endpoint + "/v1/logs" will be used.
 	LogsEndpoint string `mapstructure:"logs_endpoint"`
-
-	exporterhelper.SampledLoggerSettings `mapstructure:"sampled_logger"`
 }
 
 var _ component.Config = (*Config)(nil)