History AuditLog API shows incorrect sequence of executions

Hi Team,

Process: sampleprocess.bpmn (10.0 KB)

While I was testing the above process, I’ve found that the order of activities/events executed was displayed was incorrect in the Cockpit > History > Audit Log.

Camunda Platform Version: v7.13.0-ee
Operating System: macOSCatalina


Root cause might be: Both the StartEvent and the UserTask has the same timestamp.


Request URI for cockpit: /api/engine/engine/default/history/activity-instance?firstResult=0&maxResults=50

Rest API: http://localhost:8086/engine-rest/history/activity-instance

RequestBody:

{
  "processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
  "sorting": [
    {
      "sortBy": "startTime",
      "sortOrder": "asc"
    }
  ]
}

Rest API response:

[
	{
		"id": "Activity_1q91p7o:747d0896-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Activity_1q91p7o",
		"activityName": "Make a Request",
		"activityType": "userTask",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": "747d0897-aeef-11eb-8576-725082c42043",
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": "demo",
		"startTime": "2021-05-07T10:18:23.970+0530",
		"endTime": "2021-05-07T10:19:13.425+0530",
		"durationInMillis": 49455,
		"canceled": false,
		"completeScope": false,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	},
	{
		"id": "Event_1p7skst:747d0895-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Event_1p7skst",
		"activityName": null,
		"activityType": "startEvent",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": null,
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": null,
		"startTime": "2021-05-07T10:18:23.970+0530",
		"endTime": "2021-05-07T10:18:23.970+0530",
		"durationInMillis": 0,
		"canceled": false,
		"completeScope": false,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	},
	{
		"id": "Activity_1427zqn:91f76ba7-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Activity_1427zqn",
		"activityName": "Control request",
		"activityType": "userTask",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": "91f76ba8-aeef-11eb-8576-725082c42043",
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": "demo",
		"startTime": "2021-05-07T10:19:13.426+0530",
		"endTime": "2021-05-07T10:19:16.113+0530",
		"durationInMillis": 2687,
		"canceled": false,
		"completeScope": false,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	},
	{
		"id": "Activity_18y9l5p:939193b0-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Activity_18y9l5p",
		"activityName": "Permission Denied",
		"activityType": "userTask",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": "939193b1-aeef-11eb-8576-725082c42043",
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": "demo",
		"startTime": "2021-05-07T10:19:16.114+0530",
		"endTime": "2021-05-07T10:19:18.812+0530",
		"durationInMillis": 2698,
		"canceled": false,
		"completeScope": false,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	},
	{
		"id": "Gateway_1adpfdx:939193af-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Gateway_1adpfdx",
		"activityName": "Has Permission?",
		"activityType": "exclusiveGateway",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": null,
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": null,
		"startTime": "2021-05-07T10:19:16.114+0530",
		"endTime": "2021-05-07T10:19:16.114+0530",
		"durationInMillis": 0,
		"canceled": false,
		"completeScope": false,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	},
	{
		"id": "Event_0snuj77:952d6966-aeef-11eb-8576-725082c42043",
		"parentActivityInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"activityId": "Event_0snuj77",
		"activityName": null,
		"activityType": "noneEndEvent",
		"processDefinitionKey": "sampleprocess",
		"processDefinitionId": "sampleprocess:2:5e174ed9-aeed-11eb-8576-725082c42043",
		"processInstanceId": "747ce184-aeef-11eb-8576-725082c42043",
		"executionId": "747ce184-aeef-11eb-8576-725082c42043",
		"taskId": null,
		"calledProcessInstanceId": null,
		"calledCaseInstanceId": null,
		"assignee": null,
		"startTime": "2021-05-07T10:19:18.813+0530",
		"endTime": "2021-05-07T10:19:18.813+0530",
		"durationInMillis": 0,
		"canceled": false,
		"completeScope": true,
		"tenantId": null,
		"removalTime": "2021-05-08T10:19:18.813+0530",
		"rootProcessInstanceId": "747ce184-aeef-11eb-8576-725082c42043"
	}
]

Hi @aravindhrs,

could be because of the same timestamp in the database.

You can find some background information here: History and Audit Event Log | docs.camunda.org.

Hope this helps, Ingo