aboutsummaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/DummyService.java
blob: dde392f568ec0a68e6d3476780a793dd204d08e7 (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
// 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.Metric;
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 void consumeMetrics(MetricsParser.Collector consumer) {
        long timestamp = System.currentTimeMillis() / 1000;
        consumer.accept(new Metric(MetricId.toMetricId(METRIC_1), 5 * num + 1, timestamp));
        consumer.accept(new Metric(MetricId.toMetricId(METRIC_2), 1.3 * num + 1.05, timestamp));
    }

}