gong commented on code in PR #7069:
URL: https://github.com/apache/inlong/pull/7069#discussion_r1057215717
##########
inlong-sort/sort-connectors/mongodb-cdc/src/main/java/org/apache/inlong/sort/cdc/mongodb/DebeziumSourceFunction.java:
##########
@@ -485,7 +501,20 @@ public void run(SourceContext<T> sourceContext) throws
Exception {
@Override
public void deserialize(SourceRecord record,
Collector<T> out) throws Exception {
- if (sourceMetricData != null) {
+ if (sourceMetricData != null && record != null
&& migrateAll) {
+ Struct value = (Struct) record.value();
+ Struct source =
value.getStruct(MongoDBEnvelope.NAMESPACE_FIELD);
+ if (null == source) {
+ source =
value.getStruct(RecordUtils.DOCUMENT_TO_FIELD);
+ }
+ String dbName =
source.getString(MongoDBEnvelope.NAMESPACE_DATABASE_FIELD);
+ String collectionName =
+
source.getString(MongoDBEnvelope.NAMESPACE_COLLECTION_FIELD);
+ SnapshotRecord snapshotRecord =
SnapshotRecord.fromSource(source);
+ boolean isSnapshotRecord =
(SnapshotRecord.TRUE == snapshotRecord);
+ sourceMetricData
+ .outputMetricsWithEstimate(dbName,
collectionName, isSnapshotRecord, value);
Review Comment:
ref to
[https://github.com/apache/inlong/pull/7007](https://github.com/apache/inlong/pull/7007).
you need dynamic to pass label value, new String[]{dbName, collectionName}.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]