Splunk AppDynamics

Can an Angular Application be configured as Application?

Arjunasetty_Mur
Explorer

Hi, 

Currently, our Angular application is configured as "User Experience", We are facing the below issues:

1. We want to trigger an alert when there is a specific HTTP code in the response ex: 500, . While configuring health rules, there is no option to select a specific error code.

2. Anomalies are not detected even through enabled the option to overcome these issues

Can we configure our application as "Application" so that will give more options to configure the health rules? 

Labels (1)
Tags (3)
0 Karma

iamryan
Community Manager
Community Manager

Hi @Arjunasetty.Murahari,

I found this AppD Docs page on Angular, please check it out. https://docs.appdynamics.com/21.8/en/end-user-monitoring/browser-monitoring/browser-real-user-monito...

In the meantime, let us see if the community can also jump in and provide insight. 

0 Karma

Arjunasetty_Mur
Explorer

Thank you for sharing the doc link and it was not much helpful. 

Can you please help us in below: 

As communicated earlier, as of now our Angular application configured as "User Experience"  Please refer the screen shots.

Current configuration for one of the health rule is "AJAX Request Errors per Minute" metric - with this the problem is Appd is trying to collect all error codes and raising false alarms.  (all error codes means other than 200 http codes it is considering as errors) , but in our application the 400/401 those are business error codes, these we want to avoid to capture as errors in AppD. 

 Can you please suggest us any configuration/metric to configure with http code 500. 

Another issue the anomalies are not capturing, Can you suggest any configuration? 

image.png

image.png

image.png

image.png

image.png

0 Karma

iamryan
Community Manager
Community Manager

Hi @Arjunasetty.Murahari,

Let's see if the community can jump in and help. Also, if you happen to find any new information or a solution, please do come back and share that info here. 

As this is a peer-to-peer community, knowledge sharing is very important to the success of the community.

0 Karma

Arjunasetty_Mur
Explorer

As of no body responded from the community it would be great  if someone from App Dynamic team can help. 

As mentioned previously would be interested to configure health on specific http error code. 

Currently for application daily approximate requests are 2.5M to 3M.

Among those success requests (200) could be 80%

User entered incorrect data (400) could be 12-15%

All remaining may other %

So here 400 error codes frequently alert are generated .. those are proper business errors. 

0 Karma

Hiroki_Ito
Contributor

You may be able to achieve what you would like to do by creating Analytics metrics from Ajax error and monitor them by a health rule.

Could you please check if you can see Ajax error from analytics?
You can see the value from analytics page by searching "Browser Requests" and enabling AJAX Error field.

If you cannot see Ajax Error, please check the post below to make Ajax Error transferred to Events Service, and then you can create Analytics metrics.

In addition, initially you asked to configure Angular as "Application."
I think Angular is client-side, and there may be a server-side application which gets requests from Angular application.
If so, it may also be possible to instrument the server-side application depending on the language and framework it is using.

Best Regards,
Hiroki

Arjunasetty_Mur
Explorer

Thank you Hiroki for the explanation and let me go through it and let you know if additional details are needed. 

Arjunasetty_Mur
Explorer

Hi Hiroki, 

It was really helped and I have below questions: 

We configured our application only as End User Monitoring, but the anomalies are not captured. 

Could you please let us know 

1. does EUM also capture the anomalies?  

2. How I can correlate the transaction generated in browser snapshot and in the splunk logs?  (refer screen shots)

I checked with Client Request GUID which is available from Brower snap shots no luck.  (please refer first screenshot)

image.png

image.png

image.png

image.png

0 Karma

Arjunasetty_Mur
Explorer

Hiroki,

Did you get chance to look into the problem I posted? 

0 Karma

Hiroki_Ito
Contributor

Sorry for the delay in getting back to you.

> 1. does EUM also capture the anomalies?
Unfortunately, Anomaly Detection can only be configured for Business Transactions which is on the APM application and not EUM applications.
You might be able to enable Anomaly Detection for EUM applications from the Controller UI but there will be no trained model and/or any anomaly displayed.

