Manual Instrumentation Issues: Spans Not Showing in Phoenix Dashboard
hi! i am trying to mix manual instrumentation my application with spans from llama-index, but on the phoenix dashboard none of my manual spans are showing up. i've peppered in dbg statements through open telemetry, and my manually created spans are being exported successfully (status code 204). i can see the llama-index spans but my manually createdspans do not show up at all.
# init code
def init_tracer(spawn_server: bool = True):
resource = Resource(attributes={ResourceAttributes.PROJECT_NAME: "viv4"})
tracer_provider = TracerProvider(resource=resource)
trace.set_tracer_provider(tracer_provider)
collector_endpoint = f"http://{get_env_host()}:{get_env_port()}/v1/traces"
span_exporter = OTLPSpanExporter(endpoint=collector_endpoint)
simple_span_processor = SimpleSpanProcessor(span_exporter=span_exporter)
trace.get_tracer_provider().add_span_processor(simple_span_processor)
LlamaIndexInstrumentor().instrument(tracer_provider=tracer_provider)
return trace.get_tracer(__name__)
# manual instrumentation
def run():
tracer = init_tracer()
span = tracer.start_span(
"apprun", attributes={SpanAttributes.OPENINFERENCE_SPAN_KIND: "CHAIN"}
)
with trace.use_span(span, end_on_exit=False):
# configures global state so the right embedding models, LLMs will be used by the agent
init_models()
span.set_attribute(SpanAttributes.INPUT_VALUE, "")
span.set_attribute(
SpanAttributes.INPUT_MIME_TYPE, OpenInferenceMimeTypeValues.TEXT.value
)
# creates all the tools to be used by the agent
tools = create_all_tools()
output = agent2.run(tools)
span.set_attribute(SpanAttributes.OUTPUT_VALUE, json.dumps(output.response))
span.set_attribute(
SpanAttributes.OUTPUT_MIME_TYPE, OpenInferenceMimeTypeValues.TEXT.value
)
span.end()what i would really like is for "apprun" to be a top level trace with all other spans underneath it
