// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include #include #include "core/platform/telemetry_strings.h" namespace onnxruntime::telemetry_internal { // These PAL-populated fields are not needed by ORT. ext.os.locale is not populated by this SDK path. inline constexpr std::array kSuppressedCommonContextFields{ "AppInfo.Language", "UserInfo.Language", "UserInfo.TimeZone", "M365aInfo.EnrolledTenantId", }; inline constexpr std::array kProcessInfoOnlyNetworkContextFields{ "DeviceInfo.NetworkCost", "DeviceInfo.NetworkProvider", "DeviceInfo.NetworkType", }; // ext.sdk.* is populated by a separate decorator. Keep it intact because epoch/sequence are // per-event SDK ordering metadata and the public SDK has no field-level suppression control. template void SuppressUnneededCommonContext(SemanticContext& context) { for (const char* field : kSuppressedCommonContextFields) { context.SetCommonField(field, std::string{}); } } template void SetApplicationNameFromProcessName(SemanticContext& context, const std::string& process_name) { if (!process_name.empty()) { context.SetCommonField("AppInfo.Name", telemetry_detail::BoundedTelemetryString(process_name)); } } template void SuppressNetworkContext(SemanticContext& context) { for (const char* field : kProcessInfoOnlyNetworkContextFields) { context.SetCommonField(field, std::string{}); } } } // namespace onnxruntime::telemetry_internal