summaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/DummyService.java
blob: ccbb237ae37a9899476a3847071a434620a25623 (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
32
33
34
// Copyright 2020 Oath Inc. 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.Metric;
import ai.vespa.metricsproxy.metric.Metrics;
import ai.vespa.metricsproxy.metric.model.MetricId;

/**
 * @author Unknown
 */
public class DummyService extends VespaService {
    public static final String NAME = "dummy";
    public static final String METRIC_1 = "c.test";
    public static final String METRIC_2 = "val";

    private final int num;

    public DummyService(int num, String configid) {
        super(NAME, NAME + num, configid);
        this.num = num;
    }

    @Override
    public Metrics getMetrics() {
        Metrics m = new Metrics();

        long timestamp = System.currentTimeMillis() / 1000;
        m.add(new Metric(MetricId.toMetricId(METRIC_1), 5 * num + 1, timestamp));
        m.add(new Metric(MetricId.toMetricId(METRIC_2), 1.3 * num + 1.05, timestamp));

        return m;
    }

}