Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Callable
from typing import Callable, Optional


class Config:
exception_logger = None
use_legacy_attributes = True
upload_base64_image: Callable[[str, str, str, str], str] = (
lambda trace_id, span_id, image_name, base64_string: str
)
# Set by instrumentor only when a real image uploader is provided (e.g.,
# Traceloop cloud). None by default — image processing is skipped when no
# uploader is configured, avoiding KeyError on non-Traceloop endpoints.
upload_base64_image: Optional[Callable[[str, str, str, str], str]] = None
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ class Config:
enrich_assistant = False
exception_logger = None
get_common_metrics_attributes: Callable[[], dict] = lambda: {}
upload_base64_image: Callable[[str, str, str, str], str] = (
lambda trace_id, span_id, image_name, base64_string: str
)
upload_base64_image: Optional[Callable[[str, str, str, str], str]] = None
enable_trace_context_propagation: bool = True
use_legacy_attributes = True
event_logger: Optional[Logger] = None
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import Callable
from typing import Callable, Optional


class Config:
exception_logger = None
use_legacy_attributes = True
upload_base64_image: Callable[[str, str, str, str], str] = (
lambda trace_id, span_id, image_name, base64_string: str
)
upload_base64_image: Optional[Callable[[str, str, str, str], str]] = None
4 changes: 3 additions & 1 deletion packages/traceloop-sdk/traceloop/sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ def init(
exporter=exporter,
sampler=sampler,
should_enrich_metrics=should_enrich_metrics,
image_uploader=image_uploader or ImageUploader(api_endpoint, api_key),
image_uploader=image_uploader or (
ImageUploader(api_endpoint, api_key) if endpoint_is_traceloop else None
),
instruments=instruments,
block_instruments=block_instruments,
span_postprocess_callback=span_postprocess_callback,
Expand Down
2 changes: 1 addition & 1 deletion packages/traceloop-sdk/traceloop/sdk/tracing/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def chained_on_start(span, parent_context=None, orig=original_on_start):

init_instrumentations(
should_enrich_metrics,
image_uploader.aupload_base64_image,
image_uploader.aupload_base64_image if image_uploader else None,
instruments,
block_instruments,
)
Expand Down
Loading