Add custom telemetry signals
In continuation to my previous posts - Part 1, Part 2 , Part 3, this article covers about the custom telemetry signals .
The out of box telemetry signals captures the insights from the standard process.
It is also possible to extend signals to provide more insights to custom processes using the below class:
SysApplicationInsightsTelemetryLogger:
The class is present in the model 'Monitoring and Telemetry' .
The class uses the references to AppInsights telemetry client which provides access to the operations to track an event , trace , exception or metric.
The class uses the static constructor pattern to ensure a singleton instance per user session.
The encapsulated Azure Application Insights telemetry client is further cached to ensure that only one telemetry client is created per Application Object Server (AOS) instance.
Telemetry data contract types
Refer to the below documents for each contract
EventTelemetry class PageViewTelemetry class ExceptionTelemetry class TraceTelemetry class
Event Telemetry
To log a custom event to Azure Application Insights, you can create an instance of the SysApplicationInsightsEventTelemetry class and pass in the necessary payload.
Then use the trackEvent method on the SysApplicationInsightsTelemetryLogger class to emit the event.
Given below the method in the Logger class
A custom event telemetry when a record is created in SysUserLog table is given below.
Page views Telemetry
The logger logs every form that is opened in the application.
Given below the reference of the logger in standard class
Exceptions Telemetry:
Track exceptions in Application insights using trackException method.
Reference in the standard where all errors that are presented in the Infolog are automatically emitted to Azure Application Insights.
Traces Telemetry:
Track exceptions using trackTrace method.
The above code snippet refers extending the trackTrace for custom traces.
Metrics Telemetry:
For metrics, no specific data contract is needed. Instead, you can interact directly with the class by using the method.
The logger first gets the existing metric instance from Azure Application Insights and updates the value.
By using , you can add properties that should be used as dimensions. Values can then be sliced based on those dimensions.
More reference about metrics is here
Other References:
In the next post , we will understand about the telemetry costs.