The Gaudi Framework
master (f31105fd)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
q
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
JSONSink.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 2022 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, 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
\***********************************************************************************/
11
12
#include <
Gaudi/BaseSink.h
>
13
#include <
Gaudi/MonitoringHub.h
>
14
15
#include <fstream>
16
17
#include <string>
18
19
namespace
Gaudi::Monitoring
{
20
21
class
JSONSink
:
public
BaseSink
{
22
23
public
:
24
using
BaseSink::BaseSink;
25
26
void
flush
(
bool
)
override
{
27
if
(
m_fileName
.empty() ) {
return
; }
28
nlohmann::json
output
;
29
applyToAllSortedEntities
(
30
[&
output
](
std::string
const
& component,
std::string
const
&
name
,
nlohmann::json
const
&
j
) {
31
output
.emplace_back(
nlohmann::json
{
32
{
"name"
,
name
},
33
{
"component"
, component },
34
{
"entity"
,
j
},
35
} );
36
} );
37
info() <<
"Writing JSON file "
<<
m_fileName
.
value
() <<
endmsg
;
38
std::ofstream
{
m_fileName
,
std::ios::out
} <<
output
.dump( 4 );
39
}
40
41
private
:
42
Gaudi::Property<std::string>
m_fileName
{
this
,
"FileName"
,
"json_output.json"
,
43
"Name of output json file. Empty fileName means no output"
};
44
};
45
46
DECLARE_COMPONENT
( JSONSink )
47
48
}
// namespace Gaudi::Monitoring
Gaudi::Monitoring::BaseSink
Base class for all Sinks registering to the Monitoring Hub Should be extended by actual Sinks.
Definition:
BaseSink.h:40
Gaudi::Monitoring::JSONSink
Definition:
JSONSink.cpp:21
std::string
STL class.
MonitoringHub.h
jsonFromLHCbLog.json
json
Definition:
jsonFromLHCbLog.py:86
Gaudi::Monitoring
Definition:
JSONSink.cpp:19
gaudirun.output
output
Definition:
gaudirun.py:521
Service::name
const std::string & name() const override
Retrieve name of the service
Definition:
Service.cpp:332
ProduceConsume.j
j
Definition:
ProduceConsume.py:104
std::ofstream
STL class.
Gaudi::Property::value
const ValueType & value() const
Definition:
Property.h:234
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition:
MsgStream.h:202
Gaudi::Monitoring::BaseSink::applyToAllSortedEntities
void applyToAllSortedEntities(Callable func) const
applies a callable to all monitoring entities ordered by component the callable will be called once p...
Definition:
BaseSink.h:110
Gaudi::Monitoring::JSONSink::flush
void flush(bool) override
pure virtual method to be defined by children and responsible for flushing current data of the Sink.
Definition:
JSONSink.cpp:26
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
BaseSink.h
Gaudi::Monitoring::JSONSink::m_fileName
Gaudi::Property< std::string > m_fileName
Definition:
JSONSink.cpp:42
Gaudi::Property< std::string >
Gaudi::Functional::details::out
OptOut && out
Definition:
details.h:174
GaudiCoreSvc
src
MessageSvc
JSONSink.cpp
Generated on Mon Apr 7 2025 16:26:20 for The Gaudi Framework by
1.8.18