Skip to content

Commit

Permalink
fixed prometheus reload
Browse files Browse the repository at this point in the history
  • Loading branch information
matjaz99 committed Jan 16, 2023
1 parent 8516eaa commit 2fbdb29
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 2.4.5-SNAPSHOT

* [CHANGE] Moved all configuration parameters from configuration view to providers

## 2.4.4-SNAPSHOT

* [CHANGE] Removed statistics view (content moved elsewhere)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
import si.matjazcerkvenik.alertmonitor.data.DAO;
import si.matjazcerkvenik.alertmonitor.model.*;
import si.matjazcerkvenik.alertmonitor.model.config.ProviderConfig;
import si.matjazcerkvenik.alertmonitor.model.prometheus.PrometheusHttpClient;
import si.matjazcerkvenik.alertmonitor.model.prometheus.PrometheusHttpClientPool;
import si.matjazcerkvenik.alertmonitor.util.*;
import si.matjazcerkvenik.alertmonitor.util.Formatter;
import si.matjazcerkvenik.alertmonitor.web.WebhookMessage;
import si.matjazcerkvenik.simplelogger.SimpleLogger;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;

public abstract class AbstractDataProvider implements IParamChangedCallback {
public abstract class AbstractDataProvider implements IParamChangedCallback, Serializable {

private static final long serialVersionUID = 477894562015341L;

protected SimpleLogger logger = LogFactory.getLogger();

Expand Down Expand Up @@ -78,6 +80,7 @@ public void updateParam(String key, String newValue) {
} else if (key.equalsIgnoreCase(PrometheusDataProvider.DP_PARAM_KEY_CLIENT_POOL_SIZE)) {

}
if (prometheusHttpClientPool == null) return;
prometheusHttpClientPool.destroy();
providerConfig.setParam(key, newValue);
logger.info("AbstractDataProvider: updateParam: " + newValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void processIncomingEvent(WebhookMessage m) {
@Override
public String reloadPrometheusAction() {

LogFactory.getLogger().debug("PrometheusDataProvider: reloadPrometheusAction called");
LogFactory.getLogger().info("PrometheusDataProvider: reloadPrometheusAction called on " + providerConfig.getName());

PrometheusHttpClient api = prometheusHttpClientPool.getClient();

Expand Down
8 changes: 6 additions & 2 deletions src/main/webapp/providers/providers.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<p:outputLabel value="Data providers" style="font-weight: bold; font-size: 24px;"/>

<h:form id="providersForm">


<p:accordionPanel multiple="true"
widgetVar="multiple"
Expand All @@ -25,6 +25,8 @@
<p:outputLabel value="Alarms: #{p.allActiveAlarmsCount}" style="margin-left: 20px; font-size: 12px;" />
</f:facet>

<h:form id="providersForm">

<p:panelGrid columns="2">

<p:outputLabel value="Provider ID: " class="boldtext"/>
Expand Down Expand Up @@ -68,12 +70,14 @@
</p:column>
</p:dataTable>

</h:form>

<br/>

</p:tab>
</p:accordionPanel>

</h:form>


</ui:define>
</div>
Expand Down

0 comments on commit 2fbdb29

Please sign in to comment.