Seastar
High performance C++ framework for concurrent servers
metrics_registration.hh
Go to the documentation of this file.
1 /*
2  * This file is open source software, licensed to you under the terms
3  * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4  * distributed with this work for additional information regarding copyright
5  * ownership. You may not use this file except in compliance with the License.
6  *
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14  * KIND, either express or implied. See the License for the
15  * specific language governing permissions and limitations
16  * under the License.
17  */
18 /*
19  * Copyright (C) 2016 ScyllaDB.
20  */
21 
22 #pragma once
23 
24 #include <memory>
25 #include <vector>
26 
27 #include <seastar/core/sstring.hh>
28 
49 namespace seastar {
50 
51 namespace metrics {
52 
53 namespace impl {
54 class metric_groups_def;
55 struct metric_definition_impl;
56 class metric_groups_impl;
57 }
58 
59 using group_name_type = sstring;
60 class metric_groups;
61 
63  std::unique_ptr<impl::metric_definition_impl> _impl;
64 public:
68  friend metric_groups;
70 };
71 
73 public:
74  group_name_type name;
75  std::initializer_list<metric_definition> metrics;
76  metric_group_definition(const group_name_type& name, std::initializer_list<metric_definition> l);
79 };
80 
90  std::unique_ptr<impl::metric_groups_def> _impl;
91 public:
92  metric_groups() noexcept;
93  metric_groups(metric_groups&&) = default;
94  virtual ~metric_groups();
95  metric_groups& operator=(metric_groups&&) = default;
101  metric_groups(std::initializer_list<metric_group_definition> mg);
102 
123  metric_groups& add_group(const group_name_type& name, const std::initializer_list<metric_definition>& l);
124 
141  metric_groups& add_group(const group_name_type& name, const std::vector<metric_definition>& l);
142 
146  void clear();
147 };
148 
149 
155 class metric_group : public metric_groups {
156 public:
157  metric_group() noexcept;
158  metric_group(const metric_group&) = delete;
159  metric_group(metric_group&&) = default;
160  virtual ~metric_group();
161  metric_group& operator=(metric_group&&) = default;
162 
168  metric_group(const group_name_type& name, std::initializer_list<metric_definition> l);
169 };
170 
171 
172 }
173 }
seastar
Seastar API namespace.
Definition: abort_on_ebadf.hh:24
seastar::metrics::metric_groups::add_group
metric_groups & add_group(const group_name_type &name, const std::initializer_list< metric_definition > &l)
Add metrics belonging to the same group.
seastar::metrics::impl::metric_groups_impl
Definition: metrics_api.hh:169
seastar::metrics::group_name_type
sstring group_name_type
Definition: metrics_registration.hh:59
seastar::metrics::metric_group::metric_group
metric_group(const group_name_type &name, std::initializer_list< metric_definition > l)
add metrics belong to the same group in the constructor.
seastar::metrics::metric_definition
Definition: metrics_registration.hh:62
seastar::metrics::metric_group
hold a single metric group Initialization is done in the constructor or with a call to add_group
Definition: metrics_registration.hh:155
seastar::metrics::impl::metric_definition_impl
Definition: metrics.hh:320
impl
holds the implementation parts of the metrics layer, do not use directly.
seastar::metrics::metric_groups
holds the metric definition.
Definition: metrics_registration.hh:89
seastar::metrics::metric_group_definition
Definition: metrics_registration.hh:72
seastar::metrics::metric_groups::metric_groups
metric_groups(std::initializer_list< metric_group_definition > mg)
add metrics belong to the same group in the constructor.
seastar::metrics::metric_groups::add_group
metric_groups & add_group(const group_name_type &name, const std::vector< metric_definition > &l)
Add metrics belonging to the same group.
seastar::metrics::metric_groups::clear
void clear()
clear all metrics groups registrations.