mirror of
https://github.com/valitydev/exporter-tech-metrics.git
synced 2024-11-06 00:15:21 +00:00
Fixing finding withdrawal data (#19)
* Fixing finding withdrawal data * Fixing regex for withdrawalId * Fixing logging machines failed data * Fixing regex for machines failed ids
This commit is contained in:
parent
1218eec297
commit
bce403a169
@ -28,6 +28,7 @@ public class MachinesFailedService {
|
||||
private final Map<String, Double> machinesFailedCountMap;
|
||||
private static final String WITHDRAWAL = "withdrawal";
|
||||
private static final String INVOICE = "invoice";
|
||||
private static final String AFTER_SLASH = "/\\d+$";
|
||||
|
||||
|
||||
public void registerMetrics() {
|
||||
@ -41,14 +42,13 @@ public class MachinesFailedService {
|
||||
var withdrawalIds = machinesFailedData.stream()
|
||||
.filter(w -> w.getMachineNs().contains(WITHDRAWAL))
|
||||
.map(MachinesFailedData::getMachineId)
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
list -> log.isDebugEnabled()
|
||||
? list.stream().limit(10).collect(Collectors.toList()) : list
|
||||
));
|
||||
log.debug("withdrawalIds {}", withdrawalIds);
|
||||
.map(id -> id.replaceAll(AFTER_SLASH, ""))
|
||||
.toList();
|
||||
log.debug("withdrawalIds size {}, first 10 withdrawalIds {}", withdrawalIds.size(),
|
||||
withdrawalIds.stream().limit(10).collect(Collectors.toList()));
|
||||
var withdrawalEntities = withdrawalRepository.getWithdrawalsMetrics(withdrawalIds);
|
||||
log.debug("withdrawalEntities {}", withdrawalEntities);
|
||||
log.debug("withdrawalEntities size {}, first 10 withdrawalEntities {}", withdrawalEntities.size(),
|
||||
withdrawalEntities.stream().limit(10).collect(Collectors.toList()));
|
||||
|
||||
var withdrawalAggregatedByMachineId = withdrawalEntities.stream()
|
||||
.collect(Collectors.toMap(WithdrawalsAggregatedMetricDto::getWithdrawalId,
|
||||
@ -71,14 +71,12 @@ public class MachinesFailedService {
|
||||
var invoiceIds = machinesFailedData.stream()
|
||||
.filter(i -> i.getMachineNs().contains(INVOICE))
|
||||
.map(MachinesFailedData::getMachineId)
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
list -> log.isDebugEnabled()
|
||||
? list.stream().limit(10).collect(Collectors.toList()) : list
|
||||
));
|
||||
log.debug("invoiceIds {}", invoiceIds);
|
||||
.toList();
|
||||
log.debug("invoiceIds size {}, first 10 invoiceIds {}", invoiceIds.size(),
|
||||
invoiceIds.stream().limit(10).collect(Collectors.toList()));
|
||||
var invoiceEntities = paymentRepository.getPaymentsStatusMetrics(invoiceIds);
|
||||
log.debug("invoiceEntities {}", invoiceEntities);
|
||||
log.debug("invoiceEntities size {}, first 10 invoiceEntities {}", invoiceEntities,
|
||||
invoiceEntities.stream().limit(10).collect(Collectors.toList()));
|
||||
|
||||
var invoiceAggregatedByMachineId = invoiceEntities.stream()
|
||||
.collect(Collectors.toMap(PaymentsAggregatedMetricDto::getInvoiceId,
|
||||
|
Loading…
Reference in New Issue
Block a user