Skip to content

Commit

Permalink
Adding postprocessing to app insights
Browse files Browse the repository at this point in the history
  • Loading branch information
ghyadav committed Jan 2, 2025
1 parent f70c9fb commit 5460fe9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def run():
evaluate.run(args)
postprocess.run(args)

# Evaluate


if __name__ == "__main__":
with mlflow.start_run() as _run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def log_evaluation_event_single(trace_id, span_id, trace_flags, response_id, eva

def log_processing_time_event(args):
"""Log processing time event."""
body = f"Schedule ID: {args['schedule_id']} | Last Run Time: {args['time_window'][1]}"
body = f"Schedule ID: {args['schedule_name']} | Last Run Time: {args['time_window'][1]}"
event = opentelemetry.sdk._logs.LogRecord(
timestamp=time_ns(),
observed_timestamp=time_ns(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from azure.ai.ml import MLClient
from azure.ai.ml.identity import AzureMLOnBehalfOfCredential
from azure.identity import ManagedIdentityCredential
from azure.identity import ManagedIdentityCredential, DefaultAzureCredential
from azure.monitor.query import LogsQueryClient
import logging

Expand All @@ -26,6 +26,10 @@ def get_managed_identity_credentials():

def get_user_identity_credentials():
"""Get the user identity or default credentials."""
if os.getenv("IS_OFFLINE", "false").lower() == "true":
logger.info("IS_OFFLINE is set to true. Using default credentials.")
credential = DefaultAzureCredential()
return credential
logger.info("Trying to load AzureMLOnBehalfOfCredential")
credential = AzureMLOnBehalfOfCredential()
logger.info("AzureMLOnBehalfOfCredential successfully loaded.")
Expand Down

0 comments on commit 5460fe9

Please sign in to comment.