You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/12/26 02:59:56 UTC
[GitHub] [inlong] Yizhou-Yang opened a new pull request, #7062: [INLONG-7061] [Sort] add dirty metric for doris connector
Yizhou-Yang opened a new pull request, #7062:
URL: https://github.com/apache/inlong/pull/7062
### Prepare a Pull Request
*(Change the title refer to the following example)*
- Title Example: [INLONG-XYZ][Component] Title of the pull request
- Fixes #7061 (https://github.com/apache/inlong/issues/7061)
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] Yizhou-Yang commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
Yizhou-Yang commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057173838
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -486,6 +497,17 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
throw ex;
}
+
+ if (multipleSink) {
+ String[] tableWithDb = tableIdentifier.split("\\.");
Review Comment:
the table identifier.split is used for multiple sink regular out data count, so I think it works for dirty data too...? or is there something i missed
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] Yizhou-Yang commented on pull request #7062: [INLONG-7061][Sort] Add dirty metric for Apache Doris connector
Posted by GitBox <gi...@apache.org>.
Yizhou-Yang commented on PR #7062:
URL: https://github.com/apache/inlong/pull/7062#issuecomment-1364959568
> you need add dirty metric like out metric
>
> ```java
> if (multipleSink) {
> String[] tableWithDb = tableIdentifier.split("\\.");
> metricData.outputMetricsWithEstimate(tableWithDb[0], null, tableWithDb[1],
> false, respContent.getNumberLoadedRows(), respContent.getLoadBytes());
> } else {
> metricData.invoke(respContent.getNumberLoadedRows(), respContent.getLoadBytes());
> }
> ```
thx, added a fix for whole db similar to this one
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057177523
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -503,6 +511,20 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
LOG.warn("Dirty sink failed", ex);
}
}
+
+ if (multipleSink) {
+ if (DirtyType.DESERIALIZE_ERROR.equals(dirtyType) || !(dirtyData instanceof RowData)) {
+ metricData.outputDirtyMetricsWithEstimate(null, null, null, rowSize, dataSize);
+ }
+ multipleDirtyHandler(dirtyData, rowSize, dataSize);
Review Comment:
duplication code with `metricData.outputDirtyMetricsWithEstimate(null, null, null, rowSize, dataSize);`
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057176958
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -503,6 +511,20 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
LOG.warn("Dirty sink failed", ex);
}
}
+
+ if (multipleSink) {
+ if (DirtyType.DESERIALIZE_ERROR.equals(dirtyType) || !(dirtyData instanceof RowData)) {
+ metricData.outputDirtyMetricsWithEstimate(null, null, null, rowSize, dataSize);
Review Comment:
why not to pass databse table ?
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #7062: [INLONG-7061][Sort] Add dirty metric for doris connector
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057041303
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -486,6 +489,10 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
throw ex;
}
+
+ long size = dirtyData.toString().getBytes(StandardCharsets.UTF_8).length;
Review Comment:
Dirty data metrics is needed based on table metrics.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057485987
##########
inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/metric/sub/SinkTableMetricData.java:
##########
@@ -50,6 +50,11 @@ public class SinkTableMetricData extends SinkMetricData implements SinkSubMetric
*/
private final Map<String, SinkMetricData> subSinkMetricMap = Maps.newHashMap();
+ /**
+ * The sub sink metric data container of sink metric data
+ */
+ private final Map<String, SinkMetricData> dirtySinkMetricMap = Maps.newHashMap();
+
Review Comment:
remove it, why add it?
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057478793
##########
inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/metric/sub/SinkTableMetricData.java:
##########
@@ -199,6 +199,25 @@ public void outputMetricsWithEstimate(String database, String schema, String tab
subSinkMetricData.invoke(rowCount, rowSize);
}
+ public void outputDirtyMetricsWithEstimate(String database, String schema, String table, boolean isSnapshotRecord,
+ long rowCount, long rowSize) {
+ if (StringUtils.isBlank(database) || StringUtils.isBlank(table)) {
+ invokeDirty(rowCount, rowSize);
+ return;
Review Comment:
lost `StringUtils.isBlank(schema)`
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057480671
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -512,17 +512,12 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
}
- if (multipleSink && !DirtyType.DESERIALIZE_ERROR.equals(dirtyType) && dirtyData instanceof RowData) {
- JsonNode rootNode;
- try {
- rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) dirtyData).getBinary(0));
- metricData.outputDirtyMetricsWithEstimate(
- jsonDynamicSchemaFormat.parse(rootNode, databasePattern),
- null, jsonDynamicSchemaFormat.parse(rootNode, tablePattern), rowSize, dataSize);
- } catch (Exception ex) {
- metricData.invokeDirty(rowSize, dataSize);
- }
- } else {
+ try {
+ JsonNode rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) dirtyData).getBinary(0));
+ metricData.outputDirtyMetricsWithEstimate(
+ jsonDynamicSchemaFormat.parse(rootNode, databasePattern),
+ null, jsonDynamicSchemaFormat.parse(rootNode, tablePattern), rowSize, dataSize);
Review Comment:
rowSize and dataSize should be rowSize = 1 and dataSize is byte length of dirtyData
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on pull request #7062: [INLONG-7061][Sort] Add dirty metric for doris connector
Posted by GitBox <gi...@apache.org>.
gong commented on PR #7062:
URL: https://github.com/apache/inlong/pull/7062#issuecomment-1364913091
you need add dirty metric like out metric
```java
if (multipleSink) {
String[] tableWithDb = tableIdentifier.split("\\.");
metricData.outputMetricsWithEstimate(tableWithDb[0], null, tableWithDb[1],
false, respContent.getNumberLoadedRows(), respContent.getLoadBytes());
} else {
metricData.invoke(respContent.getNumberLoadedRows(), respContent.getLoadBytes());
}
```
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1058690888
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -503,6 +512,42 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
LOG.warn("Dirty sink failed", ex);
}
}
+ metricData.invokeDirty(1, dirtyData.toString().getBytes(StandardCharsets.UTF_8).length);
+ }
+
+ private void handleMultipleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e) {
+ JsonNode rootNode = null;
+ try {
+ rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) dirtyData).getBinary(0));
+ } catch (Exception ex) {
+ LOG.warn("handle dirty data: rootnode is null", ex);
Review Comment:
It is needed to sink dirty data
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057176165
##########
inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/metric/sub/SinkTableMetricData.java:
##########
@@ -50,6 +50,11 @@ public class SinkTableMetricData extends SinkMetricData implements SinkSubMetric
*/
private final Map<String, SinkMetricData> subSinkMetricMap = Maps.newHashMap();
+ /**
+ * The sub sink metric data container of dirty sink metric data
+ */
+ private final Map<String, SinkTableMetricData> subSinkDirtyMap = Maps.newHashMap();
+
Review Comment:
not need add it, just use `subSinkMetricMap`.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] Yizhou-Yang commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
Yizhou-Yang commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057177991
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -503,6 +511,20 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
LOG.warn("Dirty sink failed", ex);
}
}
+
+ if (multipleSink) {
+ if (DirtyType.DESERIALIZE_ERROR.equals(dirtyType) || !(dirtyData instanceof RowData)) {
+ metricData.outputDirtyMetricsWithEstimate(null, null, null, rowSize, dataSize);
Review Comment:
bacause there is no database/table avaliable to parse since the dirty data can't be deserialized, so only add global count in this case
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #7062: [INLONG-7061][Sort] Add dirty metric for Apache Doris connector
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057111822
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -486,6 +497,17 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
throw ex;
}
+
+ if (multipleSink) {
Review Comment:
It is suggest to send the metic after the dirty data sink because the dirty sink maybe failed.
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -486,6 +497,17 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
throw ex;
}
+
+ if (multipleSink) {
+ String[] tableWithDb = tableIdentifier.split("\\.");
Review Comment:
It is not right because of the tableIdentifer is dynamic when it it multiplesink.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] gong commented on a diff in pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057554402
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -507,8 +512,35 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
LOG.warn("Dirty sink failed", ex);
}
}
+ metricData.invokeDirty(1, dirtyData.toString().getBytes(StandardCharsets.UTF_8).length);
+ }
+
+ private void handleMultipleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e) {
+ JsonNode rootNode = null;
+ try {
+ rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) dirtyData).getBinary(0));
+ } catch (Exception ex) {
+ LOG.warn("handle dirty data: rootnode is null", ex);
+ }
+
+ if (dirtySink != null) {
+ DirtyData.Builder<Object> builder = DirtyData.builder();
+ try {
+ builder.setData(dirtyData)
+ .setDirtyType(dirtyType)
+ .setLabels(jsonDynamicSchemaFormat.parse(rootNode, dirtyOptions.getLabels()))
+ .setLogTag(jsonDynamicSchemaFormat.parse(rootNode, dirtyOptions.getLogTag()))
+ .setDirtyMessage(e.getMessage())
+ .setIdentifier(jsonDynamicSchemaFormat.parse(rootNode, dirtyOptions.getIdentifier()));
+ dirtySink.invoke(builder.build());
+ } catch (Exception ex) {
+ if (!dirtyOptions.ignoreSideOutputErrors()) {
+ throw new RuntimeException(ex);
+ }
+ LOG.warn("Dirty sink failed", ex);
+ }
+ }
try {
- JsonNode rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) dirtyData).getBinary(0));
metricData.outputDirtyMetricsWithEstimate(
jsonDynamicSchemaFormat.parse(rootNode, databasePattern),
null, jsonDynamicSchemaFormat.parse(rootNode, tablePattern), 1,
Review Comment:
schema is null, It will always lost table level metric
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] EMsnap commented on a diff in pull request #7062: [INLONG-7061][Sort] Add dirty metric for doris connector
Posted by GitBox <gi...@apache.org>.
EMsnap commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057041536
##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -486,6 +489,10 @@ private void handleDirtyData(Object dirtyData, DirtyType dirtyType, Exception e)
}
throw ex;
}
+
+ long size = dirtyData.toString().getBytes(StandardCharsets.UTF_8).length;
+ metricData.invokeDirty(1, size);
Review Comment:
npe
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang merged pull request #7062: [INLONG-7061][Sort] Support table level metrics for Apache Doris connector and add dirty metrics
Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #7062:
URL: https://github.com/apache/inlong/pull/7062
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org