Does openinference have an in memory span collector that I can use while running unit tests?
馃挕聽Hint: Mention RunLLM in the thread for followups.
馃挕聽Hint: Mention RunLLM in the thread for followups.
Unfortunately that doesn鈥檛 seem to work. I made sure that opentelemetry-sdk was the latest version according to pypi
Hey Ben M., it might be worth checking out our test suite for one our auto-instrumentors. https://github.com/Arize-ai/openinference/blob/72a6f06b4ea992a13ba0258ca593a1f7769[鈥n-openai/tests/openinference/instrumentation/openai/conftest.py
Thank you, Xander S.! That fixed me up. This is what I ended up with
if config.env != "test":
tracer = register(
project_name=config.phoenix_project_name,
endpoint=f"{config.phoenix_url}/v1/traces",
headers={"Authorization": f"Bearer {config.phoenix_api_key}"},
auto_instrument=True,
verbose=False,
batch=True,
).get_tracer(__name__)
else:
from opentelemetry.sdk.trace.export.in_memory_span_exporter import (
InMemorySpanExporter,
)
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from openinference.instrumentation import TracerProvider
in_memory_span_exporter = InMemorySpanExporter()
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(in_memory_span_exporter))
tracer = tracer_provider.get_tracer(__name__)