Skip to content

Commit b12f865

Browse files
committed
remove unneccesary helper function
1 parent d7c6187 commit b12f865

File tree

1 file changed

+4
-8
lines changed
  • util/opentelemetry-util-genai/src/opentelemetry/util/genai

1 file changed

+4
-8
lines changed

util/opentelemetry-util-genai/src/opentelemetry/util/genai/generators.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,30 +269,26 @@ def _start_span_for_invocation(self, invocation: LLMInvocation):
269269
self.spans[invocation.run_id] = span_state
270270
yield span
271271

272-
def _finalize_invocation(self, invocation: LLMInvocation) -> None:
273-
"""End span(s) and record duration for the invocation."""
274-
self._end_span(invocation.run_id)
275-
276272
def finish(self, invocation: LLMInvocation):
277273
state = self.spans.get(invocation.run_id)
278274
if state is None:
279275
with self._start_span_for_invocation(invocation) as span:
280276
_apply_finish_attributes(span, invocation)
281-
self._finalize_invocation(invocation)
277+
self._end_span(invocation.run_id)
282278
return
283279

284280
span = state.span
285281
_apply_finish_attributes(span, invocation)
286-
self._finalize_invocation(invocation)
282+
self._end_span(invocation.run_id)
287283

288284
def error(self, error: Error, invocation: LLMInvocation):
289285
state = self.spans.get(invocation.run_id)
290286
if state is None:
291287
with self._start_span_for_invocation(invocation) as span:
292288
_apply_error_attributes(span, error)
293-
self._finalize_invocation(invocation)
289+
self._end_span(invocation.run_id)
294290
return
295291

296292
span = state.span
297293
_apply_error_attributes(span, error)
298-
self._finalize_invocation(invocation)
294+
self._end_span(invocation.run_id)

0 commit comments

Comments
 (0)