|
|
|
@ -20,7 +20,6 @@ import lombok.Getter; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.thingsboard.server.common.data.ObjectType; |
|
|
|
import org.thingsboard.server.common.data.edqs.EdqsEventType; |
|
|
|
@ -43,18 +42,6 @@ public class EdqsStatsService { |
|
|
|
private final ConcurrentHashMap<TenantId, EdqsStats> statsMap = new ConcurrentHashMap<>(); |
|
|
|
private final StatsFactory statsFactory; |
|
|
|
|
|
|
|
@Scheduled(initialDelayString = "${queue.edqs.stats.print-interval-ms:300000}", |
|
|
|
fixedDelayString = "${queue.edqs.stats.print-interval-ms:300000}") |
|
|
|
private void reportStats() { |
|
|
|
if (statsMap.isEmpty()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
String values = statsMap.entrySet().stream() |
|
|
|
.map(kv -> "TenantId [" + kv.getKey() + "] stats [" + kv.getValue() + "]") |
|
|
|
.collect(Collectors.joining(System.lineSeparator())); |
|
|
|
log.info("EDQS Stats: {}", values); |
|
|
|
} |
|
|
|
|
|
|
|
public void reportEvent(TenantId tenantId, ObjectType objectType, EdqsEventType eventType) { |
|
|
|
statsMap.computeIfAbsent(tenantId, id -> new EdqsStats(tenantId, statsFactory)) |
|
|
|
.reportEvent(objectType, eventType); |
|
|
|
|