Get Activity Instance Statistics
Retrieves runtime statistics of a given process definition, grouped by activities.
These statistics include the number of running activity instances, optionally the number of failed jobs and also optionally the number of incidents either grouped by incident types or for a specific incident type.
Note: This does not include historic data.
Method
GET /process-definition/{id}/statistics
GET /process-definition/key/{key}/statistics
(returns statistics for the latest version of the process definition which belongs to no tenant)
GET /process-definition/key/{key}/tenant-id/{tenant-id}/statistics
(returns statistics for the latest version of process definition for tenant)
Parameters
Path Parameters
Name | Description |
---|---|
id | The id of the process definition. |
key | The key of the process definition (the latest version thereof) to be retrieved. |
tenant-id | The id of the tenant the process definition belongs to. |
Query Parameters
Name | Description |
---|---|
failedJobs | Whether to include the number of failed jobs in the result or not. Valid values are true or false . |
incidents | Valid values for this property are true or false . If this property has been set to true the result will include the corresponding number of incidents for each occurred incident type. If it is set to false , the incidents will not be included in the result. |
incidentsForType | If this property has been set with any incident type (i.e., a String value) the result will only include the number of incidents for the assigned incident type. See the User Guide for a list of incident types. |
Note: The query parameters incidents
and incidentsForType
are exclusive. It is not possible to send a request with both query parameters. In that case the response will be a bad request.
Result
A JSON array containing statistics results per activity. Each object has the following properties:
Name | Value | Description |
---|---|---|
id | String | The id of the activity the results are aggregated for. |
instances | Number | The total number of running instances of this activity. |
failedJobs | Number | The total number of failed jobs for the running instances. Note: Will be 0 (not null ), if failed jobs were excluded. |
incidents | Array | Each item in the resulting array is an object which contains the following properties:
incidents or incidentsForType were excluded. Furthermore, the array will be also empty if no incidents were found.
|
Response Codes
Code | Media type | Description |
---|---|---|
200 | application/json | Request successful. |
400 | application/json | If both query parameters incidents and incidentsForType were set. See the Introduction for the error response format. |
404 | application/json | Process definition with given key does not exist. See the Introduction for the error response format. |
Examples
Request with Query Parameter failedJobs=true
GET /process-definition/aProcessDefinitionId/statistics?failedJobs=true
GET /process-definition/key/aProcessDefinitionKey/statistics?failedJobs=true
Response
[{"id":"anActivity",
"instances":123,
"failedJobs":42,
"incidents": []
},
{"id":"anotherActivity",
"instances":124,
"failedJobs":43,
"incidents": []}]
Request with Query Parameter incidents=true
GET /process-definition/aProcessDefinitionId/statistics?incidents=true
GET /process-definition/key/aProcessDefinitionKey/statistics?incidents=true
Response
[{"id":"anActivity",
"instances":123,
"failedJobs":0,
"incidents":
[
{"incidentType":"failedJob", "incidentCount": 42 },
{"incidentType":"anIncident", "incidentCount": 20 }
]
},
{"id":"anotherActivity",
"instances":124,
"failedJobs":0,
"incidents":
[
{ "incidentType":"failedJob", "incidentCount": 43 },
{ "incidentType":"anIncident", "incidentCount": 22 }
{ "incidentType":"anotherIncident", "incidentCount": 15 }
]
}]
Request with Query Parameter incidentsForType=anIncident
GET /process-definition/aProcessDefinitionId/statistics?incidentsForType=anIncident
GET /process-definition/key/aProcessDefinitionKey/statistics?incidentsForType=anIncident
Response
[{"id":"anActivity",
"instances":123,
"failedJobs":0,
"incidents":
[
{"incidentType":"anIncident", "incidentCount": 20 }
]
},
{"id":"anotherActivity",
"instances":124,
"failedJobs":0,
"incidents": []
}]