From 6b150143e79c6ad7e5f1583c1f30ee5687da5f21 Mon Sep 17 00:00:00 2001 From: Anatoly Karlov Date: Thu, 17 Aug 2023 09:41:18 +0300 Subject: [PATCH] change map key --- .../dev/vality/exporter/limits/model/CustomTag.java | 5 +++++ .../vality/exporter/limits/service/LimitsService.java | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/vality/exporter/limits/model/CustomTag.java b/src/main/java/dev/vality/exporter/limits/model/CustomTag.java index 3b8d746..1b4ca40 100644 --- a/src/main/java/dev/vality/exporter/limits/model/CustomTag.java +++ b/src/main/java/dev/vality/exporter/limits/model/CustomTag.java @@ -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); + } } diff --git a/src/main/java/dev/vality/exporter/limits/service/LimitsService.java b/src/main/java/dev/vality/exporter/limits/service/LimitsService.java index 63841e0..a3d7fb4 100644 --- a/src/main/java/dev/vality/exporter/limits/service/LimitsService.java +++ b/src/main/java/dev/vality/exporter/limits/service/LimitsService.java @@ -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())); } }