-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TaskContext to tasks to be track e2e instant transfer information #204
Conversation
@@ -58,6 +61,8 @@ public class TasksService implements ITasksService, GracefulShutdownStrategy, In | |||
private IEnvironmentValidator environmentValidator; | |||
@Autowired | |||
private ICoreMetricsTemplate coreMetricsTemplate; | |||
@Autowired(required = false) | |||
private List<ITaskRegistrationDecorator> taskRegistrationInterceptors = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe taskRegistrationInterceptors > taskRegistrationDecorator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep decorator, usually decorator gives expectation that you are modifying something
interceptor not really it means you just react
mdcService.put(request.getTaskId(), 0L); | ||
mdcService.putType(request.getType()); | ||
mdcService.putSubType(request.getSubType()); | ||
|
||
for (ITaskRegistrationDecorator interceptor : taskRegistrationInterceptors) { | ||
request = interceptor.intercept(request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead request = decorator.decorate(request);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah sure, this was after rename :3
coreMetricsTemplate.registerDaoTaskDataSerialization(request.getType(), data.length, serializedData.getData().length); | ||
} | ||
|
||
byte[] data = request.getData() == null ? NULL_BLOB : request.getData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid this block, if both data and context are null / empty.
Just to avoid one more record in database for lightweight tasks.
|
||
public interface ITaskRegistrationDecorator { | ||
|
||
AddTaskRequest intercept(AddTaskRequest request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe intercept > decorate.
task_id BINARY(16) PRIMARY KEY NOT NULL, | ||
data_format INT NOT NULL, | ||
data LONGBLOB NOT NULL, | ||
task_context_format SMALLINT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the fixed length fields should be at the beginning of the table.
But it does not matter too much.
Besides we can probably only add columns to the end.
Context
TwTasks is missing propagated context. For example if a service receives a REST call and registers a tw-task as a side effect. This task loses the context. Adding TaskContext to the tw_task_data table. Shall be good enough.
One complication here:
The data column has non null constraint. Adding the context to this table is problematic now. Before, tasks with null data were not inserting anything in that table. But now it's quite reasonable to assume we might have tasks with no data but with some context. For tasks with no data, adding a dummy data in db of 1 byte "®"
IF some team creates a tw-tasks with the payload of this letter only. They might run into issues.
Checklist