Monitoring  3.3.4
O2 Monitoring library
StdOut.h
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef ALICEO2_MONITORING_BACKEND_STDOUT_H
17 #define ALICEO2_MONITORING_BACKEND_STDOUT_H
18 
19 #include "Monitoring/Backend.h"
20 #include <string>
21 #include <sstream>
22 
23 namespace o2
24 {
26 namespace monitoring
27 {
29 namespace backends
30 {
31 
33 class StdOut final : public Backend
34 {
35  public:
37  StdOut(const std::string& prefix = "METRIC");
38 
40  ~StdOut() = default;
41 
44  void send(const Metric& metric) override;
45 
48  void send(std::vector<Metric>&& metrics) override;
49 
53  void addGlobalTag(std::string_view name, std::string_view value) override;
54 
55  private:
59  unsigned long convertTimestamp(const std::chrono::time_point<std::chrono::system_clock>& timestamp);
60 
61  std::string tagString;
62  const std::string mPrefix;
63 };
64 
65 } // namespace backends
66 } // namespace monitoring
67 } // namespace o2
68 
69 #endif // ALICEO2_MONITORING_BACKEND_STDOUT_H
Definition: Backend.h:23
~StdOut()=default
Default destructor.
Backend pure virtual interface.
Definition: Backend.h:33
void addGlobalTag(std::string_view name, std::string_view value) override
Definition: StdOut.cxx:49
Prints metrics to standard output via std::cout.
Definition: StdOut.h:33
Represents a metric including value, type of the value, name, timestamp and tags. ...
Definition: Metric.h:37
StdOut(const std::string &prefix="METRIC")
Default constructor.
Definition: StdOut.cxx:43
void send(const Metric &metric) override
Definition: StdOut.cxx:66