class_docstr: Collects metrics and sends them directly to metrics service.
class_docstr_tok: ["Collects","metrics","and","sends","them","directly","to","metrics","service","."]
docstr: Calls BatchPutMetrics directly on the metrics service.
docstr_tok: ["Calls","BatchPutMetrics","directly","on","the","metrics","service","."]
code: def _send_metrics(self, metrics):
      """Calls BatchPutMetrics directly on the metrics service."""
      while metrics:
          batch, metrics = (
              metrics[:BATCH_SIZE],
              metrics[BATCH_SIZE:],
          )
          request = self._construct_batch_put_metrics_request(batch)
          response = self._metrics_client.batch_put_metrics(**request)
          errors = response["Errors"] if "Errors" in response else None
          if errors:
              message = errors[0]["Message"]
              raise Exception(
                  f'{len(errors)} errors with message "{message}"'
              )
  
imports: from __future__ import absolute_import
  import datetime
  import logging
  import os
  import time
  import threading
  import queue
  import dateutil.tz
  from sagemaker.session import Session
label_desc: Use image node_id 4 for calling the _SyncMetricsSink obj's underlying member method code with example usage: obj._send_metrics(metrics) without return types