How to Detect a Drop to Zero in Segment Size

Suppose you have data coming from a number of sources, and you'd like to know if one of them shuts down, you can create a SegmentSizeDrift verse which will check if the segment size from a specific source dropped to zero.

{
  "YOUR-USER-ID": {
    "TEXT": {
      "fields": {...},
      "stanzas": {
        "name_of_stanza": {
          "metrics": [],
          "segment_by": [
            "source_of_text"
          ],
          "verses": [
            {
              "type": "SegmentSizeDrift",
              "min_anomaly_level": 1,
              "use_relative_sizes": true,
              "trend_directions": [
                "desc"
              ],
              "min_segment_size":0,
              "traget_min_segment_size": 0
            }
          ]
        }
      }
    }
  }
}

In this example we are looking for drifts in the size of segments, segmented according to the "source_of_text". Since we are not tracking a specific metric, but the size of the segments, the metrics param is left empty. By using the "use_relative_sizes" param set as true we use the segment's relative sizes in the relevant baseline segment. The trend_direction will filter only drops in the size of segment. Since we are trying to track if a segment drops to 0 in size, we need to set both the min_segment_size and traget_min_segment_size to 0 in order to catch this anomaly. Lastly the min_anomaly_level will only alert us on drops of 100 percent of the segment size.