in pkg/output/shipper/shipper.go [109:121]
func (s *ShipperOutput) send() error {
if s.conn == nil {
return fmt.Errorf("connection is not established to: %s", s.config.Address)
}
ctx, cancel := context.WithTimeout(context.Background(), s.config.Timeout)
defer cancel()
_, err := s.client.PublishEvents(ctx, &messages.PublishRequest{Events: s.batch})
if err != nil {
return fmt.Errorf("publish events failed: %w", err)
}
s.batch = s.batch[0:0]
return nil
}