title: Prometheus gauge did not change value - Spring boot
body: <p>I have spring boot app with soap client that is checking is some app is alive.
  If the app is alive i am setting the gauge to 1 otherwise i am setting it to 0.
  The problem is when i start the app and i send the request and the response is ok i see in prometheus that the gauge value is 1, but when i stop the server and i send another request i expect that the gauge value should be 0 but it is 1 again.</p>
  
  <p>Here is my code. I have tried with atomic integer too but still problems.</p>
  
  <pre><code> @Autowired
   MeterRegistry meterRegistry;
  
  
    public void callWebService() throws IOException {
  
  String request = "message";
  List&lt;String&gt; list = convertUsingJava8(url);
  for (String string : list) {
    // AtomicInteger n = meterRegistry.gauge(string, new AtomicInteger(0));
    // Gauge shit = Gauge.build().name(string).help("shit").register();
    StringEntity stringEntity;
    stringEntity = new StringEntity(request, "UTF-8");
    stringEntity.setChunked(true);
    HttpPost httpPost = new HttpPost(string);
    httpPost.setEntity(stringEntity);
    try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
      HttpResponse response = null;
      response = httpClient.execute(httpPost);
      StringBuilder total = getMessage(response);
      System.out.println(total.toString());
      if (total.toString().contains("true")) {
        // shit.set(1.0);
        // meterRegistry.counter(string).increment();
        meterRegistry.gauge(string, 1);
        // n.getAndSet(1);
        // System.out.println(n);
        // meterRegistry.gauge(string, 1);
      }
    } catch (IOException e) {
      System.gc();
      meterRegistry.gauge(string, 0);
      // shit.set(0.0);
      // n.getAndSet(0);
      // System.out.println(n);
      // meterRegistry.gauge(string, 0);
      e.getMessage();
    }
  }
  
  }
  </code></pre>