Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include <array>
#include <string>
 
#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<const char*, 4> kSuppressedCommonContextFields{
    "AppInfo.Language",
    "UserInfo.Language",
    "UserInfo.TimeZone",
    "M365aInfo.EnrolledTenantId",
};
 
inline constexpr std::array<const char*, 3> 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 <typename SemanticContext>
void SuppressUnneededCommonContext(SemanticContext& context) {
  for (const char* field : kSuppressedCommonContextFields) {
    context.SetCommonField(field, std::string{});
  }
}
 
template <typename SemanticContext>
void SetApplicationNameFromProcessName(SemanticContext& context, const std::string& process_name) {
  if (!process_name.empty()) {
    context.SetCommonField("AppInfo.Name", telemetry_detail::BoundedTelemetryString(process_name));
  }
}
 
template <typename SemanticContext>
void SuppressNetworkContext(SemanticContext& context) {
  for (const char* field : kProcessInfoOnlyNetworkContextFields) {
    context.SetCommonField(field, std::string{});
  }
}
 
}  // namespace onnxruntime::telemetry_internal