|
|
|
@ -16,7 +16,6 @@ |
|
|
|
package org.thingsboard.server.common.data.debug; |
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.NoArgsConstructor; |
|
|
|
|
|
|
|
@ -27,18 +26,18 @@ public class DebugSettings { |
|
|
|
private static DebugSettings DEBUG_OFF = new DebugSettings(false, 0); |
|
|
|
private static DebugSettings DEBUG_FAILURES = new DebugSettings(true, 0); |
|
|
|
|
|
|
|
public DebugSettings(boolean debugFailures, long debugAllUntil) { |
|
|
|
this.debugFailures = debugFailures; |
|
|
|
this.debugAll = false; |
|
|
|
this.debugAllUntil = debugAllUntil; |
|
|
|
public DebugSettings(boolean failuresEnabled, long allEnabledUntil) { |
|
|
|
this.failuresEnabled = failuresEnabled; |
|
|
|
this.allEnabled = false; |
|
|
|
this.allEnabledUntil = allEnabledUntil; |
|
|
|
} |
|
|
|
|
|
|
|
@Schema(description = "Debug failures. ", example = "false") |
|
|
|
private boolean debugFailures; |
|
|
|
private boolean failuresEnabled; |
|
|
|
@Schema(description = "Debug All. Used as a trigger for updating debugAllUntil.", example = "false") |
|
|
|
private boolean debugAll; |
|
|
|
private boolean allEnabled; |
|
|
|
@Schema(description = "Timestamp of the end time for the processing debug events.") |
|
|
|
private long debugAllUntil; |
|
|
|
private long allEnabledUntil; |
|
|
|
|
|
|
|
public static DebugSettings off() {return DebugSettings.DEBUG_OFF;} |
|
|
|
|
|
|
|
@ -50,11 +49,11 @@ public class DebugSettings { |
|
|
|
|
|
|
|
public static DebugSettings all() { |
|
|
|
var ds = new DebugSettings(); |
|
|
|
ds.setDebugAll(true); |
|
|
|
ds.setAllEnabled(true); |
|
|
|
return ds; |
|
|
|
} |
|
|
|
|
|
|
|
public DebugSettings copy(long maxDebugAllUntil) { |
|
|
|
return new DebugSettings(debugFailures, debugAll ? maxDebugAllUntil : Math.min(debugAllUntil, maxDebugAllUntil)); |
|
|
|
return new DebugSettings(failuresEnabled, allEnabled ? maxDebugAllUntil : Math.min(allEnabledUntil, maxDebugAllUntil)); |
|
|
|
} |
|
|
|
} |
|
|
|
|