in instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/wrappers.py [0:0]
def __iter__(self):
stream = self.__wrapped__
try:
for chunk in stream:
self.process_chunk(chunk)
yield chunk
except Exception as exc:
self.end(exc)
raise
self.end()