Skip to content

Commit

Permalink
Merge pull request #268 from sudivate/sudivate/ignite-creative-writer
Browse files Browse the repository at this point in the history
Fix AI project connection string and updated Azure Identity
  • Loading branch information
marlenezw authored Nov 17, 2024
2 parents 09b247b + 40726bc commit 1217120
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gunicorn==21.2.0
jupyter
opentelemetry-sdk
opentelemetry-instrumentation
azure-identity==1.17.1
azure-identity==1.19.0
https://remoteevalbugbash.blob.core.windows.net/remoteevalbugbash/azure_ai_project-1.0.0b1-py3-none-any.whl
gunicorn==21.2.0
azure-keyvault-secrets
Expand Down
2 changes: 1 addition & 1 deletion src/api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gunicorn==21.2.0
jupyter
opentelemetry-sdk
opentelemetry-instrumentation
azure-identity==1.17.1
azure-identity==1.19.0
azure-ai-contentsafety
azure-ai-inference
https://remoteevalbugbash.blob.core.windows.net/remoteevalbugbash/azure_ai_project-1.0.0b1-py3-none-any.whl
Expand Down
14 changes: 5 additions & 9 deletions src/api/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ def setup_telemetry(app: FastAPI):
local_tracing_enabled=os.getenv("LOCAL_TRACING_ENABLED")
otel_exporter_endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")

location = os.environ["AZURE_LOCATION"]+".api.azureml.ms;"
subscription = os.environ["AZURE_SUBSCRIPTION_ID"]+";"
resource_group = os.environ["AZURE_RESOURCE_GROUP"]+";"
project_name = os.environ["AZURE_AI_PROJECT_NAME"]

# Configure OpenTelemetry using Azure AI Project
ai_project_conn_str = location + subscription +resource_group + project_name

# Get the connection string from the environment variables
ai_project_conn_str = os.getenv("AZURE_LOCATION")+".api.azureml.ms;"+os.getenv(
"AZURE_SUBSCRIPTION_ID")+";"+os.getenv("AZURE_RESOURCE_GROUP")+";"+os.getenv("AZURE_AI_PROJECT_NAME")

# Configure OpenTelemetry using Azure AI Project
with AIProjectClient.from_connection_string(
credential=DefaultAzureCredential(),
Expand Down Expand Up @@ -67,7 +63,7 @@ def setup_telemetry(app: FastAPI):

# Set the EventLoggerProvider as opentelemetry-instrumentation-openai-v2 use log events to log tokens
event_provider = EventLoggerProvider()
set_event_logger_provider(event_provider)
set_event_logger_provider(event_provider)

# Instrument FastAPI and exclude the send span to reduce noise
FastAPIInstrumentor.instrument_app(app,exclude_spans=["send"])

0 comments on commit 1217120

Please sign in to comment.