cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not a customer? Start a free trial

Click the Start a free trial link to start a 15-day SaaS trial of our product and join our community as a trial user. If you are an existing customer do not start a free trial.

AppDynamics customers and established members should click the sign in button to authenticate.

Knowledge Base

Custom error events not reported using JavaScript API

While using a Javascript Agent (with adrum.js) to report custom JS error events via the Agent's API, some users find that their error messages are not being reported.

 

This is usually caused by a missing message or line within the beacon.

 

Example:

 

var errorT = new ADRUM.events.Error();

errorT.url('http://localhost:8080/error');          // Optional
errorT.msg('I am a custom error at line 100');  // Mandatory
errorT.line(100);                                             // Mandatory
errorT.stack('some call stack here');                // Optional
ADRUM.report(errorT);

 

Both the message and the line are required. If either is missing, the Collector will reject the beacon.

Version history
Last update:
‎10-12-2018 02:33 PM
Updated by:
Labels (1)
Tags (2)
By replying you agree to the Terms and Conditions of the AppDynamics Community.
Comments

Where would the error end up? In a snapshot for a transaction where the given URL is related to?

@Roel.Beun Custom error events can be viewed in your Browser Snapshots. In your Controller, go to User Experience --> Select the application --> Browser Snapshots. You can also see them in Session Summaries by going to User Experience --> Select the application -> Sessions --> Select a session. Here's a example:

 

 

 

Custom error event.png

I am seeing the same problem.  I want my Javascript errors to participate in a health rule, and throw an alert when the javascript errors.  Has anyone gotten this to work?

Using the Sessions view is painful and doesn't give you a high level view of all your custom errors. You will need to click on each URL and it may or may not be your error.

 

A better approach I have come across with some help from AppD support team is to use the analytics view and I think that will give you what you want here.

 

  1. In the controller go to Analytics
  2. Click on searches on the left
  3. Add a new search
  4. Write your SQL query to target error messages that you are interested in. E.g. SELECT scripterrordata.message, * FROM browser_records WHERE errortype IS NOT NULL AND scripterrordata.message REGEXP 'SOME_ERROR_MESSAGE.*'
  5.  Change the time range on top right to be whatever you need (1day, 2days etc)

Hope this helps someone as it took a while to get this answer!

 

Where can I see the stack trace added in the script. I don't see it in browser snapshot or ADQL query.

errorT.stack('some call stack here');     

 

Hi Kishore,

 

In 4.4 the errorT.stack present but it was not written to show up anywhere in the controller UI. In 4.5 AppDynamics have decided to drop it. 

See, https://docs.appdynamics.com/display/PRO45/Report+Events+with+the+JavaScript+API

 

So as a workaround, try using errorT.msg to push in any error details.

 

Regards,

Gaurav

Hello there ,

With Adrum.js, can an alarm or error code be generated for forwarding a request to a url to a different url?
example malware detection?

Hi Halik

 

JS agent can only report error events.

Can you please elaborate on the problem?

 

Regards,

Gaurav

Hi Gaurav ,


it's not a problem, we just want to generate an alarm when a different url is redirected in the malware detection structure.

 

I want to capture the redirected url in adrum.js.

Hi Haluk,

 

If you have a BRUM analytics license, then try,

- Create analytics metrics from browser requests events with ADQL filtering such events.

- You can later use the above-defined metric in your Health rule and 

- Define alerts for the Health rule.

 

Regards,

Gaurav