]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/metrics/NullStatsFactory.h
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / jaeger-client-cpp / src / jaegertracing / metrics / NullStatsFactory.h
1 /*
2 * Copyright (c) 2017 Uber Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef JAEGERTRACING_METRICS_NULLSTATSFACTORY_H
18 #define JAEGERTRACING_METRICS_NULLSTATSFACTORY_H
19
20 #include <memory>
21 #include <string>
22 #include <unordered_map>
23
24 #include "jaegertracing/metrics/NullCounter.h"
25 #include "jaegertracing/metrics/NullGauge.h"
26 #include "jaegertracing/metrics/NullTimer.h"
27 #include "jaegertracing/metrics/StatsFactory.h"
28
29 namespace jaegertracing {
30 namespace metrics {
31
32 class Counter;
33 class Gauge;
34 class Timer;
35
36 class NullStatsFactory : public StatsFactory {
37 public:
38 using StatsFactory::createCounter;
39 using StatsFactory::createGauge;
40 using StatsFactory::createTimer;
41
42 std::unique_ptr<Counter>
43 createCounter(const std::string&,
44 const std::unordered_map<std::string, std::string>&) override
45 {
46 return std::unique_ptr<Counter>(new NullCounter());
47 }
48
49 std::unique_ptr<Timer>
50 createTimer(const std::string&,
51 const std::unordered_map<std::string, std::string>&) override
52 {
53 return std::unique_ptr<Timer>(new NullTimer());
54 }
55
56 std::unique_ptr<Gauge>
57 createGauge(const std::string&,
58 const std::unordered_map<std::string, std::string>&) override
59 {
60 return std::unique_ptr<Gauge>(new NullGauge());
61 }
62 };
63
64 } // namespace metrics
65 } // namespace jaegertracing
66
67 #endif // JAEGERTRACING_METRICS_NULLSTATSFACTORY_H