From 81e051663c6e37eaf79791302463257141ca8d2c Mon Sep 17 00:00:00 2001 From: James Baskerville Date: Wed, 2 Apr 2025 17:13:36 +0100 Subject: [PATCH] fix: Only try to export Humanloop spans --- pyproject.toml | 2 +- src/humanloop/core/client_wrapper.py | 2 +- src/humanloop/otel/exporter/__init__.py | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 101c57dd..f46a1aaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "humanloop" [tool.poetry] name = "humanloop" -version = "0.8.29" +version = "0.8.29b1" description = "" readme = "README.md" authors = [] diff --git a/src/humanloop/core/client_wrapper.py b/src/humanloop/core/client_wrapper.py index 01b7607d..ce08a630 100644 --- a/src/humanloop/core/client_wrapper.py +++ b/src/humanloop/core/client_wrapper.py @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "humanloop", - "X-Fern-SDK-Version": "0.8.29", + "X-Fern-SDK-Version": "0.8.29b1", } headers["X-API-KEY"] = self.api_key return headers diff --git a/src/humanloop/otel/exporter/__init__.py b/src/humanloop/otel/exporter/__init__.py index 4dcb3523..561d4b1f 100644 --- a/src/humanloop/otel/exporter/__init__.py +++ b/src/humanloop/otel/exporter/__init__.py @@ -21,6 +21,8 @@ ) from humanloop.otel.exporter.proto import serialize_span from humanloop.otel.helpers import ( + is_humanloop_span, + is_llm_provider_call, read_from_opentelemetry_span, write_to_opentelemetry_span, ) @@ -71,9 +73,14 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult: return SpanExportResult.FAILURE for span in spans: + # only process spans that are relevant to Humanloop + if not is_humanloop_span(span) or not is_llm_provider_call(span): + continue + file_type = span.attributes.get(HUMANLOOP_FILE_TYPE_KEY) # type: ignore [union-attr] if file_type is None: - raise HumanloopRuntimeError("Internal error: Span does not have type set") + logger.error("Internal error: Humanloop span does not have file type set") + continue try: log_args = read_from_opentelemetry_span(