]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/pull/src/handler.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / pull / src / handler.h
CommitLineData
1e59de90
TL
1#pragma once
2
3#include <memory>
4#include <mutex>
5#include <vector>
6
7#include "CivetServer.h"
8#include "prometheus/collectable.h"
9#include "prometheus/counter.h"
10#include "prometheus/family.h"
11#include "prometheus/registry.h"
12#include "prometheus/summary.h"
13
14namespace prometheus {
15namespace detail {
16class MetricsHandler : public CivetHandler {
17 public:
18 explicit MetricsHandler(Registry& registry);
19
20 void RegisterCollectable(const std::weak_ptr<Collectable>& collectable);
21 void RemoveCollectable(const std::weak_ptr<Collectable>& collectable);
22
23 bool handleGet(CivetServer* server, struct mg_connection* conn) override;
24
25 private:
26 static void CleanupStalePointers(
27 std::vector<std::weak_ptr<Collectable>>& collectables);
28
29 std::mutex collectables_mutex_;
30 std::vector<std::weak_ptr<Collectable>> collectables_;
31 Family<Counter>& bytes_transferred_family_;
32 Counter& bytes_transferred_;
33 Family<Counter>& num_scrapes_family_;
34 Counter& num_scrapes_;
35 Family<Summary>& request_latencies_family_;
36 Summary& request_latencies_;
37};
38} // namespace detail
39} // namespace prometheus