aboutsummaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/main/java/ai/vespa/metricsproxy/service/DummyHealthMetricFetcher.java
blob: 310626b328d457c998d0687b6d343bdb26e69ac5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.service;

import ai.vespa.metricsproxy.metric.HealthMetric;

/**
 * Dummy class used for getting health status for a vespa service that has no HTTP service
 * for getting health status
 *
 * @author hmusum
 */
public class DummyHealthMetricFetcher extends RemoteHealthMetricFetcher {

    /**
     * @param service The service to fetch metrics from
     */
    DummyHealthMetricFetcher(VespaService service) {
        super(service, 0);
    }

    /**
     * Connect to remote service over http and fetch metrics
     */
    public HealthMetric getHealth(int fetchCount) {
        if (service.isAlive()) {
            return HealthMetric.getOk("Service is running - pid check only");
        } else {
            return HealthMetric.getDown("Service is not running - pid check only");
        }
    }
}