I’m trying to get a list of Closed workflows that have failed, of a specific type of workflow, with a certain time filter.
This is what I have:
ListClosedWorkflowExecutionsRequest closedWorkflowExecutionsRequest = ListClosedWorkflowExecutionsRequest
.newBuilder()
.setNamespace(namespace)
.setStartTimeFilter(
StartTimeFilter
.newBuilder()
.setEarliestTime(
Timestamps
.fromMillis(System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(startTimeMinutes))
)
.setLatestTime(
Timestamps
.fromMillis(System.currentTimeMillis())
)
.build()
)
//status filter is empty for some reason
.setStatusFilter(
StatusFilter
.newBuilder()
.setStatus(WORKFLOW_EXECUTION_STATUS_FAILED)
.build()
)
.setTypeFilter(
WorkflowTypeFilter
.newBuilder()
.setName(workflowType)
.build()
)
.build();
System.out.println(
"Request type filter: " + closedWorkflowExecutionsRequest.getTypeFilter() + "\n" +
"Request time filter: " + closedWorkflowExecutionsRequest.getStartTimeFilter() + "\n" +
"Request status filter: " + closedWorkflowExecutionsRequest.getStatusFilter() + "\n" +
"Request namespace filter: " + closedWorkflowExecutionsRequest.getNamespace()
);
Now, the issue here is that the status filter is not being applied. If we check the output of the system out line:
Request type filter: name: "MyWorkflow"
Request time filter: earliest_time {
seconds: 1692265753
nanos: 549000000
}
latest_time {
seconds: 1692524953
nanos: 551000000
}
Request status filter:
Request namespace filter: default
Found 118 workflows
Now the interesting thing is, if I call setTypeFilter()
before setStatusFilter()
, the type filter is now empty but the status filter isn’t.
Request type filter:
Request time filter: earliest_time {
seconds: 1692269939
nanos: 39000000
}
latest_time {
seconds: 1692529139
nanos: 42000000
}
Request status filter: status: WORKFLOW_EXECUTION_STATUS_FAILED
Request namespace filter: default
Found 96 workflows
It seems that I can only have one of these filters applied at the same time, however this makes no sense as I can run this query by hand through the temporal UI and it works fine, so clearly there is no limitation on the gRPC server. Am I doing something wrong?