Skip to content

Commit 7183758

Browse files
committed
Fixed linting errors
1 parent 704d5fa commit 7183758

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def _setup_tracing(configurations: Dict[str, ConfigurationValue]):
145145
tracer_provider = TracerProvider(
146146
sampler=ApplicationInsightsSampler(sampling_ratio=cast(float, sampling_ratio)), resource=resource
147147
)
148-
149148

150149
for span_processor in configurations[SPAN_PROCESSORS_ARG]: # type: ignore
151150
tracer_provider.add_span_processor(span_processor) # type: ignore

sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ def _default_resource(configurations):
123123

124124
def _default_sampling_ratio(configurations):
125125
default = 1.0
126-
126+
127127
if environ.get(OTEL_TRACES_SAMPLER_ARG) is not None:
128128
try:
129129
if float(environ[OTEL_TRACES_SAMPLER_ARG]) < 0:
130130
_logger.error("Invalid value for OTEL_TRACES_SAMPLER_ARG. It should be a non-negative number.")
131-
except:
131+
except ValueError:
132132
pass
133133
else:
134134
_logger.error("OTEL_TRACES_SAMPLER_ARG is not set.")
@@ -161,8 +161,11 @@ def _default_sampling_ratio(configurations):
161161
else:
162162
# Default behavior - always set sampling_ratio
163163
configurations[SAMPLING_RATIO_ARG] = default
164-
_logger.error( # pylint: disable=C
165-
f"Invalid argument for the sampler to be used for tracing. Supported values are {RATE_LIMITED_SAMPLER} and {FIXED_PERCENTAGE_SAMPLER}. Defaulting to %s: %s",
164+
_logger.error(
165+
"Invalid argument for the sampler to be used for tracing. "
166+
"Supported values are %s and %s. Defaulting to %s: %s",
167+
RATE_LIMITED_SAMPLER,
168+
FIXED_PERCENTAGE_SAMPLER,
166169
OTEL_TRACES_SAMPLER,
167170
OTEL_TRACES_SAMPLER_ARG,
168171
)

0 commit comments

Comments
 (0)