Apache Mesos
metrics.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. 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, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MASTER_ALLOCATOR_MESOS_METRICS_HPP__
18 #define __MASTER_ALLOCATOR_MESOS_METRICS_HPP__
19 
20 #include <string>
21 #include <vector>
22 
23 #include <mesos/quota/quota.hpp>
24 
28 
29 #include <process/pid.hpp>
30 
31 #include <stout/hashmap.hpp>
32 
33 namespace mesos {
34 namespace internal {
35 namespace master {
36 namespace allocator {
37 namespace internal {
38 
39 // Forward declarations.
40 class HierarchicalAllocatorProcess;
41 
42 // Collection of metrics for the allocator; these begin
43 // with the following prefix: `allocator/mesos/`.
44 struct Metrics
45 {
47 
48  ~Metrics();
49 
50  void setQuota(const std::string& role, const Quota& quota);
51  void removeQuota(const std::string& role);
52 
53  void addRole(const std::string& role);
54  void removeRole(const std::string& role);
55 
57 
58  // Number of dispatch events currently waiting in the allocator process.
60 
61  // TODO(bbannier) This metric is identical to `event_queue_dispatches`, but
62  // uses a name deprecated in 1.0. This metric should be removed after the
63  // deprecation cycle.
65 
66  // Number of times the allocation algorithm has run.
68 
69  // Time spent in the allocation algorithm.
71 
72  // The latency of allocation runs due to the batching of allocation requests.
74 
75  // Gauges for the total amount of each resource in the cluster.
76  std::vector<process::metrics::Gauge> resources_total;
77 
78  // Gauges for the allocated amount of each resource in the cluster.
79  std::vector<process::metrics::Gauge> resources_offered_or_allocated;
80 
81  // Gauges for the per-role quota allocation for each resource.
84 
85  // Gauges for the per-role quota guarantee for each resource.
88 
89  // Gauges for the per-role count of active offer filters.
91 };
92 
93 } // namespace internal {
94 } // namespace allocator {
95 } // namespace master {
96 } // namespace internal {
97 } // namespace mesos {
98 
99 #endif // __MASTER_ALLOCATOR_MESOS_METRICS_HPP__
const process::PID< HierarchicalAllocatorProcess > allocator
Definition: metrics.hpp:56
process::metrics::Counter allocation_runs
Definition: metrics.hpp:67
process::metrics::Timer< Milliseconds > allocation_run_latency
Definition: metrics.hpp:73
hashmap< std::string, hashmap< std::string, process::metrics::Gauge > > quota_guarantee
Definition: metrics.hpp:87
hashmap< std::string, hashmap< std::string, process::metrics::Gauge > > quota_allocated
Definition: metrics.hpp:83
Metrics(const HierarchicalAllocatorProcess &allocator)
Definition: counter.hpp:26
Definition: hashmap.hpp:38
Definition: quota.hpp:25
Definition: gauge.hpp:27
std::vector< process::metrics::Gauge > resources_offered_or_allocated
Definition: metrics.hpp:79
process::metrics::Timer< Milliseconds > allocation_run
Definition: metrics.hpp:70
std::vector< process::metrics::Gauge > resources_total
Definition: metrics.hpp:76
hashmap< std::string, process::metrics::Gauge > offer_filters_active
Definition: metrics.hpp:90
A &quot;process identifier&quot; used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:279
process::metrics::Gauge event_queue_dispatches_
Definition: metrics.hpp:64
process::metrics::Gauge event_queue_dispatches
Definition: metrics.hpp:59
void setQuota(const std::string &role, const Quota &quota)