Skip to content

Commit 89ee998

Browse files
galkleinmannirga
andauthored
fix(sdk): avoid initializing metrics exporter on custom tracing config (#3249)
Co-authored-by: Nir Gazit <[email protected]>
1 parent 248b3d2 commit 89ee998

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/traceloop-sdk/traceloop/sdk/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ def init(
154154
span_postprocess_callback=span_postprocess_callback,
155155
)
156156

157-
if not is_metrics_enabled() or not metrics_exporter and exporter:
157+
metrics_disabled_by_config = not is_metrics_enabled()
158+
has_custom_spans_pipeline = processor or exporter
159+
custom_trace_without_custom_metrics = has_custom_spans_pipeline and not metrics_exporter
160+
161+
if metrics_disabled_by_config or custom_trace_without_custom_metrics:
158162
print(Fore.YELLOW + "Metrics are disabled" + Fore.RESET)
159163
else:
160164
metrics_endpoint = os.getenv("TRACELOOP_METRICS_ENDPOINT") or api_endpoint

0 commit comments

Comments
 (0)