Codeunit "Feature Telemetry"
Provides functionality for emitting telemetry in a universal format. Only system metadata is to be emitted through this codeunit.
Remarks
Every publisher needs to have an implementation of the "Telemetry Logger" interface and a subscriber to "Telemetry Loggers".OnRegisterTelemetryLogger event in one of their apps in order for this codeunit to work as expected (see "System Telemetry Logger" codeunit).
Properties
Name | Value |
---|---|
Access | Public |
InherentEntitlements | X |
InherentPermissions | X |
Methods
LogUsage
Sends telemetry about feature usage.
procedure LogUsage(EventId: Text, FeatureName: Text, EventName: Text)
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
EventName | Text |
The name of the event. |
Examples
FeatureTelemetry.LogUsage('0000XYZ', 'Emailing', 'Email sent');
LogUsage
Sends telemetry about feature usage.
procedure LogUsage(EventId: Text, FeatureName: Text, EventName: Text, CustomDimensions: Dictionary of [Text, Text])
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
EventName | Text |
The name of the event. |
CustomDimensions | Dictionary of [Text, Text] |
A dictionary containing additional information about the event. |
Examples
TranslationHelper.SetGlobalLanguageToDefault(); CustomDimensions.Add('JobQueueObjectType', Format(JobQueueEntry."Object Type to Run")); CustomDimensions.Add('JobQueueObjectId', Format(JobQueueEntry."Object ID to Run")); FeatureTelemetry.LogUsage('0000XYZ', 'Job Queue', 'Job executed', CustomDimensions); TranslationHelper.RestoreGlobalLanguage();
Remarks
Custom dimensions often contain information translated in different languages. It is a common practice to send telemetry in the default language (see example).
LogError
Sends telemetry about errors happening during feature usage.
procedure LogError(EventId: Text, FeatureName: Text, EventName: Text, ErrorText: Text)
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the error. |
FeatureName | Text |
The name of the feature. |
EventName | Text |
The name of the event. |
ErrorText | Text |
The text of the error. |
Examples
if not Success then FeatureTelemetry.LogError('0000XYZ', 'Retention policies', 'Applying a policy', GetLastErrorText(true));
LogError
Sends telemetry about errors happening during feature usage.
procedure LogError(EventId: Text, FeatureName: Text, EventName: Text, ErrorText: Text, ErrorCallStack: Text)
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the error. |
FeatureName | Text |
The name of the feature. |
EventName | Text |
The name of the event. |
ErrorText | Text |
The text of the error. |
ErrorCallStack | Text |
The error call stack. |
Examples
if not Success then FeatureTelemetry.LogError('0000XYZ', 'Configuration packages', 'Importing a package', GetLastErrorText(true), GetLastErrorCallStack());
LogError
Sends telemetry about errors happening during feature usage.
procedure LogError(EventId: Text, FeatureName: Text, EventName: Text, ErrorText: Text, ErrorCallStack: Text, CustomDimensions: Dictionary of [Text, Text])
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the error. |
FeatureName | Text |
The name of the feature. |
EventName | Text |
The name of the event. |
ErrorText | Text |
The text of the error. |
ErrorCallStack | Text |
The error call stack. |
CustomDimensions | Dictionary of [Text, Text] |
A dictionary containing additional information about the error. |
Examples
if not Success then begin TranslationHelper.SetGlobalLanguageToDefault(); CustomDimensions.Add('UpdateEntity', Format(AzureADUserUpdateBuffer."Update Entity")); FeatureTelemetry.LogError('0000XYZ', 'User management', 'Syncing users with M365', GetLastErrorText(true), GetLastErrorCallStack(), CustomDimensions); TranslationHelper.RestoreGlobalLanguage(); end;
Remarks
Custom dimensions often contain infromation translated in different languages. It is a common practice to send telemetry in the default language (see example).
LogUptake
Sends telemetry about feature uptake.
procedure LogUptake(EventId: Text, FeatureName: Text, FeatureUptakeStatus: Enum "Feature Uptake Status")
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
FeatureUptakeStatus | System.Telemetry."Feature Uptake Status" |
The new status of the feature uptake. |
Remarks
Expected feature uptake transitions: "Discovered" -> "Set up" -> "Used" (and only in this order; for example, if for a given feature the first status was logged as "Set up", no telemetry will be emitted) Any state -> "Undiscovered" (to reset the feature uptake status)
LogUptake
Sends telemetry about feature uptake.
procedure LogUptake(EventId: Text, FeatureName: Text, FeatureUptakeStatus: Enum "Feature Uptake Status", CustomDimensions: Dictionary of [Text, Text])
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
FeatureUptakeStatus | System.Telemetry."Feature Uptake Status" |
The new status of the feature uptake. |
CustomDimensions | Dictionary of [Text, Text] |
A dictionary containing additional information about the event. |
Remarks
Expected feature uptake transitions: "Discovered" -> "Set up" -> "Used" (and only in this order; for example, if for a given feature the first status was logged as "Set up", no telemetry will be emitted) Any state -> "Undiscovered" (to reset the feature uptake status)
LogUptake
Sends telemetry about feature uptake.
procedure LogUptake(EventId: Text, FeatureName: Text, FeatureUptakeStatus: Enum "Feature Uptake Status", IsPerUser: Boolean)
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
FeatureUptakeStatus | System.Telemetry."Feature Uptake Status" |
The new status of the feature uptake. |
IsPerUser | Boolean |
Specifies if the feature is targeted to be uptaken once for the tenant or uptaken individually by different users. |
Remarks
Expected feature uptake transitions: "Discovered" -> "Set up" -> "Used" (and only in this order; for example, if for a given feature the first status was logged as "Set up", no telemetry will be emitted) Any state -> "Undiscovered" (to reset the feature uptake status)
LogUptake
Sends telemetry about feature uptake.
procedure LogUptake(EventId: Text, FeatureName: Text, FeatureUptakeStatus: Enum "Feature Uptake Status", IsPerUser: Boolean, CustomDimensions: Dictionary of [Text, Text])
Parameters
Name | Type | Description |
---|---|---|
EventId | Text |
A unique ID of the event. |
FeatureName | Text |
The name of the feature. |
FeatureUptakeStatus | System.Telemetry."Feature Uptake Status" |
The new status of the feature uptake. |
IsPerUser | Boolean |
Specifies if the feature is targeted to be uptaken once for the tenant or uptaken individually by different users. |
CustomDimensions | Dictionary of [Text, Text] |
A dictionary containing additional information about the event. |
Remarks
Expected feature uptake transitions: "Discovered" -> "Set up" -> "Used" (and only in this order; for example, if for a given feature the first status was logged as "Set up", no telemetry will be emitted) Any state -> "Undiscovered" (to reset the feature uptake status)