Trace Calls with OpenTelemetry¶
Enable distributed tracing for your QType applications using OpenTelemetry to monitor LLM calls, execution times, and data flow through Phoenix or other observability platforms.
QType YAML¶
Explanation¶
- telemetry: Top-level application configuration for observability
- id: Unique identifier for the telemetry sink
- provider: Telemetry backend (
Phoenix,Arize, orLangfuse) - endpoint: URL where OpenTelemetry traces are sent
Starting Phoenix¶
Before running your application, start the Phoenix server:
Phoenix will start on http://localhost:6006 where you can view traces and spans in real-time.
Complete Example¶
id: trace_example
description: Example of tracing QType application calls with OpenTelemetry to Phoenix
models:
- type: Model
id: nova
provider: aws-bedrock
model_id: amazon.nova-lite-v1:0
inference_params:
temperature: 0.7
max_tokens: 512
flows:
- type: Flow
id: classify_text
interface:
type: Complete
variables:
- id: text
type: text
- id: response
type: text
inputs:
- text
outputs:
- response
steps:
- id: classify
type: LLMInference
model: nova
system_message: "Classify the following text as positive, negative, or neutral. Respond with only one word."
inputs:
- text
outputs:
- response
telemetry:
id: phoenix_trace
provider: Phoenix
endpoint: http://localhost:6006/v1/traces
Run the example:
qtype run examples/observability_debugging/trace_with_phoenix.qtype.yaml --text "I love this product!"
Then open http://localhost:6006 in your browser to see the traced execution.
Complete Example for Arize Cloud¶
id: arize_trace_example
description: Example of tracing QType application calls with OpenTelemetry to Arize Cloud
auths:
- id: arize-auth
type: api_key
api_key: ${ARIZE_API_KEY}
- id: bedrock-auth
type: aws
region: us-east-1
models:
- type: Model
id: nova
provider: aws-bedrock
model_id: amazon.nova-lite-v1:0
auth: bedrock-auth
inference_params:
temperature: 0.7
max_tokens: 512
flows:
- type: Flow
id: classify_text
feedback:
type: thumbs
explanation: true
variables:
- id: text
type: text
- id: response
type: text
inputs:
- text
outputs:
- response
steps:
- id: classify
type: LLMInference
model: nova
system_message: "Classify the following text as positive, negative, or neutral. Respond with only one word."
inputs:
- text
outputs:
- response
telemetry:
id: arize-telemetry
provider: Arize
endpoint: https://otlp.arize.com/v1/traces
auth: arize-auth
args:
space_id: ${ARIZE_SPACE_ID}
project_name: qtype-classify-example