cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AppDynamics JS Agent API

texirv020302
Creator

Hi,

I am trying to achieve the below tasks. Can you tell me how to do it

- Fire AppDyanmics JS API to report key metrics for each of the events
- View and organize metrics on AppDyanmics Dashboard
- providing code snippet below
- can you tell me how to fir it

passOrfailPopup(rankEvent, occurrences, isSwimming, isNew, dataList) {
let passOrDelete = "";
let that = this;
let clickEvent = true;
if (isSwimming) {
$("#blockChangePopWith").find('.kendoContent').text("Overlap exists. Please confirm.");
$("#sports").show();
passOrDelete = "Delete";
} else {
$("#blockChangePopWith").find('.kendoContent').text("Are you sure you want pass show(s)?");
$("#sports").hide();
passOrDelete = "pass";
}
$("#blockChangePopWith" + ' .kPopUpTitle').text('Scheduling');
let dialog = $("#blockChangePopWith").data("kendoWindow").center().open();
let occurrencesCount = that.spanFilterCount(occurrences);

$("#passOK").text(passOrDelete + " (" + occurrencesCount + ")");
$("#passOK").unbind().click(function () {
if (clickEvent) {
dialog.close();
that.requestStart();
setTimeout(function () {

var emptyOccurence = { "event": [], "index": [] }
clickEvent = false;
that.spanRemoveFind(occurrences);
let occurenceEventList = that.getSourceEvents(occurrences);
that.removeItems(occurrences, false);
//that.timeSwimming(rankEvent,(new Date(rankEvent.start)),(new Date(rankEvent.end)),isNew,occurenceEventList,true);
let result = that.spanOverlapSwimming(rankEvent, isNew, occurrences, true, dataList, []);

let eventList = that.selectedSlotEvent;
that.selectedSlotEvent = result.lastAddedEvent;


that.requestEnd();
}, 0);
}
});
$("#failBlock").unbind().click(function () {
//var revert=true;
//that.scheduleService.revertEvent(revert);
if (clickEvent) {
clickEvent = false;

if (that.selectedSlotEvent[0])
that.editEvent(that.selectedSlotEvent[0]);
else
that.editEventEmty({})

dialog.close();
}
setTimeout(function () {
if ($('#tabClickCheck').text() == "1") {
$('#showDisplayName').focus();
$('#tabClickCheck').text('0');
}
}, 1000);
});
$("#sports").unbind().click(function () {
if (clickEvent) {
dialog.close();
that.requestStart();
setTimeout(function () {
var emptyOccurence = { "event": [], "index": [] }
clickEvent = false;
let slotAvailable = that.checkAvailabilityInsideOverlap(occurrences);
let occurenceEvent = { "event": [], "index": [] }
if (that.matchTimesWithOccurrence(rankEvent, occurrences)) {
that.timeSwimming(rankEvent, (new Date(slotAvailable.start)), (new Date(slotAvailable.end)), isNew, occurenceEvent, true, false);
} else if (that.matchStartTimeWithOccurrence(rankEvent, occurrences)) {
let endTime = new Date(occurrences[0].start);
let clonedEnd = new Date(occurrences[0].clonedStart);
clonedEnd.setHours(endTime.getHours(), endTime.getMinutes(), endTime.getSeconds());
let clonedStart = new Date(clonedEnd);
clonedStart.setTime(clonedStart.getTime() - rankEvent.eventDuration);
rankEvent.eventActualStart = clonedStart;
rankEvent.eventActualEnd = clonedEnd;
let searchDomain = that.searchDomainCheck(rankEvent, rankEvent.event, that._schedulerDataSource._data, true);
if (searchDomain.searchDateFallCheck) {
that.spanStartTimeOverlapSwimming(rankEvent, occurrences[0], isNew, occurenceEvent, true, dataList, []);
//that.startTimeOverlapSwimming(rankEvent,occurrences[0].start,isNew,emptyOccurence,false);
} else {
that.singleButtonDialog("You cannot perform this action. Please refine your search in order to display more data");
}
} else {
if (slotAvailable.isAvailable) {
let spanList = that.getSpanEventList(dataList, rankEvent.event);
if (spanList.length != 1) {
let sortData = that.arrangeArrayUsingStartDateTime(spanList);
let spanPosition = sortData.indexOf(rankEvent.event);
sortData.splice(spanPosition, 1);
that.removeItems(sortData, false);
rankEvent.event.isForward = false;
rankEvent.event.isReverse = false;
// change need to do undo redo
}
that.timeSwimming(rankEvent, (new Date(slotAvailable.start)), (new Date(slotAvailable.end)), isNew, occurenceEvent, true, false);
} else {

let startTime = new Date(occurrences[occurrences.length - 1].end);
let clonedStart = new Date(rankEvent.eventActualStart);
clonedStart.setHours(startTime.getHours(), startTime.getMinutes(), startTime.getSeconds());
let clonedEnd = new Date(clonedStart);
clonedEnd.setTime(clonedStart.getTime() + rankEvent.eventDuration);
rankEvent.eventActualStart = clonedStart;
rankEvent.eventActualEnd = clonedEnd;
let searchDomain = that.searchDomainCheck(rankEvent, rankEvent.event, that._schedulerDataSource._data, true);
if (searchDomain.searchDateFallCheck) {
that.spanEndTimeOverlapSwimming(rankEvent, occurrences[occurrences.length - 1], isNew, occurenceEvent, true, dataList, []);
//endTimeOverlapSwimming //spanEndTimeOverlapSwimming
//that.endTimeOverlapSwimming(rankEvent,occurrences[occurrences.length-1].end,isNew,occurenceEvent,true);
} else {
that.singleButtonDialog("You cannot perform this action. Please refine your search in order to display more data");
}
}
}
//that.getScheduler().select(null);
$('div[data-uid="' + rankEvent.event.uid + '"]').addClass('k-state-selected');
let eventList = that.selectedSlotEvent;

that.requestEnd();
}, 0);
}
setTimeout(function () {
if ($('#tabClickCheck').text() == "1") {
$('#showDisplayName').focus();
$('#tabClickCheck').text('0');
}
}, 1000);

});


}

1 REPLY 1

Gaurav.Soni
AppDynamics Team (Retired)

Hi,

 

For the description, it's unclear what you are trying to pass to eum as custom data. But What I can guess is that in an event you would like to pass a custom data to eum which you will like to later use in your dashboard.

 

To attach a custom data you will basically need to have a base page, ajax or virtual page event. Unless The custom data are attached to a request, so the event needs to be a base page, ajax or virtual page event.

 

With JS API you can report an event as manually and then let the custom data configuration to attach the data to their specific custom events(raised via API).

 

I am attaching a sample.html file which creates a custom virtual page event and also associates a custom data to the event whenever it triggered before reporting it to EUM collector.

 

Regards,

Gaurav Soni



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.