class DeviceSessionMeasurementDimension implements MeasurementDimension {

        @Override
        public DimensionDefinition getDefinition() {
            return CommonDimensionDefinition.agg;
        }

        @Override
        public DataType getValueType() {
            return new ObjectType();
        }

        @Override
        public ConfigMetadata getParams() {
            return new DefaultConfigMetadata();
        }

        @Override
        public boolean isRealTime() {
            return false;
        }

        private AggregationQueryParam createQuery(MeasurementParameter parameter) {<FILL_FUNCTION_BODY>}

        @Override
        public Publisher<? extends Object> getValue(MeasurementParameter parameter) {
            AggregationQueryParam queryParam = createQuery(parameter);
            String format = parameter.getString("format", "yyyy-MM-dd");
            DateTimeFormatter formatter = DateTimeFormat.forPattern(format);

            return timeSeriesManager
                .getService(metric)
                .aggregation(queryParam)
                .map(data -> SimpleMeasurementValue.of(
                    data.getLong("count", 0),
                    data.getString("time", ""),
                    data.getString("time").map(formatter::parseMillis).orElse(0L)
                ))
                .sort()
                .take(parameter.getInt("limit", 30));
        }
    }

            return AggregationQueryParam
                .of()
                .agg("deviceId", "count", DISTINCT_COUNT)
                .groupBy(parameter.getInterval("interval", parameter.getInterval("time", null)),
                         parameter.getString("format", "yyyy-MM-dd"))
                .from(parameter.getDate("from", TimeUtils.parseDate("now-1d")))
                .to(parameter.getDate("to").orElseGet(Date::new))
                .filter(q -> q
                    .is("name", "duration")
                    //产品ID
                    .is("productId", parameter.getString("productId", null))
                    //设备ID
                    .is("deviceId", parameter.getString("deviceId", null))
                );

        
<methods>public void <init>(org.jetlinks.community.dashboard.DashboardDefinition, org.jetlinks.community.dashboard.ObjectDefinition) ,public Mono<org.jetlinks.community.dashboard.Measurement> getMeasurement(java.lang.String) ,public Flux<org.jetlinks.community.dashboard.Measurement> getMeasurements() <variables>private org.jetlinks.community.dashboard.DashboardDefinition dashboardDefinition,private Map<java.lang.String,org.jetlinks.community.dashboard.Measurement> measurements,private org.jetlinks.community.dashboard.ObjectDefinition objectDefinition