# Log Batch

Launch stage: GA

`POST /api/2.0/mlflow/runs/log-batch`

Logs a batch of metrics, params, and tags for a run. If any data failed to be persisted, the server will respond
 with an error (non-200 status code).

 In case of error (due to internal server error or an invalid request), partial data may be written.

 You can write metrics, params, and tags in interleaving fashion, but within a given entity type are guaranteed to
 follow the order specified in the request body.

 The overwrite behavior for metrics,  params, and tags is as follows:

 * Metrics: metric values are never overwritten. Logging a metric (key, value, timestamp) appends to the set of values
 for the metric with the provided key.

 * Tags: tag values can be overwritten by successive writes to the same tag key. That is, if multiple tag values
 with the same key are provided in the same API request, the last-provided tag value is written. Logging the same
 tag (key, value) is permitted. Specifically, logging a tag is idempotent.

 * Parameters: once written, param values cannot be changed (attempting to overwrite a param value will result in an
 error). However, logging the same param (key, value) is permitted. Specifically, logging a param is idempotent.

 Request Limits
 -------------------------------
 A single JSON-serialized API request may be up to 1 MB in size and contain:

 * No more than 1000 metrics,  params, and tags in total

 * Up to 1000 metrics

 * Up to 100  params

 * Up to 100 tags

 For example, a valid request might contain 900 metrics, 50 params, and 50 tags, but logging 900 metrics, 50 params,
 and 51 tags is invalid.

 The following limits also apply to metric, param, and tag keys and values:

 * Metric keys, param keys, and tag keys can be up to 250 characters in length

 * Parameter and tag values can be up to 250 characters in length

API scopes: mlflow

## Request body

- `run_id` (string, optional)
  ID of the run to log under
- `metrics` (array of object, optional)
  Metrics to log. A single request can contain up to 1000 metrics, and up to 1000
   metrics, params, and tags in total.
  - `key` (string, optional)
    The key identifying the metric.
  - `value` (double, optional)
    The value of the metric.
  - `timestamp` (int64, optional)
    The timestamp at which the metric was recorded.
  - `step` (int64, optional)
    The step at which the metric was logged.
    Default: `0`
  - `dataset_name` (string, optional)
    The name of the dataset associated with the metric.
     E.g. “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3”
  - `dataset_digest` (string, optional)
    The dataset digest of the dataset associated with the metric,
     e.g. an md5 hash of the dataset that uniquely identifies it
     within datasets of the same name.
  - `model_id` (string, optional)
    The ID of the logged model or registered model version associated with
     the metric, if applicable.
  - `run_id` (string, optional)
    The ID of the run containing the metric.
- `params` (array of object, optional)
  Params to log. A single request can contain up to 100 params, and up to 1000
   metrics, params, and tags in total.
  - `key` (string, optional)
    Key identifying this param.
  - `value` (string, optional)
    Value associated with this param.
- `tags` (array of object, optional)
  Tags to log. A single request can contain up to 100 tags, and up to 1000
   metrics, params, and tags in total.
  - `key` (string, optional)
    The tag key.
  - `value` (string, optional)
    The tag value.

## Request

```json
{
  "metrics": [
    {
      "key": "mae",
      "timestamp": 1552550804,
      "value": 2.5
    },
    {
      "key": "rmse",
      "timestamp": 1552550804,
      "value": 2.7
    }
  ],
  "params": [
    {
      "key": "model_class",
      "value": "LogisticRegression"
    }
  ],
  "run_id": "2a14ed5c6a87499199e0106c3501eab8"
}
```

## Response

```json
{}
```

