Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions agentops/instrumentation/agentic/haystack/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def __init__(self):
def _initialize(self, **kwargs):
application_name = kwargs.get("application_name", "default_application")
environment = kwargs.get("environment", "default_environment")
self._attribute_manager = SpanAttributeManager(service_name=application_name, deployment_environment=environment)
self._attribute_manager = SpanAttributeManager(
service_name=application_name, deployment_environment=environment
)

def _create_metrics(self, meter) -> Dict[str, Any]:
return StandardMetrics.create_standard_metrics(meter)
Expand Down Expand Up @@ -123,7 +125,11 @@ def _wrap_haystack_run_impl(tracer, metrics, attr_manager, wrapped, instance, ar
tracer,
"haystack.generator.run",
kind=SpanKind.CLIENT,
attributes={SpanAttributes.LLM_SYSTEM: "haystack", "gen_ai.model": model, SpanAttributes.LLM_REQUEST_STREAMING: False},
attributes={
SpanAttributes.LLM_SYSTEM: "haystack",
"gen_ai.model": model,
SpanAttributes.LLM_REQUEST_STREAMING: False,
},
attribute_manager=attr_manager,
) as span:
prompt = _extract_prompt(args, kwargs)
Expand Down Expand Up @@ -153,7 +159,11 @@ def _wrap_haystack_stream_impl(tracer, metrics, attr_manager, wrapped, instance,
tracer,
"haystack.generator.stream",
kind=SpanKind.CLIENT,
attributes={SpanAttributes.LLM_SYSTEM: "haystack", "gen_ai.model": model, SpanAttributes.LLM_REQUEST_STREAMING: True},
attributes={
SpanAttributes.LLM_SYSTEM: "haystack",
"gen_ai.model": model,
SpanAttributes.LLM_REQUEST_STREAMING: True,
},
attribute_manager=attr_manager,
) as span:
prompt = _extract_prompt(args, kwargs)
Expand Down
4 changes: 2 additions & 2 deletions app/api/agentops/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# JWTs can be set to expire after a certain amount of time, but not extendable,
# not invalidatable from a central location
# can be used across domains, which is useful but also XSS risk
from typing import Union, Callable
from typing import Union, Callable, Optional
import os
from functools import wraps
import inspect
Expand Down Expand Up @@ -112,7 +112,7 @@ class SupabaseUserData(pydantic.BaseModel):

model_config = {'extra': 'ignore'}

iss: str # Issuer: The URL of your Supabase project
iss: Optional[str] = None # Issuer: The URL of your Supabase project (optional for local dev)
sub: str # Subject: The user's UUID
iat: int # Issued At: When the token was created
exp: int # Expiration Time: When the token expires
Expand Down
1 change: 1 addition & 0 deletions app/api/agentops/common/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
SUPABASE_DATABASE = os.getenv('SUPABASE_DATABASE')
SUPABASE_USER = os.getenv('SUPABASE_USER')
SUPABASE_PASSWORD = os.getenv('SUPABASE_PASSWORD')
SUPABASE_SSLMODE = os.getenv('SUPABASE_SSLMODE', 'prefer')

# Supabase allows up to 20 pool connections and 1000 max connections.
# Since we share connections with other instances (dev, staging) these defaults
Expand Down
3 changes: 2 additions & 1 deletion app/api/agentops/common/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
SUPABASE_PASSWORD,
SUPABASE_MIN_POOL_SIZE,
SUPABASE_MAX_POOL_SIZE,
SUPABASE_SSLMODE,
)

logger = logging.getLogger(__name__)
Expand All @@ -36,7 +37,7 @@ def __init__(self) -> None:
@classmethod
def to_connection_string(cls, protocol: str = "postgresql") -> str:
"""Format config as a URL connection string."""
return f"{protocol}://{cls.user}:{cls.password}@{cls.host}:{cls.port}/{cls.database}"
return f"{protocol}://{cls.user}:{cls.password}@{cls.host}:{cls.port}/{cls.database}?sslmode={SUPABASE_SSLMODE}"


def _cleanup_handler(signum=None, frame=None):
Expand Down
9 changes: 9 additions & 0 deletions app/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ services:
API_DOMAIN: ${API_DOMAIN}
APP_DOMAIN: ${APP_DOMAIN}

# Supabase PostgreSQL Direct Connection
SUPABASE_HOST: ${SUPABASE_HOST}
SUPABASE_PORT: ${SUPABASE_PORT}
SUPABASE_DATABASE: ${SUPABASE_DATABASE}
SUPABASE_USER: ${SUPABASE_USER}
SUPABASE_PASSWORD: ${SUPABASE_PASSWORD}
SUPABASE_MAX_POOL_SIZE: ${SUPABASE_MAX_POOL_SIZE}
SUPABASE_SSLMODE: ${SUPABASE_SSLMODE}

SENTRY_DSN: ${SENTRY_DSN}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT}
LOGGING_LEVEL: ${LOGGING_LEVEL}
Expand Down
Loading