/
TelemetryCustomDimensions.Codeunit.al
66 lines (57 loc) · 3.04 KB
/
TelemetryCustomDimensions.Codeunit.al
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Telemetry;
/// <summary>
/// Provides functionality for adding common custom dimensions to telemetry.
/// </summary>
/// <remarks>This codeunit is only intended to be used from subscribers of <see cref="OnAddCommonCustomDimensions"/> event.</remarks>
codeunit 8706 "Telemetry Custom Dimensions"
{
Access = Public;
InherentEntitlements = X;
InherentPermissions = X;
var
TelemetryCustomDimsImpl: Codeunit "Telemetry Custom Dims Impl.";
/// <summary>
/// Add a custom dimension for every telemetry message. Is used in conjunction with <see cref="OnAddCommonCustomDimensions"/>
/// </summary>
/// <param name="CustomDimensionName">The name of the custom dimension.</param>
/// <param name="CustomDimensionValue">The value of the custom dimension.</param>
/// <remarks>Only system metadata classified information should be added here as these custom dimensions will be used for all telemetry messages.</remarks>
procedure AddCommonCustomDimension(CustomDimensionName: Text; CustomDimensionValue: Text)
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
TelemetryCustomDimsImpl.AddCommonCustomDimension(CustomDimensionName, CustomDimensionValue, CallerModuleInfo.Publisher);
end;
/// <summary>
/// Allows to provide additional custom dimensions for every telemetry message. Is used in conjunction with <see cref="AddCommonCustomDimensions"/>.
/// </summary>
/// <remarks>Global language is set to default for the subscribers of this event.</remarks>
/// <example>
/// [EventSubscriber(ObjectType::Codeunit, Codeunit::"Telemetry Custom Dimensions", 'OnAddCommonCustomDimensions', '', true, true)]
/// local procedure OnAddCommonCustomDimensions(var Sender: Codeunit "Telemetry Custom Dimensions")
/// begin
/// Sender.AddCommonCustomDimension('CommonCustomDimension', 'Some info');
/// end;
/// </example>
[IntegrationEvent(true, false)]
internal procedure OnAddCommonCustomDimensions()
begin
end;
internal procedure GetAdditionalCommonCustomDimensions(ForPublisher: Text): Dictionary of [Text, Text]
begin
exit(TelemetryCustomDimsImpl.GetAdditionalCommonCustomDimensions(ForPublisher));
end;
internal procedure AddAllowedCommonCustomDimensionPublisher(Publisher: Text)
begin
TelemetryCustomDimsImpl.AddAllowedCommonCustomDimensionPublisher(Publisher);
end;
internal procedure AddCommonCustomDimension(CustomDimensionName: Text; CustomDimensionValue: Text; Publisher: Text)
begin
TelemetryCustomDimsImpl.AddCommonCustomDimension(CustomDimensionName, CustomDimensionValue, Publisher);
end;
}