Stats Tools
Summarize
Summary of Stats Tools
Stats Tools is a performance evaluation feature in ServiceNow that records statistics for system activities affecting performance, such as query executions, script runs, and transactions. It is activated by default and requires theadminrole to activate or upgrade. The tool relies on thecom.snc.jrobinplugin and adds diagnostic modules underSystem Diagnostics > Stats, including Slow Queries, Slow Scripts, and Slow Transactions.
Show less
Key Features
- Activity Pattern Tables: Stats Tools aggregates unique activity executions over time into pattern tables—
sysquerypattern,sysscriptpattern, andsystransactionpattern. Each record includes timing metrics and example details to help identify performance issues. - Filtering by Application Scope: Logs can be filtered by application scope, allowing focused debugging on transactions originating from specific scopes, such as slow scripts or events.
- Caching and Persistence: Activity patterns are cached immediately upon recording and are later persisted to their respective pattern tables. Flushing server caches clears unpersisted activity data.
- Aggregation Examples: Query executions aggregate into query pattern records; business rule executions aggregate into script pattern records; background jobs aggregate into transaction pattern records; user interactions like clicking "New" on the Incident list are recorded as transaction patterns.
- Metrics and Metadata: Each pattern includes total and average execution times, aggregated over all executions, along with example execution metadata for detailed analysis.
- Characterization of Activity Types:
- Transactions: Include server-side and relevant client-side activities. Metrics include total server load time (excluding semaphore and session waits). Transactions are identified by URL, type, processor, form/list actions, and related tables.
- Scripts: Include scripts evaluated by GlideScopedEvaluator. Jelly scripts are identified by file path and line number; other scripts by table and sysid.
- Queries: Include prepared statements executed by GlideDBI. Identified by MongoDB query types and detailed components like selected columns, where clauses, and limits.
Practical Benefits for ServiceNow Customers
Stats Tools enables customers to proactively monitor and analyze system performance by tracking detailed statistics on slow queries, scripts, and transactions. This helps identify bottlenecks and optimize system responsiveness. Filtering by application scope allows targeted troubleshooting. Understanding activity patterns and their aggregated metrics supports informed decisions to improve platform efficiency and user experience.
To aid in performance evaluation, the Stats Tools records statistics for system activities that affect performance such as the execution of queries, scripts, and transactions.
Activity patterns are immediately recorded to a cache and are later persisted to their pattern table. If you flush server caches, then recorded activities that have not been persisted are cleared. The following are examples of pattern records.
- Each time a query is executed that meets the recording and persistence threshold it is aggregated and stored as a query pattern record.
- Each time a particular business rule is executed it aggregates to a script pattern record.
- Each time a particular background job runs it aggregates into a unique transaction pattern record.
- Each click of the New button on the Incidents list counts as a list type transaction pattern with specific form action.
Metrics
Metrics include total and average times of interest per unique execution pattern over the total execution count. Metrics are aggregated with each new instance of the unique activity and persisted to the pattern record.
Metadata
Example data from specific executions are included on each pattern to identify execution details.
Characterizations of each activity type
| Transactions |
Any transaction type includes server-side and related client-side transactions. Metrics include Total server load time, which aggregates the total server-side time excluding semaphore and session wait times. It also aggregates relevant server transaction times that are found on the syslog_transaction table. Transaction types:
|
| Scripts |
Any script activity type includes scripts evaluated by GlideScopedEvaluator. Script Types:
|
| Queries |
Any query activity includes prepared statements executed by GlideDBI. Query Types: All queries are identified by MongoDB query or insert, update, or select statements, as well as other components of the statement like selected columns, where clause, unions, column sets, and limits. |