Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo-catalano committed Jan 9, 2024
1 parent 49712dd commit b14c810
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ microservice-chart:
ADDER_RANGE_FAULT_THRESHOLD: "50"
REMOVER_SLOT_MINUTES: "12"
REMOVER_SLOT_FAULT_LIMIT: "6"
EXCLUDED_STATIONS: ""
OTEL_SERVICE_NAME: "pagopa-stand-in-manager"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
Expand Down
1 change: 1 addition & 0 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ microservice-chart:
ADDER_RANGE_FAULT_THRESHOLD: "50"
REMOVER_SLOT_MINUTES: "60"
REMOVER_SLOT_FAULT_LIMIT: "6"
EXCLUDED_STATIONS: ""
OTEL_SERVICE_NAME: "pagopa-stand-in-manager"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
Expand Down
1 change: 1 addition & 0 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ microservice-chart:
ADDER_RANGE_FAULT_THRESHOLD: "50"
REMOVER_SLOT_MINUTES: "60"
REMOVER_SLOT_FAULT_LIMIT: "6"
EXCLUDED_STATIONS: ""
OTEL_SERVICE_NAME: "pagopa-stand-in-manager"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=uat"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public class NodoMonitorService {
@Value("${adder.slot.minutes}")
private int slotMinutes;

// @Autowired private BlacklistStationsRepository blacklistStationsRepository;
@Value("${excludedStations}")
private String excludedStations;


// @Autowired private BlacklistStationsRepository blacklistStationsRepository;
@Autowired private Client kustoClient;
@Autowired private CosmosNodeDataRepository cosmosRepository;

Expand Down Expand Up @@ -88,10 +92,13 @@ public void getAndSaveData()
throws URISyntaxException, DataServiceException, DataClientException {
ZonedDateTime now = ZonedDateTime.now();
log.info("getAndSaveData [{}]", now);
List<String> excludedStations = new ArrayList<>();
List<String> excludedStationsList = new ArrayList<>();
if(excludedStations!= null && !excludedStations.isEmpty()){
excludedStationsList = Arrays.asList(excludedStations.split(","));
}

Map<String, Integer> totals = getCount(TOTALS_QUERY, excludedStations, now.minusMinutes(slotMinutes));
Map<String, Integer> faults = getCount(FAULT_QUERY, excludedStations, now.minusMinutes(slotMinutes));
Map<String, Integer> totals = getCount(TOTALS_QUERY, excludedStationsList, now.minusMinutes(slotMinutes));
Map<String, Integer> faults = getCount(FAULT_QUERY, excludedStationsList, now.minusMinutes(slotMinutes));
List<CosmosNodeCallCounts> stationCounts =
totals.entrySet().stream()
.map(
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ remover.range.fault.limit=6
aws.region=weu
aws.ses.user=[email protected]


excludedStations=${EXCLUDED_STATIONS}

#config.refresh.cron= */10 * * * * *
nodo.monitor.cron= */10 * * * * *
nodo.calc.cron= */10 * * * * *
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ remover.range.minutes=${REMOVER_SLOT_MINUTES}
# if ko is lesser than the threshold then station leaves in stand-in mode
remover.range.fault.limit=${REMOVER_SLOT_FAULT_LIMIT}

# excluded stations from monitor
excludedStations=${EXCLUDED_STATIONS}

aws.region=${AWS_REGION}
aws.ses.user=${AWS_SES_USER}
aws.mailto=${AWS_MAILTO}
Expand Down

0 comments on commit b14c810

Please sign in to comment.