This is an update / followup for last weeks post on OpenTelemetry LLM App Tracing with Phoenix which ended with following statement:
because I noticed some span exporting issues to Phoenix I tried a different span/traces exporter:
ZipkinExporter
with the Zipkin UI and there is still an open discussion on GitHub about the problems I noticed with Phoenix. Will update this post accordingly.
After further debugging (breaking at every single span.end()
call) I was able to see that during several span creations, the error Exception has occurred: Error: read ECONNRESET
and Exception has occurred: Error: socket hang up
were thrown. Exactly these spans were missing in Phoenix. Roger Yang suggested to use the experimental gRPC exporter like this:
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
const provider = new NodeTracerProvider({
spanProcessors: [
new SimpleSpanProcessor(
new OTLPTraceExporter({
url: "http://localhost:4317",
}),
),
],
});
registerInstrumentations({
instrumentations: [new OpenAIInstrumentation()],
});
provider.register();
This exports spans directly via gRPC to port 4317
of your Phoenix app. Make sure to use the Docker images provided by Phoenix which automatically expose this port next to the default 6006
port.
With the above exporter configured, no spans go missing anymore and even complex long running traces are captured nicely.