Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2020 12:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sending FusionReactor Tracked Transaction Metrics To The Cloud Dashboard With Lucee CFML
// Get the running FusionReactor API (FRAPI) instance from the FRAPI factory class.
// --
// Java Docs:
frapi = createObject( "java", "com.intergral.fusionreactor.api.FRAPI" )
// ------------------------------------------------------------------------------- //
// ------------------------------------------------------------------------------- //
// By default, FusionReactor will use the name of the application as defined in the
// Application.cfc ColdFusion framework component. However, we can set the name
// programmatically.
frapi.setTransactionApplicationName( "FRAPI-Testing" );
// By default, FusionReactor will calculate the transaction name based on the request
// context. It actually "understands" the fact that we're using Framework One (FW/1)
// in production and uses the "action" value as the transaction name. That's the
// beauty of using an APM product that is embedded within the ColdFusion and CFML
// community. That said, we can set the transaction name programmatically.
// --
// See Framework Support:
frapi.setTransactionName( "testing-cloud-transaction-metrics" );
// ------------------------------------------------------------------------------- //
// ------------------------------------------------------------------------------- //
try {
// Let's explicitly wrap a segment of our code in a custom, tracked transaction.
// This way, we can see how this code executes in the context of parent request.
subtransaction = frapi.createTrackedTransaction( "demo-segment" );
// When a custom Transaction is explicitly created in the ColdFusion code,
// FusionReactor sends the Transaction data to the CLOUD dashboard; however, by
// default, it doesn't send the METRICS about that Transaction to the CLOUD
// dashboard. This means that we can see the Transaction in the Tracing and the
// data-tables; but, we can't graph it in our custom graphs. In order to do this,
// we have to explicitly set the Transaction-related metrics to be cloud-enabled.
frapi.enableCloudMetric( "/transit/txntracker/demo-segment/active/activity" );
frapi.enableCloudMetric( "/transit/txntracker/demo-segment/active/time" );
frapi.enableCloudMetric( "/transit/txntracker/demo-segment/history/activity" );
frapi.enableCloudMetric( "/transit/txntracker/demo-segment/history/time" );
// frapi.enableCloudMetric( "/transit/txntracker/demo-segment/error/activity" );
// frapi.enableCloudMetric( "/transit/txntracker/demo-segment/error/time" );
sleep( randRange( 500, 1500 ) );
} finally {
<!--- ------------------------------------------------------------------------------ --->
<!--- ------------------------------------------------------------------------------ --->
// Simulate regular throughput / traffic to this endpoint by refreshing.
function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment