Skip to content

Commit a21298f

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 cce8cd6 commit a21298f

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

onnxruntime/core/platform/windows/telemetry.cc

Lines changed: 20 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,9 @@ 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(service_names.c_str(), "serviceNames"),
310+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
308311
} else {
309312
TraceLoggingWrite(telemetry_provider_handle,
310313
"SessionCreation_CaptureState",
@@ -330,7 +333,9 @@ void WindowsTelemetry::LogSessionCreation(uint32_t session_id, int64_t ir_versio
330333
TraceLoggingString(model_weight_hash.c_str(), "modelWeightHash"),
331334
TraceLoggingString(model_metadata_string.c_str(), "modelMetaData"),
332335
TraceLoggingString(loaded_from.c_str(), "loadedFrom"),
333-
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"));
336+
TraceLoggingString(execution_provider_string.c_str(), "executionProviderIds"),
337+
TraceLoggingString(service_names.c_str(), "serviceNames"),
338+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
334339
}
335340
}
336341

@@ -419,7 +424,8 @@ void WindowsTelemetry::LogRuntimeError(uint32_t session_id, const common::Status
419424
TraceLoggingString(status.ErrorMessage().c_str(), "errorMessage"),
420425
TraceLoggingString(file, "file"),
421426
TraceLoggingString(function, "function"),
422-
TraceLoggingInt32(line, "line"));
427+
TraceLoggingInt32(line, "line"),
428+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
423429
#else
424430
TraceLoggingWrite(telemetry_provider_handle,
425431
"RuntimeError",
@@ -435,7 +441,8 @@ void WindowsTelemetry::LogRuntimeError(uint32_t session_id, const common::Status
435441
TraceLoggingString(status.ErrorMessage().c_str(), "errorMessage"),
436442
TraceLoggingString(file, "file"),
437443
TraceLoggingString(function, "function"),
438-
TraceLoggingInt32(line, "line"));
444+
TraceLoggingInt32(line, "line"),
445+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
439446
#endif
440447
}
441448

@@ -465,7 +472,8 @@ void WindowsTelemetry::LogRuntimePerf(uint32_t session_id, uint32_t total_runs_s
465472
TraceLoggingUInt32(session_id, "sessionId"),
466473
TraceLoggingUInt32(total_runs_since_last, "totalRuns"),
467474
TraceLoggingInt64(total_run_duration_since_last, "totalRunDuration"),
468-
TraceLoggingString(total_duration_per_batch_size.c_str(), "totalRunDurationPerBatchSize"));
475+
TraceLoggingString(total_duration_per_batch_size.c_str(), "totalRunDurationPerBatchSize"),
476+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
469477
}
470478

471479
void WindowsTelemetry::LogExecutionProviderEvent(LUID* adapterLuid) const {
@@ -541,7 +549,8 @@ void WindowsTelemetry::LogAutoEpSelection(uint32_t session_id, const std::string
541549
TraceLoggingUInt32(session_id, "sessionId"),
542550
TraceLoggingString(selection_policy.c_str(), "selectionPolicy"),
543551
TraceLoggingString(requested_execution_provider_string.c_str(), "requestedExecutionProviderIds"),
544-
TraceLoggingString(available_execution_provider_string.c_str(), "availableExecutionProviderIds"));
552+
TraceLoggingString(available_execution_provider_string.c_str(), "availableExecutionProviderIds"),
553+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
545554
}
546555

547556
void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const std::string& provider_options_string, bool captureState) const {
@@ -560,7 +569,8 @@ void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const
560569
// Telemetry info
561570
TraceLoggingUInt8(0, "schemaVersion"),
562571
TraceLoggingString(provider_id.c_str(), "providerId"),
563-
TraceLoggingString(provider_options_string.c_str(), "providerOptions"));
572+
TraceLoggingString(provider_options_string.c_str(), "providerOptions"),
573+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
564574
} else {
565575
TraceLoggingWrite(telemetry_provider_handle,
566576
"ProviderOptions_CaptureState",
@@ -572,7 +582,8 @@ void WindowsTelemetry::LogProviderOptions(const std::string& provider_id, const
572582
// Telemetry info
573583
TraceLoggingUInt8(0, "schemaVersion"),
574584
TraceLoggingString(provider_id.c_str(), "providerId"),
575-
TraceLoggingString(provider_options_string.c_str(), "providerOptions"));
585+
TraceLoggingString(provider_options_string.c_str(), "providerOptions"),
586+
TraceLoggingString(ORT_CALLER_FRAMEWORK, "frameworkName"));
576587
}
577588
}
578589

0 commit comments

Comments
 (0)