Skip to content

Commit 72d9d09

Browse files
committed
Update tracing and deployment docs
1 parent 47976dc commit 72d9d09

File tree

2 files changed

+42
-18
lines changed

2 files changed

+42
-18
lines changed

docs/Deployment/Building a REST API.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,21 @@ from fastapi import FastAPI
5454

5555
import synalinks
5656

57+
# Import open-telemetry dependencies
58+
from arize.otel import register
59+
from openinference.instrumentation.litellm import LiteLLMInstrumentor
60+
61+
# Load the environment variables
5762
load_dotenv()
5863

59-
mlflow.litellm.autolog()
60-
# Set this to your MLflow server
61-
mlflow.set_tracking_uri(os.getenv("MLFLOW_URL"))
64+
# Setup OTel via Arize Phoenix convenience function
65+
tracer_provider = register(
66+
space_id = os.environ["ARIZE_SPACE_ID"], # in app space settings page
67+
api_key = os.environ["ARIZE_API_KEY"], # in app space settings page
68+
project_name = os.environ["ARIZE_PROJECT_NAME"], # name this to whatever you would like
69+
)
70+
71+
LiteLLMInstrumentor().instrument(tracer_provider=tracer_provider)
6272

6373
# Set up logging
6474
logger = logging.getLogger(__name__)
@@ -125,10 +135,11 @@ And finally your docker compose file.
125135

126136
```yml title="docker-compose.yml"
127137
services:
128-
mlflow:
129-
image: ghcr.io/mlflow/mlflow:latest
138+
arizephoenix:
139+
image: arizephoenix/phoenix:latest
130140
ports:
131-
- "5000:5000"
141+
- "6006:6006"
142+
- "4317:4317"
132143
backend:
133144
build:
134145
context: ./backend
@@ -138,7 +149,7 @@ services:
138149
env_file:
139150
- .env.backend
140151
depends_on:
141-
- mlflow
152+
- arizephoenix
142153
```
143154
144155
## Launching your backend
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
1-
# Enabling LM Tracing
1+
# Enabling LM Tracing with Arize Phoenix
22

33
Tracing is important for several reasons, especially in the context of machine learning and software development. It helps identify issues and bugs in your Synalinks programs by providing a detailed log of events and operations. This makes it easier to pinpoint where things went wrong and why.
44

5-
To install MLflow, an open-source tracing software, use the following:
5+
In this guide we are going to setup the tracing locally, for more information on how to setup in the cloud, refer to [Arize Phoenix documentation](https://docs.arize.com/phoenix)
66

77
```shell
8-
pip install mlflow
8+
uv pip install openinference-instrumentation-litellm arize-otel
99
```
1010

1111
To activate the LM tracing, add the following lines to the top of your script
1212

1313
```python
14-
import mlflow
15-
16-
mlflow.litellm.autolog()
17-
# Set this to your MLflow server
18-
mlflow.set_tracking_uri("http://localhost:5000")
14+
# Import open-telemetry dependencies
15+
from arize.otel import register
16+
from openinference.instrumentation.litellm import LiteLLMInstrumentor
17+
18+
# Setup OTel via Arize Phoenix convenience function
19+
tracer_provider = register(
20+
space_id = "your-space-id", # in app space settings page
21+
api_key = "your-api-key", # in app space settings page
22+
project_name = "your-project-name", # name this to whatever you would like
23+
)
24+
25+
LiteLLMInstrumentor().instrument(tracer_provider=tracer_provider)
1926
```
2027

2128
You are done, MLflow is now configured.
2229

23-
To launch MLflow server, use the following command in a shell
30+
To launch Arize Phoenix server, first pull the docker image with the following command.
31+
32+
```shell
33+
docker pull arizephoenix/phoenix
34+
```
35+
36+
Then use the following command in a shell
2437

2538
```shell
26-
mlflow server --host 127.0.0.1 --port 5000
39+
docker run -p 6006:6006 -p 4317:4317 -i -t arizephoenix/phoenix:latest
2740
```
2841

29-
You can find more information about the server configuration [here](https://mlflow.org/docs/latest/tracking/server.html).
42+
Finally go to `http://0.0.0.0:6006` to monitor your application.

0 commit comments

Comments
 (0)