blob: 52e9c6a608c3cc21105df158f0a34bf0d1c32931 (
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
51
52
53
54
55
56
57
58
59
60
61
62
|
// 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 "current_samples.h"
#include "snapshots.h"
#include "metrics_manager.h"
#include "clock.h"
namespace vespalib {
namespace metrics {
/**
* Dummy manager that discards everything, use
* for unit tests where you don't care about
* metrics.
**/
class DummyMetricsManager : public MetricsManager
{
private:
DummyMetricsManager() {}
public:
~DummyMetricsManager();
static std::shared_ptr<MetricsManager> create() {
return std::shared_ptr<MetricsManager>(new DummyMetricsManager());
}
Counter counter(const vespalib::string &, const vespalib::string &) override {
return Counter(shared_from_this(), MetricName(0));
}
Gauge gauge(const vespalib::string &, const vespalib::string &) override {
return Gauge(shared_from_this(), MetricName(0));
}
Dimension dimension(const vespalib::string &) override {
return Dimension(0);
}
Label label(const vespalib::string &) override {
return Label(0);
}
PointBuilder pointBuilder(Point) override {
return PointBuilder(shared_from_this());
}
Point pointFrom(PointMap::BackingMap) override {
return Point(0);
}
Snapshot snapshot() override;
Snapshot totalSnapshot() override;
// for use from Counter only
void add(Counter::Increment) override {}
// for use from Gauge only
void sample(Gauge::Measurement) override {}
};
} // namespace vespalib::metrics
} // namespace vespalib
|