change map key

This commit is contained in:
Anatoly Karlov 2023-08-17 09:41:18 +03:00
parent 49d0134715
commit 6b150143e7
2 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,7 @@ public class CustomTag {
public static final String STATUS_TAG = "status";
public static final String WALLET_ID_TAG = "wallet_id";
public static final String WALLET_NAME_TAG = "wallet_name";
public static final String CONFIG_ID_TAG = "config_id";
public static Tag providerId(String providerId) {
return Tag.of(PROVIDER_ID_TAG, providerId);
@ -71,4 +72,8 @@ public class CustomTag {
public static Tag walletName(String walletName) {
return Tag.of(WALLET_NAME_TAG, walletName);
}
public static Tag configId(String configId) {
return Tag.of(CONFIG_ID_TAG, configId);
}
}

View File

@ -25,7 +25,13 @@ public class LimitsService {
public void registerMetrics() {
var limitsDataByInterval = openSearchService.getLimitsDataByInterval();
for (var limitsData : limitsDataByInterval) {
var id = limitsData.getMachine().getId() + "." + limitsData.getPayment().getId();
var id = String.format(
"%s.%s.%s.%s.%s",
limitsData.getLimit().getConfigId(),
limitsData.getLimit().getRoute().getProviderId(),
limitsData.getLimit().getRoute().getTerminalId(),
limitsData.getLimit().getShopId(),
limitsData.getLimit().getChange().getCurrency());
gauge(limitsBoundaryAggregatesMap, Metric.LIMITS_BOUNDARY, id, getTags(limitsData), limitsData.getLimit().getBoundary());
gauge(limitsAmountAggregatesMap, Metric.LIMITS_AMOUNT, id, getTags(limitsData), limitsData.getLimit().getAmount());
}
@ -49,6 +55,7 @@ public class LimitsService {
CustomTag.terminalId(dto.getLimit().getRoute().getTerminalId()),
CustomTag.providerId(dto.getLimit().getRoute().getProviderId()),
CustomTag.currency(dto.getLimit().getChange().getCurrency()),
CustomTag.shopId(dto.getLimit().getShopId()));
CustomTag.shopId(dto.getLimit().getShopId()),
CustomTag.configId(dto.getLimit().getConfigId()));
}
}