AWA Queue Utilization Trend

akshayashetty
Tera Contributor

Hi All,

 

I have a requirement to show the AWA queue utilization over time. The queue utilization is available in "awa_queue_metrics" table and this is being updated by scheduled scripts throughout the day. My requirement is to show the queue utilization trend over time. I am looking at possibility of showing the utilization at specific intervals (8am, 9am and so on) and also find the average of these values to show the average utilization for the day. This should be shown in a dashboard. I would appreciate any ideas on how to accomplish this.

 

1 REPLY 1

vaishali231
Tera Guru

Hey @akshayashetty 

You’re correct that reporting directly on awa_queue_metrics is unreliable because it stores irregular, point-in-time updates. This makes consistent hourly trends and averages difficult.

The most reliable approach is to capture utilization at fixed intervals and report on that dataset.

 

  Approach

 Without Performance Analytics

1. Create Snapshot Table

Create a custom table:
u_awa_queue_utilization_snapshot

Fields:

  • u_queue (Reference to AWA Queue)
  • u_utilization (Decimal)
  • u_snapshot_time (Date/Time)
  • u_date (Date)
  • u_hour (Integer 0–23)

This ensures clean time-based reporting.

 

2. Capture Data Hourly (Scheduled Job)

Run a Scheduled Script Execution every hour.

Script:

(function() {
   var now = new GlideDateTime();
   var currentDate = now.getLocalDate();
   var currentHour = parseInt(now.getHourLocalTime(), 10);
   // Get latest record per queue
   var agg = new GlideAggregate('awa_queue_metrics');
   agg.addAggregate('MAX', 'sys_created_on');
   agg.groupBy('queue');
   agg.query();
   while (agg.next()) {
       var latest = new GlideRecord('awa_queue_metrics');
       latest.addQuery('queue', agg.queue);
       latest.addQuery('sys_created_on', agg.getAggregate('MAX', 'sys_created_on'));
       latest.query();
       if (latest.next()) {
           var snap = new GlideRecord('u_awa_queue_utilization_snapshot');
           snap.initialize();
           snap.u_queue = latest.queue;
           snap.u_utilization = parseFloat(latest.utilization) || 0;
           snap.u_snapshot_time = now;
           snap.u_date = currentDate;
           snap.u_hour = currentHour;
           snap.insert();
       }
   }
})();

 

3. Reporting

 Trend (Line Chart)

  • Table: Snapshot table
  • X-axis: u_hour or u_snapshot_time
  • Aggregation: AVG(utilization)
  • Group by: Queue

 Daily Average (Single Score)

  • Filter: u_date = Today
  • Aggregation: AVG(utilization)

 

4. Dashboard

Add:

  • Line chart - Hourly utilization trend
  • Single score - Daily average
  • (Optional) Breakdown - Queue comparison

 

5. Performance Optimization

Create indexes on:

  • u_date
  • u_queue
  • u_snapshot_time

 

  With Performance Analytics

If PA is available:

  • Create Indicator on awa_queue_metrics
  • Aggregation: AVG(utilization)
  • Collection: Hourly

This eliminates the need for a custom table and provides better historical analytics.

 

*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

Regards

Vaishali Singh