> 2. How I can correlate the transaction generated in browser snapshot and in the splunk logs? 
Could you please share what kinds of information are available in Splunk?
If you are using Splunk Add-on for AppDynamics and AppDynamics Analytics Events API Call to get analytics data, I think "Browser Requests"(browser_records in ADQL) include "Client GUID", so you can correlate using the Client Request GUID in Browser snapshots.
The filed for "Client GUID" may be "cguid" in the response of Analytics API.
 

Splunk Add-on for AppDynamics


Best Regards,
Hiroki
0 Karma

Arjunasetty_Mur
Explorer

Hi @Hiroki.Ito

Thank you very much for explanation and appreciate your coordination. 

One more question: 

As you know our application is configured as "EUM" and when any java script/ Ajax error occurred the message is not captured please refer screen shot.  

image.png

My question is :

1. How can capture the error message for that error code / java script error code? 

2. For IE 11 Do we need any specific adrum.js file? we suspecting IE11 java script errors / data is not capturing. 

Can you please let us know how we can attach the files here? / how we can send the files? 

Please find the current index.html here.

<!doctype html>
<html lang="en" dir="ltr">
<head>
<script>
(function (p, r, m) {
m = p.match(r);
!!m && !!m[2] ? document.write('<base href="' + (m ? m[0] : '') + '/" />') : null;
})(location.pathname, /^\/shiponline(\/([a-z]{2}-[a-z]{2}))?/i);
</script>

<script>
/* Allow return from legacy */
(function () {
if (window.location.search.substr(1).includes('legacy=true')) {
window.localStorage.removeItem('legacyShipping');
window.localStorage.removeItem('legacyShipping_ts');
window.location.href = window.location.href.replace(window.location.search, '');
}})();
</script>

<meta charset="utf-8">
<title i18n="The title element of the page | text that appears in the tab">
Create a Shipment - XXX Shipment Creation
</title>

<!--change description for content-->
<meta name="description"
content="Easily compare and calculate Express, Ground, and Freight shipping rates to get the fastest delivery times available for all your domestic and international shipments">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon"
type="image/png"
href="https://www.XXX.com/images/c/s1/fx-favicon.ico">
<link rel="stylesheet"
type="text/css"
href="https://www.XXX.com/etc/clientlibs/XXX/commoncore.min.css">
<!--PLACEHOLDER FOR SCRIPT TAG TO INCLUDE GOOGLE MAPS API LINK-->
<style type="text/css">
.fdx-c-static-loading-indicator-container {
text-align: center;
padding: 30px 0;
background: #f2f2f2;
min-height: 1000px;
}

.fdx-c-static-loading-indicator {
display: inline-block;
position: relative;
width: 4rem;
height: 4rem;
overflow: hidden;
}

.fdx-c-static-loading-indicator__part {
position: absolute;
box-sizing: border-box;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: 2px;
border-width: 2px;
border-style: solid;
border-color: #4d148c transparent transparent;
border-radius: 50%;
-webkit-animation: 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite static-loading-indicator;
animation: 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite static-loading-indicator;
}

.fdx-c-static-loading-indicator__part:nth-child(1) {
border-color: #58595b;
opacity: 0.15;
}

.fdx-c-static-loading-indicator__part:nth-child(2) {
-webkit-animation-delay: -0.24s;
animation-delay: -0.24s;
}

.fdx-c-static-loading-indicator__part:nth-child(3) {
-webkit-animation-delay: -0.36s;
animation-delay: -0.36s;
}

.fdx-c-static-loading-indicator__part:nth-child(4) {
-webkit-animation-delay: -0.5s;
animation-delay: -0.5s;
}

.fdx-c-static-loading-indicator--white .fdx-c-static-loading-indicator__part {
border-color: #fff transparent transparent;
}

.fdx-c-static-loading-indicator--white .fdx-c-static-loading-indicator__part:nth-child(1) {
border-color: transparent;
}

@-webkit-keyframes static-loading-indicator {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}

100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}

@keyframes static-loading-indicator {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}

100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>
<script>
if (!FDX) {
var FDX = {};
}
FDX.CAAS = {
channel: 'XXX.com|caas|xxx',
pagePath: 'default'
};
FDX.DATALAYER = {};
FDX.DATALAYER.event = [];
FDX.DATALAYER.page = {
pageInfo: {
pageName: "XXX",
locale: "en_us",
language: "en",
historicalPageName: "",
region: "us",
country: "us",
pagePath: "/"
},
category: {
pageType: "application",
primaryCategory: "content|application",
isApplication: "true",
appName: "XXX-mags"
},
button: {
data: ""
}
};
</script>
</head>
<body>
<link async rel="preload" href="https://cdn.optimizely.com/js/19595420443.js" as="script">
<link rel="preconnect" href="//logx.optimizely.com">
<script async src="https://cdn.optimizely.com/js/19595420443.js"></script>
<!--Script to handle google authorization failures. -->
<script>
function gm_authFailure() {
document.dispatchEvent(new Event('GOOGLE_AUTH_FAILURE'));
google = undefined;
};
</script>
<!--Script to load Google places library. -->
<script
src="https://maps.googleapis.com/maps/api/js?client=gme-XXXcorporation1&libraries=places&channel=MAGS"></script>
<!--Script to listen to Login Event from Header.-->

