Skip to content

Commit b816365

Browse files
committed
add param
1 parent f7fb04f commit b816365

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Traceloop:
4848
@staticmethod
4949
def init(
5050
app_name: str = sys.argv[0],
51-
api_endpoint: Optional[str] = None,
51+
api_endpoint: str = "https://api.traceloop.com",
5252
api_key: Optional[str] = None,
5353
enabled: bool = True,
5454
headers: Dict[str, str] = {},
@@ -69,6 +69,7 @@ def init(
6969
block_instruments: Optional[Set[Instruments]] = None,
7070
image_uploader: Optional[ImageUploader] = None,
7171
span_postprocess_callback: Optional[Callable[[ReadableSpan], None]] = None,
72+
traceloop_backend: Optional[bool] = False,
7273
) -> Optional[Client]:
7374
if not enabled:
7475
TracerWrapper.set_disabled(True)
@@ -79,8 +80,8 @@ def init(
7980
)
8081
return
8182

82-
api_endpoint = api_endpoint or os.getenv("TRACELOOP_BASE_URL") or "https://api.traceloop.com"
83-
api_key = api_key or os.getenv("TRACELOOP_API_KEY")
83+
api_endpoint = os.getenv("TRACELOOP_BASE_URL") or api_endpoint
84+
api_key = os.getenv("TRACELOOP_API_KEY") or api_key
8485
Traceloop.__app_name = app_name
8586

8687
if not is_tracing_enabled():
@@ -180,7 +181,7 @@ def init(
180181
Traceloop.__logger_wrapper = LoggerWrapper(exporter=logging_exporter)
181182

182183
if (
183-
api_endpoint.find("traceloop") != -1
184+
(api_endpoint.find("traceloop.com") != -1 or traceloop_backend)
184185
and api_key
185186
and (exporter is None)
186187
and (processor is None)

0 commit comments

Comments
 (0)