public List<MetricDefinition> listMetrics(String regex) {
        return ValueColumnMetadata.INSTANCE.getAllMetadata()
                                           .entrySet()
                                           .stream()
                                           .filter(
                                               metadata ->
                                                   StringUtil.isNotEmpty(regex) ?
                                                       metadata.getKey().matches(regex) : true)
                                           .map(metadata -> new MetricDefinition(
                                                    metadata.getKey(),
                                                    typeOfMetrics(metadata.getKey()),
                                                    DefaultScopeDefine.catalogOf(metadata.getValue().getScopeId())
                                                )
                                           )
                                           .collect(Collectors.toList());
    }
MetricsMetadataQueryService provides the metadata of metrics to other modules.
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetricsMetadataQueryService.java