Repository navigation
Closed
Labels
Description
We found handledAt is not being tracked in the v1.0.15 anymore. We are seeing this field as empty. Looked into the code I found handledAt is available in the TrackException function's parameter, but it's never used inside. Is this a plan to move away from using handledAt?
/**
* Log an exception you have caught.
* @param exception An Error from a catch clause, or the string error message.
* @param handledAt Not used
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
AppInsights.prototype.trackException = function (exception, handledAt, properties, measurements, severityLevel) {
try {
if (!ApplicationInsights.Util.isError(exception)) {
// ensure that we have an error object (user could pass a string/message)
try {
throw new Error(exception);
}
catch (error) {
exception = error;
}
}
var exceptionTelemetry = new ApplicationInsights.Telemetry.Exception(exception, properties, measurements, severityLevel);
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Exception.dataType, exceptionTelemetry);
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Exception.envelopeType);
this.context.track(envelope);
}
catch (e) {
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
}
};However, v1.0.14.js has the handledAt as the parameter and being tracked in the code below.
/**
* Log an exception you have caught.
* @param exception An Error from a catch clause, or the string error message.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
AppInsights.prototype.trackException = function (exception, handledAt, properties, measurements, severityLevel) {
try {
if (!ApplicationInsights.Util.isError(exception)) {
// ensure that we have an error object (user could pass a string/message)
try {
throw new Error(exception);
}
catch (error) {
exception = error;
}
}
var exceptionTelemetry = new ApplicationInsights.Telemetry.Exception(exception, handledAt, properties, measurements, severityLevel);
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Exception.dataType, exceptionTelemetry);
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Exception.envelopeType);
this.context.track(envelope);
}
catch (e) {
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
}
};Reacted by Sergei Sergeev
Activity
wqoq commentedon Jun 20, 2018
I would say that's the case, given the details in #556 and #327. It looks like
handledAtwas meant to be internal-only.markwolff commentedon Dec 14, 2018
handledAthasn't been used for several iterations of the SDK, and won't be included in the v2 version either. Closing this for now...dagoltz commentedon Jan 4, 2019
This feature is still documented. I tried to use handledAt only to discover this bug that it is not working.
Pleaes remove it from docs and instruct users to pass "null":
https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackexception
https://github.com/Microsoft/ApplicationInsights-JS/blob/1.0.15/API-reference.md#trackexception
github-actions commentedon Aug 19, 2021
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.