-
Notifications
You must be signed in to change notification settings - Fork 2
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
[yugabyte/yugabyte-db#26069] Custom metrics implementation for multi task model #165
Conversation
@@ -1086,13 +1086,6 @@ public static AutoCreateMode parse(String value, String defaultValue) { | |||
public static final Field SOURCE_INFO_STRUCT_MAKER = CommonConnectorConfig.SOURCE_INFO_STRUCT_MAKER | |||
.withDefault(PostgresSourceInfoStructMaker.class.getName()); | |||
|
|||
public static final Field TASK_ID = Field.create("task.id") |
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.
This was removed since we already have a task.id
field in the CommonConnectorConfig
of type STRING
- we are now reusing the same config.
@@ -123,9 +124,10 @@ public ChangeEventSourceCoordinator<PostgresPartition, PostgresOffsetContext> st | |||
final PostgresValueConverter valueConverter = valueConverterBuilder.build(typeRegistry); | |||
|
|||
schema = new PostgresSchema(connectorConfig, defaultValueConverter, topicNamingStrategy, valueConverter); | |||
this.taskContext = new PostgresTaskContext(connectorConfig, schema, topicNamingStrategy, connectorConfig.taskId()); | |||
this.taskContext = new PostgresTaskContext(connectorConfig, schema, topicNamingStrategy, connectorConfig.getTaskId()); |
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.
This change is simply to use the existing method to get the task ID.
@@ -21,9 +21,9 @@ public class PostgresPartition extends AbstractPartition implements Partition { | |||
private static final String SERVER_PARTITION_KEY = "server"; | |||
|
|||
private final String serverName; | |||
private final int taskId; | |||
private final String taskId; |
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.
Task ID was added in #163 as an integer but since we are reusing the existing one in CommonConnectorConfig
, keeping it as String
would simplify things as we will not need unnecessary type casts.
Problem
Currently, the connector follows a single task single partition model and thus uses the
DefaultChangeEventSourceMetricsFactory
which doesn't let us override the metric object names. Since we cannot override names, this causes an issue when we go for the multi task model as there's a conflict in the metric object names if a task registers its metric objects and subsequent tasks try to register their metric objects too.Solution
This is resolved by adding a custom metrics implementation which lets us customise things accordingly for a multi task model. This is done by following the example of metrics implemented by SqlServerConnector at https://github.com/yugabyte/debezium/tree/2.5.2.Final/debezium-connector-sqlserver/src/main/java/io/debezium/connector/sqlserver/metrics
This closes yugabyte/yugabyte-db#26069