aboutsummaryrefslogtreecommitdiffstats
path: root/slobrok/src/vespa/slobrok/server/metrics_producer.h
blob: fd1fc70651b2baafb242cce1d37e7daa096585b9 (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "rpchooks.h"
#include <vespa/vespalib/net/http/metrics_producer.h>
#include <vespa/vespalib/net/http/simple_metrics_producer.h>

class FNET_Transport;

namespace slobrok {

class MetricsProducer : public vespalib::MetricsProducer
{
private:
    const RPCHooks &_rpcHooks;
    RPCHooks::Metrics _lastMetrics;
    vespalib::SimpleMetricsProducer _producer;
    uint32_t _startTime;
    uint32_t _lastSnapshotStart;
    std::unique_ptr<FNET_Task> _snapshotter;

public:
    vespalib::string getMetrics(const vespalib::string &consumer) override;
    vespalib::string getTotalMetrics(const vespalib::string &consumer) override;

    void snapshot();

    MetricsProducer(const RPCHooks &hooks, FNET_Transport &transport);
    ~MetricsProducer() override;
};


} // namespace slobrok