Skip to content

Commit 2353292

Browse files
authored
Merge pull request #442 from Scale3-Labs/development
Release: hotfix for selfhosted langtrace
2 parents 3adae32 + 6480534 commit 2353292

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/langtrace_python_sdk/langtrace.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,23 @@ def get_headers(config: LangtraceConfig):
153153
return headers
154154

155155

156+
def append_api_path(host: str):
157+
if host == LANGTRACE_REMOTE_URL:
158+
return f"{host}/api/trace"
159+
if "localhost" in host:
160+
return host
161+
return f"{host}/v1/traces"
162+
163+
156164
def get_exporter(config: LangtraceConfig, host: str):
157165
if config.custom_remote_exporter:
158166
return config.custom_remote_exporter
159167

160168
headers = get_headers(config)
161169
exporter_protocol = os.environ.get("OTEL_EXPORTER_OTLP_PROTOCOL", "http")
162170
if "http" in exporter_protocol.lower():
163-
return HTTPExporter(
164-
endpoint=(
165-
f"{host}/api/trace"
166-
if host == LANGTRACE_REMOTE_URL
167-
else f"{host}/v1/traces"
168-
),
169-
headers=headers,
170-
)
171+
host = append_api_path(host)
172+
return HTTPExporter(endpoint=host, headers=headers)
171173
else:
172174
return GRPCExporter(endpoint=host, headers=headers)
173175

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.3.16"
1+
__version__ = "3.3.17"

0 commit comments

Comments
 (0)