aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/net/http/simple_metric_snapshot.h
blob: 18c075b40a7ae6e5db911f03eeedec0148e4a891 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/data/slime/slime.h>

namespace vespalib {

class SimpleMetricSnapshot
{
private:
    vespalib::Slime _data;
    vespalib::slime::Cursor& _metrics;
    vespalib::slime::Cursor& _values;
    double _snapLen;

public:
    SimpleMetricSnapshot(uint32_t prevTime, uint32_t currTime);
    void addCount(const char *name, const char *desc, uint32_t count);
    void addGauge(const char *name, const char *desc, long gauge);

    vespalib::string asString() const {
        return _data.toString();
    }
};

} // namespace vespalib