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#ifndef SEASTAR_MODULE
25#include <memory>
26#include <vector>
27
28#include <seastar/core/sstring.hh>
29#include <seastar/util/modules.hh>
30#endif
31
52namespace seastar {
53
54namespace metrics {
55
56namespace impl {
57class metric_groups_def;
58struct metric_definition_impl;
59class metric_groups_impl;
60}
61
62SEASTAR_MODULE_EXPORT_BEGIN
63
64using group_name_type = sstring;
65class metric_groups;
66
68 std::unique_ptr<impl::metric_definition_impl> _impl;
69public:
73 friend metric_groups;
75};
76
78public:
79 group_name_type name;
80 std::initializer_list<metric_definition> metrics;
81 metric_group_definition(const group_name_type& name, std::initializer_list<metric_definition> l);
84};
85
95 std::unique_ptr<impl::metric_groups_def> _impl;
96public:
97 metric_groups() noexcept;
98 metric_groups(metric_groups&&) = default;
99 virtual ~metric_groups();
100 metric_groups& operator=(metric_groups&&) = default;
106 metric_groups(std::initializer_list<metric_group_definition> mg);
107
128 metric_groups& add_group(const group_name_type& name, const std::initializer_list<metric_definition>& l);
129
146 metric_groups& add_group(const group_name_type& name, const std::vector<metric_definition>& l);
147
151 void clear();
152};
153
154
161public:
162 metric_group() noexcept;
163 metric_group(const metric_group&) = delete;
164 metric_group(metric_group&&) = default;
165 virtual ~metric_group();
166 metric_group& operator=(metric_group&&) = default;
167
173 metric_group(const group_name_type& name, std::initializer_list<metric_definition> l);
174};
175
176SEASTAR_MODULE_EXPORT_END
177
178}
179}
Definition: metrics_api.hh:202
Definition: metrics_registration.hh:67
Definition: metrics_registration.hh:77
hold a single metric group Initialization is done in the constructor or with a call to add_group
Definition: metrics_registration.hh:160
metric_group(const group_name_type &name, std::initializer_list< metric_definition > l)
add metrics belong to the same group in the constructor.
holds the metric definition.
Definition: metrics_registration.hh:94
void clear()
clear all metrics groups registrations.
metric_groups(std::initializer_list< metric_group_definition > mg)
add metrics belong to the same group in the constructor.
metric_groups & add_group(const group_name_type &name, const std::vector< metric_definition > &l)
Add metrics belonging to the same group.
metric_groups & add_group(const group_name_type &name, const std::initializer_list< metric_definition > &l)
Add metrics belonging to the same group.
holds the implementation parts of the metrics layer, do not use directly.
sstring group_name_type
Definition: metrics_registration.hh:64
Seastar API namespace.
Definition: abort_on_ebadf.hh:26