Skip to content

Commit 6436391

Browse files
committed
update
1 parent 3dd1243 commit 6436391

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cozeloop/integration/langchain/trace_callback.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from __future__ import annotations
55
import json
6-
import os
76
import time
87
import traceback
98
from typing import List, Dict, Union, Any, Optional, Callable, Protocol
@@ -326,11 +325,7 @@ def _new_flow_span(self, node_name: str, span_type: str, **kwargs: Any) -> Span:
326325
run_id = str(kwargs['run_id'])
327326
self.run_map[run_id] = Run(run_id, flow_span, span_type)
328327
# set runtime
329-
runtime_info = RuntimeInfo()
330-
scene = os.getenv('COZELOOP_SCENE')
331-
if scene:
332-
runtime_info.scene = scene
333-
flow_span.set_runtime(runtime_info)
328+
flow_span.set_runtime(RuntimeInfo())
334329
# set extra tags
335330
flow_span.set_tags(self._tags) # global tags
336331
try:

cozeloop/internal/trace/span.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: MIT
33

44
import logging
5+
import os
56
from abc import ABC
67
from typing import Dict, Any, List, Optional
78
from datetime import datetime
@@ -368,8 +369,10 @@ def set_start_time_first_resp(self, start_time_first_resp: int):
368369

369370
def set_runtime(self, runtime: Runtime) -> None:
370371
r = runtime
371-
if r.scene is None or r.scene == "":
372-
r.scene = V_SCENE_CUSTOM
372+
r.scene = V_SCENE_CUSTOM
373+
scene = os.getenv('COZELOOP_SCENE') # record scene from env
374+
if scene:
375+
r.scene = scene
373376
with self.lock:
374377
if self.system_tag_map is None:
375378
self.system_tag_map = {}

0 commit comments

Comments
 (0)