Skip to content

Commit 082aec8

Browse files
angelserangelserMS
authored andcommitted
Log Framework name to more Windows ML relevant events (#27256)
This PR adds the frameworkName field to critical Windows ML telemetry events to ensure proper event attribution and prevent data loss. The frameworkName field is added to ensure that Windows ML events are not lost and do not require joins with events that might have been emitted outside the scope of the time span the processing scripts check for long-running apps/processes. This allows each event to be self-contained with framework identification. The following telemetry events now include the frameworkName field: 1. **SessionCreationStart** - Logs when session creation begins 2. **SessionCreation** - Logs session creation details including model metadata 3. **RuntimeError** - Logs runtime errors (both DEBUG and release builds) 4. **RuntimePerf** - Logs runtime performance metrics including total runs and duration 5. **AutoEpSelection** - Logs automatic execution provider selection policy and results 6. **ProviderOptions** - Logs execution provider configuration options All events now include TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName") to maintain consistent framework identification across the telemetry pipeline. --------- Co-authored-by: Angela Serrano Brummett <angelser@microsoft.com>
1 parent 2ff7447 commit 082aec8

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

onnxruntime/core/platform/windows/telemetry.cc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ void WindowsTelemetry::LogSessionCreationStart(uint32_t session_id) const {
204204
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage),
205205
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
206206
TraceLoggingUInt32(session_id, "sessionId"),
207-
TraceLoggingLevel(WINEVENT_LEVEL_INFO));
207+
TraceLoggingLevel(WINEVENT_LEVEL_INFO),
208+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
208209
}
209210

210211
void WindowsTelemetry::LogEvaluationStop(uint32_t session_id) const {
@@ -304,7 +305,8 @@ void WindowsTelemetry::LogSessionCreation(uint32_t session_id, int64_t ir_versio
304305
TraceLoggingString(model_weight_hash.c_str(), "modelWeightHash"),
305306
TraceLoggingString(model_metadata_string.c_str(), "modelMetaData"),
306307
TraceLoggingString(loaded_from.c_str(), "loadedFrom"),
307-
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"));
308+
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"),
309+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
308310
} else {
309311
TraceLoggingWrite(telemetry_provider_handle,
310312
"SessionCreation_CaptureState",
@@ -330,7 +332,8 @@ void WindowsTelemetry::LogSessionCreation(uint32_t session_id, int64_t ir_versio
330332
TraceLoggingString(model_weight_hash.c_str(), "modelWeightHash"),
331333
TraceLoggingString(model_metadata_string.c_str(), "modelMetaData"),
332334
TraceLoggingString(loaded_from.c_str(), "loadedFrom"),
333-
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"));
335+
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"),
336+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
334337
}
335338
}
336339

@@ -356,7 +359,8 @@ void WindowsTelemetry::LogRuntimeError(uint32_t session_id, const common::Status
356359
TraceLoggingString(status.ErrorMessage().c_str(), "errorMessage"),
357360
TraceLoggingString(file, "file"),
358361
TraceLoggingString(function, "function"),
359-
TraceLoggingInt32(line, "line"));
362+
TraceLoggingInt32(line, "line"),
363+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
360364
#else
361365
TraceLoggingWrite(telemetry_provider_handle,
362366
"RuntimeError",
@@ -372,7 +376,8 @@ void WindowsTelemetry::LogRuntimeError(uint32_t session_id, const common::Status
372376
TraceLoggingString(status.ErrorMessage().c_str(), "errorMessage"),
373377
TraceLoggingString(file, "file"),
374378
TraceLoggingString(function, "function"),
375-
TraceLoggingInt32(line, "line"));
379+
TraceLoggingInt32(line, "line"),
380+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
376381
#endif
377382
}
378383

@@ -402,7 +407,8 @@ void WindowsTelemetry::LogRuntimePerf(uint32_t session_id, uint32_t total_runs_s
402407
TraceLoggingUInt32(session_id, "sessionId"),
403408
TraceLoggingUInt32(total_runs_since_last, "totalRuns"),
404409
TraceLoggingInt64(total_run_duration_since_last, "totalRunDuration"),
405-
TraceLoggingString(total_duration_per_batch_size.c_str(), "totalRunDurationPerBatchSize"));
410+
TraceLoggingString(total_duration_per_batch_size.c_str(), "totalRunDurationPerBatchSize"),
411+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
406412
}
407413

408414
void WindowsTelemetry::LogExecutionProviderEvent(LUID* adapterLuid) const {
@@ -478,7 +484,8 @@ void WindowsTelemetry::LogAutoEpSelection(uint32_t session_id, const std::string
478484
TraceLoggingUInt32(session_id, "sessionId"),
479485
TraceLoggingString(selection_policy.c_str(), "selectionPolicy"),
480486
TraceLoggingString(requested_execution_provider_string.c_str(), "requestedExecutionProviderIds"),
481-
TraceLoggingString(available_execution_provider_string.c_str(), "availableExecutionProviderIds"));
487+
TraceLoggingString(available_execution_provider_string.c_str(), "availableExecutionProviderIds"),
488+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
482489
}
483490

484491
void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const std::string& provider_options_string, bool captureState) const {
@@ -497,7 +504,8 @@ void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const
497504
// Telemetry info
498505
TraceLoggingUInt8(0, "schemaVersion"),
499506
TraceLoggingString(provider_id.c_str(), "providerId"),
500-
TraceLoggingString(provider_options_string.c_str(), "providerOptions"));
507+
TraceLoggingString(provider_options_string.c_str(), "providerOptions"),
508+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
501509
} else {
502510
TraceLoggingWrite(telemetry_provider_handle,
503511
"ProviderOptions_CaptureState",
@@ -509,7 +517,8 @@ void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const
509517
// Telemetry info
510518
TraceLoggingUInt8(0, "schemaVersion"),
511519
TraceLoggingString(provider_id.c_str(), "providerId"),
512-
TraceLoggingString(provider_options_string.c_str(), "providerOptions"));
520+
TraceLoggingString(provider_options_string.c_str(), "providerOptions"),
521+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
513522
}
514523
}
515524

0 commit comments

Comments
 (0)