File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1414from opentelemetry .sdk .trace .export import SpanExporter , SpanExportResult
1515
1616from humanloop .core import ApiError as HumanloopApiError
17- from humanloop .eval_utils .context import EvaluationContext
17+ from humanloop .eval_utils .context import EVALUATION_CONTEXT_VARIABLE_NAME , EvaluationContext
1818from humanloop .otel import TRACE_FLOW_CONTEXT , FlowContext
1919from humanloop .otel .constants import (
2020 HUMANLOOP_FILE_KEY ,
@@ -94,16 +94,20 @@ def is_evaluated_file(
9494 if is_humanloop_span (span ):
9595 # We pass the EvaluationContext from the eval_run utility thread to
9696 # the export thread so the .log action works as expected
97+ evaluation_context_copy = None
98+ for context_var , context_var_value in contextvars .copy_context ().items ():
99+ if context_var .name == EVALUATION_CONTEXT_VARIABLE_NAME :
100+ evaluation_context_copy = context_var_value
97101 self ._upload_queue .put (
98102 (
99103 span ,
100- copy . deepcopy ( evaluation_context ) ,
104+ evaluation_context_copy ,
101105 ),
102106 )
103107 logger .debug (
104108 "Span %s with EvaluationContext %s added to upload queue" ,
105109 span .attributes ,
106- copy . deepcopy ( evaluation_context ) ,
110+ evaluation_context_copy ,
107111 )
108112 # Reset the EvaluationContext so run eval does not
109113 # create a duplicate Log
You can’t perform that action at this time.
0 commit comments