Skip to content
Prev Previous commit
Next Next commit
add more logging for parsing failures
  • Loading branch information
cjerad committed Apr 7, 2022
commit ab10afa0b5225174d0fffa901b9ce0b42caaffcf
5 changes: 4 additions & 1 deletion src/pkg/event/aggregatedparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (p AggregatedParser) Parse(ctx context.Context, str string) terminator.Even
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("event.parser"))

if str == "" {
logging.FromContext(ctx).Warn("nothing to parse")
return noop{}
}

Expand All @@ -49,11 +50,13 @@ func (p AggregatedParser) Parse(ctx context.Context, str string) terminator.Even
}
}

logging.FromContext(ctx).Error("failed to parse")

md := AWSMetadata{}
if err := json.Unmarshal([]byte(str), &md); err != nil {
logging.FromContext(ctx).
With("error", err).
Error("failed to parse SQS message metadata")
Error("failed to unmarshal message metadata")
return noop{}
}
return noop(md)
Expand Down