class DeviceStatusMeasurementProvider extends StaticMeasurementProvider {


    private final MeterRegistry registry;

    public DeviceStatusMeasurementProvider(MeterRegistryManager registryManager,
                                           LocalDeviceInstanceService instanceService,
                                           TimeSeriesManager timeSeriesManager,
                                           EventBus eventBus) {
        super(DeviceDashboardDefinition.instance, DeviceObjectDefinition.status);

        addMeasurement(new DeviceStatusChangeMeasurement(timeSeriesManager, eventBus));

        addMeasurement(new DeviceStatusRecordMeasurement(instanceService, timeSeriesManager));

        registry = registryManager.getMeterRegister(DeviceTimeSeriesMetric.deviceMetrics().getId(),
                                                    "target", "msgType", "productId");
    }

    @Subscribe("/device/*/*/online")
    public Mono<Void> incrementOnline(DeviceMessage msg) {
        return Mono.fromRunnable(() -> {
            String productId = parseProductId(msg);
            registry
                .counter("online", "productId", productId)
                .increment();
        });
    }

    @Subscribe("/device/*/*/offline")
    public Mono<Void> incrementOffline(DeviceMessage msg) {<FILL_FUNCTION_BODY>}

    private String parseProductId(DeviceMessage msg) {
        return msg
            .getHeader("productId")
            .map(String::valueOf)
            .orElse("unknown");
    }
}

        return Mono.fromRunnable(() -> {
            String productId = parseProductId(msg);
            registry
                .counter("offline", "productId", productId)
                .increment();
        });
    
<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