class_docstr: Dispatch alerts to the alert processor.
class_docstr_tok: ["Dispatch","alerts","to","the","alert","processor","."]
docstr: Dispatch a single alert to the alert processor.
docstr_tok: ["Dispatch","a","single","alert","to","the","alert","processor","."]
code: def _dispatch_alert(self, alert):
      """Dispatch a single alert to the alert processor."""
      alert.attempts += 1
      LOGGER.info(
          "Dispatching %s to %s (attempt %d)",
          alert,
          self.alert_proc,
          alert.attempts,
      )
      MetricLogger.log_metric(
          ALERT_MERGER_NAME, MetricLogger.ALERT_ATTEMPTS, alert.attempts
      )
  
      record_payload = json.dumps(
          alert.dynamo_record(), default=list, separators=(",", ":")
      )
  
      if len(record_payload) <= self.MAX_LAMBDA_PAYLOAD_SIZE:
          # The entire alert fits in the Lambda payload - send it all
          payload = record_payload
      else:
          # The alert is too big - the alert processor will have to pull it from Dynamo
          payload = json.dumps(alert.dynamo_key)
  
      self.lambda_client.invoke(
          FunctionName=self.alert_proc,
          InvocationType="Event",
          Payload=payload,
          Qualifier="production",
      )
  
      alert.dispatched = datetime.utcnow()
      self.table.mark_as_dispatched(alert)
  
file_path: streamalert/streamalert/alert_merger/main.py
imports: from datetime import datetime
  import json
  import os
  import boto3
  from streamalert.shared.alert import Alert, AlertCreationError
  from streamalert.shared.alert_table import AlertTable
  from streamalert.shared.logger import get_logger
  from streamalert.shared.metrics import ALERT_MERGER_NAME, MetricLogger
label_desc: Use image node_id 5 for calling the AlertMerger obj's underlying member method code with example usage: obj._dispatch_alert(alert) without return types