diff --git a/onnxruntime/core/session/inference_session.cc b/onnxruntime/core/session/inference_session.cc index e18aa82de3..84126926ce 100644 --- a/onnxruntime/core/session/inference_session.cc +++ b/onnxruntime/core/session/inference_session.cc @@ -240,11 +240,7 @@ common::Status InferenceSession::Load(std::functionIrVersion(), model_->ProducerName(), model_->ProducerVersion(), - model_->Domain(), model_->MainGraph().DomainToVersionMap(), model_->MainGraph().Name(), - model_->MetaData(), event_name, execution_providers_.GetIds()); + event_name_ = event_name; } catch (const std::exception& ex) { status = Status(common::ONNXRUNTIME, common::FAIL, "Exception during loading: " + std::string(ex.what())); @@ -633,6 +629,13 @@ common::Status InferenceSession::Initialize() { // handle any subgraphs ORT_RETURN_IF_ERROR_SESSIONID_(InitializeSubgraphSessions(graph, session_state_)); is_inited_ = true; + + // and log telemetry + const Env& env = Env::Default(); + env.GetTelemetryProvider().LogSessionCreation(session_id_, model_->IrVersion(), model_->ProducerName(), model_->ProducerVersion(), + model_->Domain(), model_->MainGraph().DomainToVersionMap(), model_->MainGraph().Name(), + model_->MetaData(), event_name_, execution_providers_.GetIds()); + LOGS(*session_logger_, INFO) << "Session successfully initialized."; } catch (const NotImplementedException& ex) { status = ORT_MAKE_STATUS(ONNXRUNTIME, NOT_IMPLEMENTED, "Exception during initialization: ", ex.what()); diff --git a/onnxruntime/core/session/inference_session.h b/onnxruntime/core/session/inference_session.h index 791d61e62e..a25cb5ebc2 100644 --- a/onnxruntime/core/session/inference_session.h +++ b/onnxruntime/core/session/inference_session.h @@ -445,6 +445,7 @@ class InferenceSession { long long total_run_duration_since_last_; // the total duration (us) of Run() calls since the last report TimePoint time_sent_last_; // the TimePoint of the last report const long long kDurationBetweenSending = 1000* 1000 * 60 * 10; // duration in (us). send a report every 10 mins + std::string event_name_; // where the model is loaded from: ["model_loading_uri", "model_loading_proto", "model_loading_istream"] #ifdef ONNXRUNTIME_ENABLE_INSTRUMENT bool session_activity_started_ = false;