private LinkedList<Map<String, TraceLogMetric>> transformValues(LinkedList<Map<String, Metrics>> values) {
        LinkedList<Map<String, TraceLogMetric>> result = new LinkedList<>();
        for (Map<String, Metrics> value : values) {
            if (value == null) {
                result.add(null);
                continue;
            }
            value.forEach((name, m) -> {
                Map<String, TraceLogMetric> r = new HashMap<>();
                result.add(r);
                if (m instanceof LongValueHolder) {
                    r.put(name, new TraceLogMetric(m.getTimeBucket(), new Number[] {((LongValueHolder) m).getValue()}));
                } else if (m instanceof IntValueHolder) {
                    r.put(name, new TraceLogMetric(m.getTimeBucket(), new Number[] {((IntValueHolder) m).getValue()}));
                } else if (m instanceof DoubleValueHolder) {
                    r.put(name, new TraceLogMetric(m.getTimeBucket(), new Number[] {((DoubleValueHolder) m).getValue()}));
                } else if (m instanceof LabeledValueHolder) {
                    DataTable dt = ((LabeledValueHolder) m).getValue();
                    TraceLogMetric l = new TraceLogMetric(
                        m.getTimeBucket(), dt.sortedValues(Comparator.naturalOrder())
                                             .toArray(new Number[0]));
                    l.labels = dt.sortedKeys(Comparator.naturalOrder()).toArray(new String[0]);
                    r.put(name, l);
                } else {
                    log.warn("Unsupported metrics {}", m);
                }
            });
        }
        return result;
    }
A metrics window, based on AlarmRule#period. This window slides with time, just keeps the recent N(period)
buckets.
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java