Hi, I am having my agent deployed as a docker. And I have 2 instances of my agent, and I want to export the traces from the 2 docker container. Is there a example on how to setup my docker containers so that it can send the traces to the pheonix collector ? Also, I want to deploy pheonix as a standalone docker and expose the Endpoint. Please, can someone point me to a example?
To set up your Docker containers to send traces to a Phoenix collector and deploy Phoenix as a standalone Docker container, follow these steps: 1. Deploy Phoenix as a Standalone Docker Container: - Pull the Phoenix Docker image and run it, exposing the necessary ports:
```LBKS - This command will start the Phoenix server, exposing port 6006 for the UI and OTLP HTTP collector, and port 4317 for the OTLP gRPC collector ([source](https://docs.arize.com/phoenix/deployment/deploying-phoenix#03132250edec410c927a4cdc4fff90fe)).LBKS2. **Configure Your Agent Docker Containers to Send Traces**:
- Ensure your agent containers are configured to send traces to the Phoenix collector endpoint. Here is an example of how to set up the environment variables and instrumentation in your agent's Dockerfile or entrypoint script:
```LBKS import os
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from openinference.instrumentation.langchain import LangChainInstrumentorLBKS # Set the Phoenix collector endpoint
os.environ['PHOENIX_COLLECTOR_ENDPOINT'] = 'http://<phoenix_host> :6006/v1/traces'LBKS # Initialize the tracer provider
resource = Resource(attributes={})
tracer_provider = trace_sdk.TracerProvider(resource=resource)
span_exporter = OTLPSpanExporter(endpoint=os.environ['PHOENIX_COLLECTOR_ENDPOINT'])
tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter))
trace_api.set_tracer_provider(tracer_provider=tracer_provider)LBKS # Instrument LangChain
LangChainInstrumentor().instrument()
```LBKSLBKS3. **Docker Compose Example**:
- You can use Docker Compose to manage multiple containers and ensure they are correctly networked. Here is an example `docker-compose.yml` file:
```LBKS version: '3.8'
services:
phoenix:
image: arizephoenix/phoenix:latest
ports:
- "6006:6006" # UI and OTLP HTTP collector
- "4317:4317" # OTLP gRPC collectorLBKS agent1:
build: ./agent1
environment:
- PHOENIX_COLLECTOR_ENDPOINT=[http://phoenix:6006/v1/traces](http://phoenix:6006/v1/traces)
depends_on:
- phoenixLBKS agent2:
build: ./agent2
environment:
- PHOENIX_COLLECTOR_ENDPOINT=[http://phoenix:6006/v1/traces](http://phoenix:6006/v1/traces)
depends_on:
- phoenix
- This setup ensures that both agent containers send their traces to the Phoenix collector running in the phoenix service (source).Would you like more details on any specific part of this setup?Sources:
- Phoenix Deployment Documentation
- Slack Discussion on Phoenix Setup
馃挕聽Hint: Mention RunLLM in the thread for followups.
