@Override
        public AvgLabeledFunction storage2Entity(final Convert2Entity converter) {
            AvgLabeledFunction metrics = new AvgLabeledFunction() {
                @Override
                public AcceptableValue<DataTable> createNew() {
                    throw new UnexpectedException("createNew should not be called");
                }
            };
            metrics.setSummation(new DataTable((String) converter.get(SUMMATION)));
            metrics.setValue(new DataTable((String) converter.get(VALUE)));
            metrics.setCount(new DataTable((String) converter.get(COUNT)));
            metrics.setTimeBucket(((Number) converter.get(TIME_BUCKET)).longValue());
            metrics.setServiceId((String) converter.get(InstanceTraffic.SERVICE_ID));
            metrics.setEntityId((String) converter.get(ENTITY_ID));
            return metrics;
        }
Service ID is required for sort query.
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgLabeledFunction.java