aboutsummaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/vespa/vespalib/metrics/metrics_manager.h
blob: e05d42810cbaed9cdb88c101146d197a53c1d7e5 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <memory>
#include <thread>
#include <vespa/vespalib/stllike/string.h>
#include "name_collection.h"
#include "counter.h"
#include "gauge.h"
#include "mergers.h"
#include "snapshots.h"
#include "point.h"
#include "point_builder.h"
#include "dimension.h"
#include "label.h"

namespace vespalib {
namespace metrics {


class MetricsManager
    : public std::enable_shared_from_this<MetricsManager>
{
public:
    virtual ~MetricsManager() {}

    virtual Counter counter(const vespalib::string &name) = 0; // get or create
    virtual  Gauge   gauge (const vespalib::string &name) = 0; // get or create

    virtual Dimension dimension(const vespalib::string &name) = 0; // get or create
    virtual Label label(const vespalib::string &value) = 0; // get or create
    PointBuilder pointBuilder() {
        return PointBuilder(shared_from_this());
    }
    virtual PointBuilder pointBuilder(Point from) = 0;

    virtual Point pointFrom(PointMapBacking &&map) = 0;

    virtual Snapshot snapshot() = 0;

    // for use from Counter only
    virtual void add(CounterIncrement inc) = 0;

    // for use from Gauge only
    virtual void sample(GaugeMeasurement value) = 0;
};


} // namespace vespalib::metrics
} // namespace vespalib