-
Page views will be tracked by default when router changes occur. Note that this doesn't include overlays (see trackPageView).
-
Uncaught browser exceptions will also be tracked by default. For manually logging exceptions (see trackException).
-
HTTP requests will also be tracked by default, so no manually tracking is nesecary.
traceparent
header won't be added on outgoing requests in the mocking environment due to the usage of MSW (Mock Service Worker). To see the traceparent
header, run the development environment instead.
bun dh:dev
To send telemetry to Application Insights, you must import the DhApplicationInsights
service from @energinet-datahub/dh/shared/util-application-insights
.
import { DhApplicationInsights } from '@energinet-datahub/dh/shared/util-application-insights';
// ...
private readonly appInsights = inject(DhApplicationInsights);
Log a user action or other occurrence.
DhApplicationInsights.trackEvent('some event');
Log a diagnostic scenario such as entering or leaving a function.
DhApplicationInsights.trackTrace('some message');
Logs that a page or similar container was displayed to the user. Use this for tracking overlays.
DhApplicationInsights.trackPageView('name of overlay');
Log an exception that you have caught.
DhApplicationInsights.trackException({
exception: new Error('some error'),
severityLevel: 3, // Severity level of error
});
The best way to get started learning to write log queries using KQL is leveraging available tutorials and samples.
pageViews
| where client_Type == 'Browser'
customEvents
| where name == 'Custom event'
exceptions
| where itemType == 'exception'
| where client_Type == 'Browser'