Skip to content

Commit 87758fb

Browse files
committed
- fix logs
- add AdditionalAttributes to classified error
1 parent 52d8a01 commit 87758fb

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

flow/alerting/classifier.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,17 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
11571157
}
11581158
}
11591159

1160-
if _, ok := errors.AsType[*exceptions.MySQLUnsupportedPartialRowEventError](err); ok {
1160+
if partialRowEventError, ok := errors.AsType[*exceptions.MySQLUnsupportedPartialRowEventError](err); ok {
1161+
var additionalAttributes map[AdditionalErrorAttributeKey]string
1162+
if partialRowEventError.Schema != "" || partialRowEventError.Table != "" {
1163+
additionalAttributes = map[AdditionalErrorAttributeKey]string{
1164+
ErrorAttributeKeyTable: fmt.Sprintf("%s.%s", partialRowEventError.Schema, partialRowEventError.Table),
1165+
}
1166+
}
11611167
return ErrorNotifyBinlogPartialRowEventUnsupported, ErrorInfo{
1162-
Source: ErrorSourceMySQL,
1163-
Code: "UNSUPPORTED_PARTIAL_ROW_EVENT",
1168+
Source: ErrorSourceMySQL,
1169+
Code: "UNSUPPORTED_PARTIAL_ROW_EVENT",
1170+
AdditionalAttributes: additionalAttributes,
11641171
}
11651172
}
11661173

flow/alerting/classifier_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,5 +1253,8 @@ func TestMySQLUnsupportedPartialRowEventShouldBeNotifyPartialRowEventUnsupported
12531253
assert.Equal(t, ErrorInfo{
12541254
Source: ErrorSourceMySQL,
12551255
Code: "UNSUPPORTED_PARTIAL_ROW_EVENT",
1256+
AdditionalAttributes: map[AdditionalErrorAttributeKey]string{
1257+
ErrorAttributeKeyTable: "e2e_test.partial_rows",
1258+
},
12561259
}, errInfo)
12571260
}

flow/connectors/mysql/cdc.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func (c *MySqlConnector) PullRecords(
583583
attribute.String(otel_metrics.BinlogEventTypeKey, fmt.Sprintf("%s_%d", prefix, int(event.Header.EventType))),
584584
)))
585585
if _, loaded := c.warnedUnsupportedEventTypes.LoadOrStore(event.Header.EventType, struct{}{}); !loaded {
586-
c.logger.Warn("unsupported rows event", slog.Any("type", event.Header.EventType))
586+
c.logger.Warn("unsupported binlog event", slog.Any("type", event.Header.EventType))
587587
}
588588
}
589589

@@ -634,6 +634,10 @@ func (c *MySqlConnector) PullRecords(
634634
break
635635
}
636636
tableID, totalFragments, ok := parsePartialRowEventTableID(ev.Data)
637+
// tableIdToName tracking relies on TABLE_MAP_EVENT and
638+
// PARTIAL_ROW_DATA_EVENT coming within the same batch, so no checkpoints in between
639+
// Server sends events in groups with the usual sequence of begin - table map - rows - gtid/commit
640+
// So as of committing this, the unresolvable path is not expected to be hit
637641
sourceTableName, known := tableIdToName[tableID]
638642
if !ok || !known {
639643
// couldn't recover/resolve the table, fail loudly

flow/otel_metrics/otel_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ func (om *OtelManager) setupMetrics(ctx context.Context) error {
607607

608608
if om.Metrics.UnsupportedBinlogEventCounter, err = om.GetOrInitInt64Counter(BuildMetricName(UnsupportedBinlogEventName),
609609
metric.WithDescription(
610-
"Counter of unsupported binlog generic events seen on the CDC path, with `eventType` label "+
610+
"Counter of unsupported binlog events seen on the CDC path, with `eventType` label "+
611611
"holding the numeric binlog event type"),
612612
); err != nil {
613613
return err

0 commit comments

Comments
 (0)