<script charset='UTF-8'>
// Load AppD scripts for test levels and production environments.
if (window.location.host.indexOf('localhost') != 0) {
window['adrum-start-time'] = new Date().getTime();
var hostName = window.location.host;
(function (config) {
if (window.location.host.indexOf('www.XXX.com') === 0) {
config.appKey = 'AD-AAB-XXX-YYY'; // Production Key
} else {
config.appKey = 'AD-AAB-XXX-YYY'; // Test Level Key
}
window["adrum-app-key"] = config.appKey;
config.adrumExtUrlHttp = 'http://' + hostName + '/shiponline/appd';
config.adrumExtUrlHttps = 'https://' + hostName + '/shiponline/appd';
config.fetch = true;
config.angular = true;
config.isZonePromise = true;
config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
config.xd = {enable: true};
config.spa = {"spa2": true};

})(window['adrum-config'] || (window['adrum-config'] = {}));

//Load Adrum.js file
var script = document.createElement('script');
script.type='text/javascript';
script.src='https://' + hostName + '/shiponline/appd/adrum.js';
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>

<script>
if (!window.sessioncamConfiguration) {
window.sessioncamConfiguration = new Object();
}
window.sessioncamConfiguration.elementsToRemove='.pac-item';
</script>

<!-- MAGS Application Bootstrap selector -->
<fx-mags-root></fx-mags-root>
<div class="app-loading">
<div class="fdx-c-static-loading-indicator-container">
<div class="fdx-c-static-loading-indicator">
<div class="fdx-c-static-loading-indicator__part"></div>
<div class="fdx-c-static-loading-indicator__part"></div>
<div class="fdx-c-static-loading-indicator__part"></div>
<div class="fdx-c-static-loading-indicator__part"></div>
</div>
</div>
</div>
</body>
</html>


Edited 8/24/21 to include the "@mention" tag for improved notification
Claudia Landviar, Community Manager &the  Editor

0 Karma

Hiroki_Ito
Contributor

> 1. How can capture the error message for that error code / java script error code?
For Ajax error, the message is taken from http status message corresponding to the HTTP status code.
i.e. "Not Found" for 404 and "Internal Server Error" for 500.
If the API doesn't return http status message, Ajax error message becomes empty, so your API may not return http status message.
image.png

For Javascript error, it should be available if "Enable JavaScript Error Capture" is enabled.

> 2. For IE 11 Do we need any specific adrum.js file? we suspecting IE11 java script errors / data is not capturing.
> Can you please let us know how we can attach the files here? / how we can send the files?
You don't need specific adrum.js file for IE11.

Could you please check if compatibility mode is used with IE11?
IE 10 and Edge are supported. IE >= 10 and Edge cannot be in compatibility mode with IE <= 9 browsers.

Attaching files is not allowed in community because they can contain personally-identifying information (PII) or content.
If compatibility mode is not used, I think this issue can be complicated and a support engagement could be helpful. Support is only accessible for non trial/Lite customers.

How do I submit a Support ticket? An FAQ

If you raise a support ticket, attaching debug console session and error details/links/screenshots may be helpful.

How to debug a browser page by modifying adrum.js

Troubleshoot Browser RUM

Best Regards,
Hiroki
0 Karma

Arjunasetty_Mur
Explorer

Hiroki, 

Thank you for your reply.

for 1. How can capture the error message for that error code / java script error code?

As part of our application API sending the proper response, please find the screen shot.

image.pngimage.png

As part of java script error we configured that option already and there is no rules to ignore the errors.

image.png

Still we don't see the java scripts errors and ajax error messages

For question 2 will analyze and get back to you 

0 Karma

Hiroki_Ito
Contributor

Could you please confirm if my understanding is correct?

1. Ajax error: You can see Ajax error with browser snapshots. However the error is like {"status":"400","message":""} and the message part is empty.

2. Javascript error: JavaScript Error is not shown with browser snapshots for any browser.


For the 1st one, the message is taken from http status message corresponding to the HTTP status code.
The screenshot you attached is too small to see, but you can see http status message from the network tab and selecting the request.
There should be status code, and if it only show the code without message, it means API is not returning http status message.
image.pngimage.png

  


For the 2nd one, could you please check the error is unhandled exceptions? If not, the agent can't capture the errors. e.g. console.error may not be captured.

Also, could you please check the below document if any script on your web pages sets the JavaScript window.onerror event?
> The JavaScript Agent (adrum.js) sets window.onerror to listen for uncaught JavaScript errors. If this listener is overwritten, errors are not reported.

In addition, it looks like AppD script is in the <body> tag.
Could you insert the script right after the <head> tag and see the behavior?

If none fixes the issue, I think this is a complicated issue, and a support engagement could be helpful. Please attach HAR file if you raise a support ticket.

How do I create a HAR File to troubleshoot web download issues?

Best Regards,
Hiroki
0 Karma

Arjunasetty_Mur
Explorer

Hi Hiroki, 

Thank you for your great support and patience. 

Java script errors are capturing  but not providing meaningful message.

Gone through provided link and configuration already in place as per documentation, still not capturing the java script messages. 

What kind of java script error messages will it capture? 

If adrum.js loaded but application is not loaded will appD collects the error data? 

Please find the configuration screen shot and errors response

image.pngimage.png

Regards

Arjun

0 Karma

Hiroki_Ito
Contributor

Hi @Arjunasetty.Murahari,


No problem.

Captured javascript error is same as the one that appears on the console of developer tools.
Could you please check they are the same?
e.g.
src/page/XXX.js
Line 35:18: 'XXX' is not defined no-undef
Search for the keywords to learn more about each error.
In addition, please see the document below for how Browser RUM works.

Adrum.js is loaded at the same time with application, and AppD should collect the error data if adrum.js(3-b) and adrum-ext.js(6) are loaded.

Best Regards,
Hiroki
0 Karma

Arjunasetty_Mur
Explorer

Hi Hiroki, 

1. Is there any way / add custom script to the index.html such way that appD captures the AJAX 
Response for other than 200 http code? 

For example: 

image.png

image.png

2. I could see there is a small difference in urls will it cause any problem to capture more error data? 

App Dynamic documentation:

config.adrumExtUrlHttp = "http://cdn.appdynamics.com";
config.adrumExtUrlHttps = "https://cdn.appdynamics.com";
config.beaconUrlHttp = "http://pdx-col.eum-appdynamics.com";
config.beaconUrlHttps = "https://pdx-col.eum-appdynamics.com";

In our script urls:

config.adrumExtUrlHttp = 'http://' + hostName + '/shiponline/appd';
config.adrumExtUrlHttps = 'https://' + hostName + '/shiponline/appd';

config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
config.beaconUrlHttps = 'https://col.eum-appdynamics.com';

<script charset='UTF-8'>
// Load AppD scripts for test levels and production environments.
if (window.location.host.indexOf('localhost') != 0) {
window['adrum-start-time'] = new Date().getTime();
var hostName = window.location.host;
(function (config) {
if (window.location.host.indexOf('www.XXX.com') === 0) {
config.appKey = 'AD-AAB-XXX-YYY'; // Production Key
} else {
config.appKey = 'AD-AAB-XXX-YYY'; // Test Level Key
}
window["adrum-app-key"] = config.appKey;
config.adrumExtUrlHttp = 'http://' + hostName + '/shiponline/appd';
config.adrumExtUrlHttps = 'https://' + hostName + '/shiponline/appd';
config.fetch = true;
config.angular = true;
config.isZonePromise = true;
config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
config.xd = {enable: true};
config.spa = {"spa2": true};

})(window['adrum-config'] || (window['adrum-config'] = {}));

//Load Adrum.js file
var script = document.createElement('script');
script.type='text/javascript';
script.src='https://' + hostName + '/shiponline/appd/adrum.js';
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>

0 Karma

Hiroki_Ito
Contributor
1. Unfortunately, you can't capture Ajax Response.
There is a feature called custom data, but it only supports adding Ajax requests because JavaScript Agent doesn't intercept or expose the response from the request.
You can manually add userData for Ajax Response, but it requires you to change the code of the application and is complex to do so.
2. adrumExtUrlHttp/adrumExtUrlHttps are used to download JavaScript agent.
From the configuration, you are choosing self-hosting option, and you are hosting all JavaScript Agent files.
If JavaScript agent you host is very old or modified in some way, it can affect the behavior of the agent.
beaconUrlHttp/beaconUrlHttps are used to transmit metrics about your application to the EUM Server. If it is pointing to EUM server you are using, it should be fine.
https://col.eum-appdynamics.com is for SaaS, so the difference may not cause any problem.
Best Regards,
Hiroki
0 Karma

Arjunasetty_Mur
Explorer

thank you for your support. 

Is there a way to run the analytics query through the REST CALL? 

For example :  How I can run below query with date range / last 7 days/ last 30 days with rest api call? 

SELECT * FROM browser_records WHERE ajaxerror like "*status*5*" and appkey = "XXXX" and pagename="api.xxx.com/ship/v3"

If possible please provide some useful examples so that I can run utilize your examples. 

0 Karma

Hiroki_Ito
Contributor
You can use Analytics Events API to run the analytics query through the REST CALL.
Note that you need to create API keys and add permissions for Browser Requests.
You can see some examples of query in the document below.
You need to calculate the start time for last 7 days/30 days, but a query like below would work for you ADQL query.
 

curl -X POST "https://<events_service_endpoint>/events/query/?start=<ISO 8601 or Unix time for 7 days ago>&limit=1000" -H"X-Events-API-AccountName:<global account name>" -H"X-Events-API-Key:<Analytics API key.>" -H"Accept: application/vnd.appd.events+json;v=2" -H"Content-type: application/vnd.appd.events+json;v=2" -d "[{\"query\": \"SELECT * FROM browser_records WHERE ajaxerror like '*status*5*' AND appkey = 'XXXX' And pagename='api.xxx.com/ship/v3'\"}]"

 

* The Analytics Query API can return a maximum of 10,000 results. If you would like to retrieve and paginate over the data, you can use the scroll mode
Best Regards,
Hiroki
0 Karma

iamryan
Community Manager
Community Manager

Hello @Arjunasetty.Murahari,

Do you have any follow-up questions for @Hiroki.Ito? If so, please keep the conversation going. If not, please accept one of Hiroki's replies as the Accepted Solution so the community knows this question has an answer.

0 Karma
Get Updates on the Splunk Community!

Index This | How many sides does a circle have?

  March 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

New This Month - Splunk Observability updates and improvements for faster ...

What’s New? This month, we’re delivering several enhancements across Splunk Observability Cloud for faster and ...

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...