Size in Bytes

The metric provides the size ofa desired topic on each Kafka broker at any given time.

Use cases

How much storage space is used by my topic?

It could be useful to know how much storage space is used for topic, for example:

  • to estimate space left and if new disk storage is needed

  • does topic grow too fast, and maybe it should be configured with smaller retention time or replication factor?

To do that, just use basic usage with the smallest time window and time step, it will show you size in bytes for the topic.

Request example
{
  "metric": "io.axual.stream/size_bytes",
  "stepSize": "PT1M",
  "timeWindow": "now/-PT1M",
  "aggregator": "sum",
  "filter": {
    "type": "AND",
    "filters": [
      {
        "type": "FIELD",
        "field": "environment",
        "operation": "EQUALS",
        "value": "dev"
      },
      {
        "type": "FIELD",
        "field": "stream",
        "operation": "EQUALS",
        "value": "payment-events-stream"
      }
    ]
  }
}
Response example
{
  "type": "UNGROUPED",
  "dataPoints": [
    {
      "timestamp": "2022-10-18T16:26:00",
      "value": 2228732,
      "labels": {},
      "unit": "Bytes"
    }
  ]
}

Basic usage

Please refer to the example topic size in bytes metric provided in API docs


This request is asking for the size in bytes of the topic payment-events-stream on environment dev between 2022-10-18T12:20:00Z and 2022-10-18T13:00:00Z with the step-size of 10 minutes.

Basic Request
{
  "metric": "io.axual.stream/size_bytes",
  "stepSize": "PT10M",
  "timeWindow": "2022-10-18T12:20:00Z/2022-10-18T13:00:00Z",
  "filter": {
    "type": "AND",
    "filters": [
      {
        "type": "FIELD",
        "field": "environment",
        "operation": "EQUALS",
        "value": "dev"
      },
      {
        "type": "FIELD",
        "field": "stream",
        "operation": "EQUALS",
        "value": "payment-events-stream"
      }
    ]
  }
}

The below part of sample response, represents the size of a topic on each kafka broker (pod) in bytes.

Basic Response
{
  "type": "UNGROUPED",
  "dataPoints": [
    {
      "timestamp": "2022-10-18T12:30:00",
      "value": 0,
      "labels": {
        "pod": "jupiter-kafka-1"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:40:00",
      "value": 149754,
      "labels": {
        "pod": "jupiter-kafka-1"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:50:00",
      "value": 546366,
      "labels": {
        "pod": "jupiter-kafka-1"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T13:00:00",
      "value": 772366,
      "labels": {
        "pod": "jupiter-kafka-1"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:30:00",
      "value": 0,
      "labels": {
        "pod": "jupiter-kafka-0"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:40:00",
      "value": 2000,
      "labels": {
        "pod": "jupiter-kafka-0"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:50:00",
      "value": 200000,
      "labels": {
        "pod": "jupiter-kafka-0"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T13:00:00",
      "value": 412000,
      "labels": {
        "pod": "jupiter-kafka-0"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:30:00",
      "value": 0,
      "labels": {
        "pod": "jupiter-kafka-2"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:40:00",
      "value": 146098,
      "labels": {
        "pod": "jupiter-kafka-2"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T12:50:00",
      "value": 592366,
      "labels": {
        "pod": "jupiter-kafka-2"
      },
      "unit": "Bytes"
    },
    {
      "timestamp": "2022-10-18T13:00:00",
      "value": 912366,
      "labels": {
        "pod": "jupiter-kafka-2"
      },
      "unit": "Bytes"
    }
  ]
}

This metric could be used to know how much storage space needed for the topic, how it’s distributed among brokers and how fast storage space is growing.

Advanced usage

Using aggregator

At this moment aggregators for this metric are not allowed.

Using groupBy

At this moment groupBy for this metric is not allowed.