@Override
    public ExpressionResult visitMetric(MQEParser.MetricContext ctx) {
        ExpressionResult result = new ExpressionResult();
        String metricName = ctx.metricName().getText();
        Optional<ValueColumnMetadata.ValueColumn> valueColumn = ValueColumnMetadata.INSTANCE.readValueColumnDefinition(
            metricName);
        if (valueColumn.isEmpty()) {
            result.setType(ExpressionResultType.UNKNOWN);
            result.setError("Metric: [" + metricName + "] does not exist.");
            return result;
        }

        this.includeMetrics.add(metricName);

        if (ctx.parent instanceof MQEParser.TopNOPContext) {
            result.setType(ExpressionResultType.UNKNOWN);
            result.setError("Unsupported operation: [top_n] in alarm expression.");
            return result;
        }
        Column.ValueDataType dataType = valueColumn.get().getDataType();

        MQEValues mockMqeValues = new MQEValues();
        MQEValue mqeValue = new MQEValue();
        mqeValue.setEmptyValue(true);
        mockMqeValues.getValues().add(mqeValue);
        result.getResults().add(mockMqeValues);
        result.setType(ExpressionResultType.TIME_SERIES_VALUES);
        if (dataType == Column.ValueDataType.COMMON_VALUE) {
            return result;
        } else if (dataType == Column.ValueDataType.LABELED_VALUE) {
            result.setLabeledResult(true);
            return result;
        } else {
            result.setType(ExpressionResultType.UNKNOWN);
            result.setError("Metric does not supported in alarm, metric: [" + metricName + "] is not a common or labeled metric.");
            return result;
        }
    }
Used for verify the alarm expression and get the metrics name when read the alarm rules.
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/expr/rt/AlarmMQEVerifyVisitor.java