Skip to content

Commit 3eb0dcd

Browse files
committed
Ensure non-null check for attribute
1 parent d14d515 commit 3eb0dcd

File tree

1 file changed

+1
-1
lines changed
  • src/langtrace_python_sdk/instrumentation/dspy

1 file changed

+1
-1
lines changed

src/langtrace_python_sdk/instrumentation/dspy/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def traced_method(wrapped, instance, args, kwargs):
5050
),
5151
}
5252
span_attributes["dspy.optimizer.module.prog"] = json.dumps(prog)
53-
if hasattr(instance, "metric"):
53+
if hasattr(instance, "metric") and getattr(instance, "metric") is not None:
5454
span_attributes["dspy.optimizer.metric"] = getattr(
5555
instance, "metric"
5656
).__name__

0 commit comments

Comments
 (0)