@@ -578,6 +578,12 @@ func (c *MySqlConnector) PullRecords(
578578 time .Now ().UTC ().Sub (time .UnixMicro (int64 (commitTs ))).Microseconds ())
579579 }
580580 }
581+ recordUnsupportedEvent := func (ctx context.Context , event * replication.BinlogEvent , prefix string ) {
582+ c .logger .Warn ("unsupported rows event" , slog .Any ("type" , event .Header .EventType ))
583+ otelManager .Metrics .UnsupportedBinlogEventCounter .Add (ctx , 1 , metric .WithAttributeSet (attribute .NewSet (
584+ attribute .String (otel_metrics .BinlogEventTypeKey , fmt .Sprintf ("%s_%d" , prefix , int (event .Header .EventType ))),
585+ )))
586+ }
581587
582588 lastEventAt := time .Now ()
583589 var mysqlParser * parser.Parser
@@ -647,10 +653,7 @@ func (c *MySqlConnector) PullRecords(
647653 slog .Uint64 ("eventType" , uint64 (mariadbPartialRowDataEvent )), slog .String ("table" , sourceTableName ))
648654 return exceptions .NewMySQLUnsupportedPartialRowEventError (byte (mariadbPartialRowDataEvent ), schemaName , tableName )
649655 default :
650- c .logger .Warn ("unknown generic event" , slog .Any ("type" , event .Header .EventType ))
651- otelManager .Metrics .UnsupportedBinlogEventCounter .Add (ctx , 1 , metric .WithAttributeSet (attribute .NewSet (
652- attribute .Int (otel_metrics .BinlogEventTypeKey , int (event .Header .EventType )),
653- )))
656+ recordUnsupportedEvent (ctx , event , "Generic" )
654657 }
655658 case * replication.QueryEvent :
656659 if ! inTx && gset == nil && event .Header .LogPos > pos .Pos {
@@ -868,6 +871,8 @@ func (c *MySqlConnector) PullRecords(
868871 }
869872 case replication .WRITE_ROWS_EVENTv0 , replication .UPDATE_ROWS_EVENTv0 , replication .DELETE_ROWS_EVENTv0 :
870873 return fmt .Errorf ("mysql v0 replication protocol not supported" )
874+ default :
875+ recordUnsupportedEvent (ctx , event , "Rows" )
871876 }
872877 }
873878 if event .Header .Timestamp > 0 {
@@ -876,6 +881,8 @@ func (c *MySqlConnector) PullRecords(
876881 int64 (event .Header .Timestamp ),
877882 )
878883 }
884+ default :
885+ recordUnsupportedEvent (ctx , event , "Untyped" )
879886 }
880887
881888 return nil
0 commit comments