Toggle menu

digestHistories()

Processes a named digest by batching history events and populating the relevant database tables and views. Only events added to the history since digestHistories was last called will be processed.

The default batch size is 250,000 events, which can be changed by setting the batchsize parameter.

When the digest runs, the started and finished properties are automatically updated.

This function is often used in an end point which can be called using a Scheduled Tasks. Where we have used digests to provide data for dashboards, the scheduled task generally calls the end point every five minutes.

Parameters

NameTypeDescription
nameString, requiredThe name of the digest to process
batchsizeInteger, optionalDefaults to 250,000

Returns

The response will indicate whether there is more work to do. cursorPosition holds the current place the digest has got to and is stored against each column. If any column has any more events to process then the overall allEventsProcessed will be false and you will need to call the digest method again to continue processing events.

NameTypeDescription
allEventsProcessedBooleanWill be false if there are more events to process. digestHistories should be called again
totalNewRowsCountIntegerThe number of new rows added by this operation
totalValueCountIntegerThe number of new values added by this operation
columnsObjectThe columns processed by this operation
columns.<digestname>.<columnname>ObjectInformation about this column
columns.<digestname>.<columnname>.valueCountIntegerThe number of new values added
columns.<digestname>.<columnname>.cursorPositionIntegerThe current position in the history the digest has reached
columns.<digestname>.<columnname>.allEventsProcessedBooleanWill be false if there are events still to process
columns.<digestname>.<columnname>.newRowsCountIntegerThe number of new rows added

Example

Request

function(params, credentials) {
    let resp = this.callWorkerMethod("history", "digestHistories", {
        "name": "exampledigest"
    });
    return resp;
}

Response

{
    "id": 8,
    "result": {
        "totalValueCount": 603,
        "columns": {
            "exampledigest.started": {
                "valueCount": 30,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.all_descriptions": {
                "valueCount": 151,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 30
            },
            "exampledigest.businesskey": {
                "valueCount": 30,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.first_response_time": {
                "valueCount": 30,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.all_descriptions.eventtime": {
                "valueCount": 151,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.all_descriptions.eventdescription": {
                "valueCount": 151,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.involved_users.involveduser": {
                "valueCount": 60,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            },
            "exampledigest.involved_users": {
                "valueCount": 0,
                "cursorPosition": 2963,
                "allEventsProcessed": true,
                "newRowsCount": 0
            }
        },
        "allEventsProcessed": true,
        "totalNewRowsCount": 30
    },
    "jsonrpc": "2.0"
}

Last modified on November 15, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon