diff --git a/CHANGELOG.md b/CHANGELOG.md index 279185dafa1..18b06465dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased - Fix exporting of ExponentialBucketHistogramAggregation from opentelemetry.sdk.metrics.view ([#3240](https://github.com/open-telemetry/opentelemetry-python/pull/3240)) - - Fix headers types mismatch for OTLP Exporters ([#3226](https://github.com/open-telemetry/opentelemetry-python/pull/3226)) - Fix suppress instrumentation for log batch processor ([#3223](https://github.com/open-telemetry/opentelemetry-python/pull/3223)) - - Add speced out environment variables and arguments for BatchLogRecordProcessor ([#3237](https://github.com/open-telemetry/opentelemetry-python/pull/3237)) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py index 02cf1b50d2c..4abf32f7b5b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py @@ -43,7 +43,7 @@ _DEFAULT_EXPORT_TIMEOUT_MILLIS = 30000 _DEFAULT_MAX_QUEUE_SIZE = 2048 _ENV_VAR_INT_VALUE_ERROR_MESSAGE = ( - "Unable to parse value for %s as integer. Defaulting to %s: %s" + "Unable to parse value for %s as integer. Defaulting to %s." ) _logger = logging.getLogger(__name__) @@ -182,15 +182,12 @@ def __init__( _DEFAULT_SCHEDULE_DELAY_MILLIS, ) ) - except ValueError as e: + except ValueError: schedule_delay_millis = _DEFAULT_SCHEDULE_DELAY_MILLIS - _logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BLRP_SCHEDULE_DELAY, - _DEFAULT_SCHEDULE_DELAY_MILLIS, - e, - ) + _logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BLRP_SCHEDULE_DELAY, + _DEFAULT_SCHEDULE_DELAY_MILLIS, ) if max_export_batch_size is None: @@ -201,15 +198,12 @@ def __init__( _DEFAULT_MAX_EXPORT_BATCH_SIZE, ) ) - except ValueError as e: + except ValueError: max_export_batch_size = _DEFAULT_MAX_EXPORT_BATCH_SIZE - _logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BLRP_SCHEDULE_DELAY, - _DEFAULT_MAX_EXPORT_BATCH_SIZE, - e, - ) + _logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BLRP_SCHEDULE_DELAY, + _DEFAULT_MAX_EXPORT_BATCH_SIZE, ) if export_timeout_millis is None: @@ -220,15 +214,12 @@ def __init__( _DEFAULT_EXPORT_TIMEOUT_MILLIS, ) ) - except ValueError as e: + except ValueError: export_timeout_millis = _DEFAULT_EXPORT_TIMEOUT_MILLIS - _logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BLRP_SCHEDULE_DELAY, - _DEFAULT_EXPORT_TIMEOUT_MILLIS, - e, - ) + _logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BLRP_SCHEDULE_DELAY, + _DEFAULT_EXPORT_TIMEOUT_MILLIS, ) if max_queue_size is None: @@ -238,11 +229,12 @@ def __init__( OTEL_BLRP_MAX_QUEUE_SIZE, _DEFAULT_MAX_QUEUE_SIZE ) ) - except ValueError as e: + except ValueError: max_queue_size = _DEFAULT_MAX_QUEUE_SIZE - _logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % (OTEL_BLRP_SCHEDULE_DELAY, _DEFAULT_MAX_QUEUE_SIZE, e) + _logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BLRP_SCHEDULE_DELAY, + _DEFAULT_MAX_QUEUE_SIZE, ) if max_queue_size <= 0: diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py index 67999237a81..28252a7d0e4 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py @@ -44,7 +44,7 @@ _DEFAULT_EXPORT_TIMEOUT_MILLIS = 30000 _DEFAULT_MAX_QUEUE_SIZE = 2048 _ENV_VAR_INT_VALUE_ERROR_MESSAGE = ( - "Unable to parse value for %s as integer. Defaulting to %s: %s" + "Unable to parse value for %s as integer. Defaulting to %s." ) logger = logging.getLogger(__name__) @@ -168,11 +168,12 @@ def __init__( OTEL_BSP_MAX_QUEUE_SIZE, _DEFAULT_MAX_QUEUE_SIZE ) ) - except ValueError as e: + except ValueError: max_queue_size = _DEFAULT_MAX_QUEUE_SIZE - logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % (OTEL_BSP_MAX_QUEUE_SIZE, _DEFAULT_MAX_QUEUE_SIZE, e) + logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BSP_MAX_QUEUE_SIZE, + _DEFAULT_MAX_QUEUE_SIZE, ) if schedule_delay_millis is None: @@ -182,15 +183,12 @@ def __init__( OTEL_BSP_SCHEDULE_DELAY, _DEFAULT_SCHEDULE_DELAY_MILLIS ) ) - except ValueError as e: + except ValueError: schedule_delay_millis = _DEFAULT_SCHEDULE_DELAY_MILLIS - logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BSP_SCHEDULE_DELAY, - _DEFAULT_SCHEDULE_DELAY_MILLIS, - e, - ) + logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BSP_SCHEDULE_DELAY, + _DEFAULT_SCHEDULE_DELAY_MILLIS, ) if max_export_batch_size is None: @@ -201,15 +199,12 @@ def __init__( _DEFAULT_MAX_EXPORT_BATCH_SIZE, ) ) - except ValueError as e: + except ValueError: max_export_batch_size = _DEFAULT_MAX_EXPORT_BATCH_SIZE - logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BSP_MAX_EXPORT_BATCH_SIZE, - _DEFAULT_MAX_EXPORT_BATCH_SIZE, - e, - ) + logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BSP_MAX_EXPORT_BATCH_SIZE, + _DEFAULT_MAX_EXPORT_BATCH_SIZE, ) if export_timeout_millis is None: @@ -219,15 +214,12 @@ def __init__( OTEL_BSP_EXPORT_TIMEOUT, _DEFAULT_EXPORT_TIMEOUT_MILLIS ) ) - except ValueError as e: + except ValueError: export_timeout_millis = _DEFAULT_EXPORT_TIMEOUT_MILLIS - logger.warning( - _ENV_VAR_INT_VALUE_ERROR_MESSAGE - % ( - OTEL_BSP_EXPORT_TIMEOUT, - _DEFAULT_EXPORT_TIMEOUT_MILLIS, - e, - ) + logger.exception( + _ENV_VAR_INT_VALUE_ERROR_MESSAGE, + OTEL_BSP_EXPORT_TIMEOUT, + _DEFAULT_EXPORT_TIMEOUT_MILLIS, ) if max_queue_size <= 0: