From a0116a211c35ce09549a7d1f4e9869d735f20915 Mon Sep 17 00:00:00 2001 From: Rishab Ramanathan Date: Fri, 11 Jul 2025 15:06:18 -0700 Subject: [PATCH 1/2] fix: improve tracing errors --- src/openlayer/lib/tracing/tracer.py | 45 ++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/openlayer/lib/tracing/tracer.py b/src/openlayer/lib/tracing/tracer.py index d27771ad..1824df97 100644 --- a/src/openlayer/lib/tracing/tracer.py +++ b/src/openlayer/lib/tracing/tracer.py @@ -1,19 +1,20 @@ """Module with the logic to create and manage traces and steps.""" -import time import asyncio +import contextvars import inspect import logging -import contextvars -from typing import Any, Dict, List, Tuple, Optional, Awaitable, Generator -from functools import wraps +import time +import traceback from contextlib import contextmanager +from functools import wraps +from typing import Any, Awaitable, Dict, Generator, List, Optional, Tuple -from . import enums, steps, traces -from .. import utils -from ..._client import Openlayer from ..._base_client import DefaultHttpxClient +from ..._client import Openlayer from ...types.inference_pipelines.data_stream_params import ConfigLlmData +from .. import utils +from . import enums, steps, traces logger = logging.getLogger(__name__) @@ -251,12 +252,14 @@ async def __anext__(self): # Initialize tracing on first iteration only if not self._trace_initialized: self._original_gen = func(*func_args, **func_kwargs) - self._step, self._is_root_step, self._token = _create_and_initialize_step( - step_name=step_name, - step_type=enums.StepType.USER_CALL, - inputs=None, - output=None, - metadata=None, + self._step, self._is_root_step, self._token = ( + _create_and_initialize_step( + step_name=step_name, + step_type=enums.StepType.USER_CALL, + inputs=None, + output=None, + metadata=None, + ) ) self._inputs = _extract_function_inputs( func_signature=func_signature, @@ -466,16 +469,25 @@ def _handle_trace_completion( ) if _publish: try: + inference_pipeline_id = inference_pipeline_id or utils.get_env_variable( + "OPENLAYER_INFERENCE_PIPELINE_ID" + ) client = _get_client() if client: client.inference_pipelines.data.stream( - inference_pipeline_id=inference_pipeline_id - or utils.get_env_variable("OPENLAYER_INFERENCE_PIPELINE_ID"), + inference_pipeline_id=inference_pipeline_id, rows=[trace_data], config=config, ) except Exception as err: # pylint: disable=broad-except - logger.error("Could not stream data to Openlayer %s", err) + logger.error(traceback.format_exc()) + logger.error( + "Could not stream data to Openlayer (pipeline_id: %s, base_url: %s)" + " Error: %s", + inference_pipeline_id, + client.base_url, + err, + ) else: logger.debug("Ending step %s", step_name) @@ -557,7 +569,6 @@ def _finalize_step_logging( # ----------------------------- Async generator specific functions ----------------------------- # - def _finalize_async_generator_step( step: steps.Step, token: Any, From cf59f5c8e6e6dafe7d47a5cb3dd6e07ec62543f2 Mon Sep 17 00:00:00 2001 From: Rishab Ramanathan Date: Fri, 11 Jul 2025 15:08:02 -0700 Subject: [PATCH 2/2] chore: add github PR template --- .github/pull_request_template.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..87d96ed8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +# Pull Request + +## Summary + + + +## Changes + + + +- [x] Change 1 + +## Context + + + +## Testing + + + +- [ ] Unit tests +- [ ] Manual testing +- [ ] Postman CI/CD +- [ ] Other (please specify) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy