userver: userver/utils/statistics/entry.hpp Source File
Loading...
Searching...
No Matches
entry.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/statistics/entry.hpp
4/// @brief Header with all the types required in component header to use
5/// statistics (includes @ref utils::statistics::Entry and forward declarations).
6
7#include <userver/utils/fast_pimpl.hpp>
8#include <userver/utils/statistics/fwd.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace utils::statistics {
13
14namespace impl {
15enum class UnregisteringKind { kManual, kAutomatic };
16}
17
18/// @brief Statistics registration holder, used to unregister a metric source before it is destroyed.
19///
20/// See @ref utils::statistics::Storage for info on registrations
21class [[nodiscard]] Entry final {
22public:
23 Entry();
24
25 Entry(const Entry& other) = delete;
26 Entry& operator=(const Entry& other) = delete;
27 Entry(Entry&& other) noexcept;
28 Entry& operator=(Entry&& other) noexcept;
29
30 /// Unregisters metric source.
32
33 /// Unregisters metric source.
34 void Unregister() noexcept;
35
36private:
37 struct Impl;
38
39 friend class Storage; // in RegisterExtender()
40
41 explicit Entry(const Impl& impl) noexcept;
42
43 utils::FastPimpl<Impl, 16, 8> impl_;
44};
45
46} // namespace utils::statistics
47
48USERVER_NAMESPACE_END