Hi, does anyone have an example for pointing PostgreSQL for DB persistancy instead of SQLite.
PHOENIX_SQL_DATABASE_URL = "postgresql://postgres:########@localhost:5432/phoenix"
I have defined the environment variable as above but it seems not working
can you try a slightly different format, i.e. putting the username and password at the end?
postgresql://@host/dbname?user=user&password=passwordin the logs for the postgres instance do you see any errors?
Hi Roger Y. I have updated the db url with your new format,
PHOENIX_SQL_DATABASE_URL=postgresql://@localhost/phoenix?user=postgres&password=Zieg1234@And in pgAdmin4 I can see a session has been made when I send a query to my chat application But still the traces are not persist, when I restart my application they just dissapears.
so you’re seeing traces showing up in Phoenix but they disappear if you restart Phoenix?
do you see traces in the postgres database itself by select * from spans?
yes correct it disappears after restarting. And I executed you query right now. Seems like the schema is not created, below is the outout. ERROR: relation "spans" does not exist LINE 1: select * from spans ^ SQL state: 42P01 Character: 15
that is very odd
what’s your postgres version?
PostgreSQL 16.3, compiled by Visual C++ build 1939, 64-bit
how do you start your phoenix?
do you see the postgres url when it starts?
import phoenix as px
session = px.launch_app()and I'm setting up custom tracing object as below,
from openinference.semconv.resource import ResourceAttributes
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from phoenix.config import get_env_host, get_env_port
def setup_tracing(app_name):
resource = Resource(attributes={
ResourceAttributes.PROJECT_NAME: f'{app_name}'
})
tracer_provider = TracerProvider(resource=resource)
trace.set_tracer_provider(tracer_provider)
tracer = trace.get_tracer(__name__)
collector_endpoint = f"http://localhost:{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)
return tracer
can you run this in a command prompt?
PHOENIX_SQL_DATABASE_URL='postgresql://@localhost/phoenix?user=postgres&password=Zieg1234@' python -m phoenix.server.main serveif so, do you see the print out like my screenshot above?
