Contents
Get ready for some great news CFers! FusionReactor 7.4 is now available for download.
This release includes instance manager support for CF2018 and Apache WildFly plus new monitoring for several ColdFusion TAGS, including CFLDAP, CFFTP amongst others (blog post), plus monitoring support for CF2018 Async functionality (blog post).
Let’s take a look at both.
In FusionReactor version 7.4.0, you get a new support for a number of ColdFusion tags. On both ColdFusion and Lucee, the following tags will now be tracked as a child transaction of the web request:
-
CFLDAP
-
CFFTP
-
CFMAIL
-
CFIMAP
-
CFPOP
This support allows you to spot if one of these tags would be slowing down a CFC / CFM call made within your CFML application. Before, you could only be able to see that a CFC / CFM call was slow. However, it did not explicitly identify what was causing this without using the production debugger and profiler.
For each tag, each attribute is tracked as a transaction property. What this means is that it allows you to see exactly what variables are being used by the tag. There is one exception to this: the password, which will not be tracked in FusionReactor.
Each tag \is tracked as a child request of the CFC/CFM script it was executed inside. Which means it will be visible in the relations tab of the request details. The child request will be generated in FusionReactor as soon as it begins executing, making it visible under the Requests activity page as a relation.
Below are examples for each tag running on ColdFusion 2018. For Lucee, the tag attributes will need to be modified.
CFLDAP
Example script
This code snippet attempts to authenticate against an LDAP server with a given user and set a variable of isAuthenticated based on the output of the tag, when we run this snippet inside a CFC we see:
As you can see here, the query performed on the LDAP server and that no error occurred. We can then assume there was no issue authenticating with the server.
When viewing the properties tab of the CFLDAP transaction, you are able to view all the attributes used in the tag:
CFFTP
Example script
This code snippet will establish a connection to the FTP server, retrieve a list of the directories and then terminate the connection. Running this code in a CFC will result in:
Here, it is possible to see the 3 distinct CFFTP calls and the time taken for each, each call will have a unique set of attributes and these are seen in the properties tab of the transaction details.
CFMAIL
Example script
This example code will send a simple test email. Running this code inside a CFC file will result in the following:
You can see a CFMAIL tag with the action send tracked in FusionReactor.
CFIMAP
Example script
This script will establish a connection to the IMAP server then close this connection. Running this code snippet in a CFC file will result in:
You can see one request per CFIMAP call, so we see the connection open and close tags as separate requests. Like the CFMAIL, tag attributes used in each tag are tracked as properties of the transaction.
CFPOP
Example script
This script will query the mail server for the size of the user’s inbox and print this in the browser. Running this in a CFC will result in:
You can see here the CFIMAP call took 4.9 seconds to execute, with an older version of FusionReactor it would be difficult to track down why CFM script was slow to execute without debugging server but now it is easy to see.
FusionReactor 7.4.1 adds support for Async functionality in ColdFusion 2018
With the release of FusionReactor 7.4.1, we now have support to track async requests in ColdFusion 2018, these async functions will be tracked as a child transaction of the web request.
This addition allows you to track whether any asynchronous calls you are making in your CFC/CFM files are slowing down your requests. In previous versions of FusionReactor, the only way this was possible was to use the debugger or profiler.
Now, each async call is tracked as a child request of the CFC/CFM script it was executed inside. This makes it visible in the relations tab of the requests details, due to the nature of the asynchronous call. It is only possible to link a transaction back to the CFC/CFM script after the async function is complete.
Below is an example of a series of async calls run as both named and anonymous functions.
Example CFML
<cfscript>
getAccountBalance = function () {
var balance = 120000;
return balance;
}
function payCreditCardBill(accountBalance) {
var ccBill = 1890;
return accountBalance – ccBill;
}
payEMIs = function (accountBalance) {
var mortgageEMI = 1000;
var carLeaseEMI = 750;
var healthInsuranceEMI = 250;
return accountBalance – (mortgageEMI + carLeaseEMI + healthInsuranceEMI);
}
miscellenousExpenses = function (accountBalance) {
var shopping = 1500;
var clubExpense = 1000;
var casinoExpense = 2000;
return accountBalance – (shopping + clubExpense + casinoExpense);
}
function checkBalanceaccountBalance) {
while (accountBalance > 5000) {
accountBalance = miscellenousExpenses(accountBalance);
writeOutput(“checkBalance = ” & accountBalance & “<br/>”);
} if (accountBalance < 5000)
throw(message = “Account balance below threshold!!!”, type = “info”);
}
errorHandler = function (error) {
if (error.message contains “Account balance below threshold!”) {
return “You have reached your spending limit!”;
}
}
future = runAsync(getAccountBalance).then(payCreditCardBill).then(payEMIs).then(miscellenousExpenses).then(checkBalance).error(errorHandler);
writeOutput(future.get());
</cfscript>
Request tracking in FusionReactor
In FusionReactor, we can see each async request is tracked under the master request syncBankExample.cfm. The flavor of each request will be CFUDF the tag used by ColdFusion to execute these functions.
An important thing to note is that how you declare your function to run asynchronously will change the accuracy of how well FusionReactor will track the async call. The methods payCreditCardBill and checkBalance can be referenced by name in the description of the runAsync method, however, every other method cannot. This is because payCreditCardBill and checkBalance are declared with the following syntax:
function functionName() { … )
The other asynchronous functions use the syntax:
functionName = function () { … }
For this reason, we highly recommend that anyone using the asynchronous calls uses the syntax “function name() { … }”
Summary
With Adobe ColdFusion 2018 out, it will be interesting to see how FR will continue to keep up with a growing, thriving ColdFusion platform. It is so great to see the folks at Intergral helping keep CF alive with such a great application performance monitoring tool.
This article is based on the official FusionReactor website information on the new version.
[contentopin]