1MongoDB::Monitoring(3)User Contributed Perl DocumentationMongoDB::Monitoring(3)
2
3
4

NAME

6       MongoDB::Monitoring - Internal event monitoring API for instrumentation
7

VERSION

9       version v2.0.3
10

DESCRIPTION

12       The MongoDB::MongoClient takes an optional "monitoring_callback"
13       attribute, which can be used to monitor events that occur during the
14       operation of the driver.
15
16       The API is very simple: given a code reference, a hashref for each
17       event is passed to the code reference.  Here is a simple example that
18       just accumulates events in an array:
19
20           our @events;
21           my $cb = sub { push @events, $_[0] };
22
23           MongoDB->connect( $uri, { monitoring_callback => $cb } );
24

EVENT TYPES

26       Every event is a hash reference, with a "type" field indicating the
27       type, e.g. "command_started".  Each type is described below.
28
29   command_started
30       This event is sent just before a command is put one the wire.  It will
31       be followed by either a "command_succeeded" or "command_failed" event.
32
33       Fields:
34
35       ·   type: "command_started"
36
37       ·   databaseName: the name of the database to which the command applies
38
39       ·   commandName: the name of the command being executed; for legacy
40           operations that don't use commands, the driver will convert them to
41           appear as if they are in command form.
42
43       ·   command: a hash reference representing the full command to be sent
44
45       ·   requestId: the request identifier sent to the server
46
47       ·   connectionId: address and port of the destination server
48
49   command_succeeded
50       This event is sent just after a command reply is received, but only if
51       the database reply document contains a non-false "ok" field.  NOTE:
52       write errors will have "ok:1" even though they have write errors; for
53       writes, success indicates that the write attempt was valid, not that
54       the write succeeded.
55
56       Fields:
57
58       ·   type: "command_succeeded"
59
60       ·   commandName: the name of the command being executed
61
62       ·   durationSecs: the elapsed time in seconds since the
63           "command_started" event.
64
65       ·   reply: a hash reference representing the full database reply
66
67       ·   requestId: the request identifier sent to the server
68
69       ·   connectionId: address and port of the destination server
70
71   command_failed
72       This event is sent just after a command reply is received, but only if
73       the database reply document contains a false "ok" field or if an
74       exception occurred during send or receive operations.
75
76       Fields:
77
78       ·   type: "command_failed"
79
80       ·   commandName: the name of the command being executed
81
82       ·   durationSecs: the elapsed time in seconds since the
83           "command_started" event.
84
85       ·   failure: a string with a error message about the failure
86
87       ·   eval_error: if an exception occurs, this contains the value of $@
88           when the exception was caught
89
90       ·   reply: a hash reference representing the full database reply or an
91           empty hashref if the failure is due to an exception
92
93       ·   requestId: the request identifier sent to the server
94
95       ·   connectionId: address and port of the destination server
96

REDACTION

98       Certain commands are considered sensitive.  When any of the following
99       commands are seen in monitoring, the command body and database reply
100       body are replaced with an empty document:
101
102       ·   authenticate
103
104       ·   saslStart
105
106       ·   saslContinue
107
108       ·   getnonce
109
110       ·   createUser
111
112       ·   updateUser
113
114       ·   copydbgetnonce
115
116       ·   copydbsaslstart
117
118       ·   copydb
119

AUTHORS

121       ·   David Golden <david@mongodb.com>
122
123       ·   Rassi <rassi@mongodb.com>
124
125       ·   Mike Friedman <friedo@friedo.com>
126
127       ·   Kristina Chodorow <k.chodorow@gmail.com>
128
129       ·   Florian Ragwitz <rafl@debian.org>
130
132       This software is Copyright (c) 2019 by MongoDB, Inc.
133
134       This is free software, licensed under:
135
136         The Apache License, Version 2.0, January 2004
137
138
139
140perl v5.28.1                      2019-02-07            MongoDB::Monitoring(3)
Impressum