MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
apm.hpp
1// Copyright 2018-present MongoDB Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <functional>
18
19#include <mongocxx/options/apm-fwd.hpp>
20
21#include <mongocxx/events/command_failed_event.hpp>
22#include <mongocxx/events/command_started_event.hpp>
23#include <mongocxx/events/command_succeeded_event.hpp>
24#include <mongocxx/events/heartbeat_failed_event.hpp>
25#include <mongocxx/events/heartbeat_started_event.hpp>
26#include <mongocxx/events/heartbeat_succeeded_event.hpp>
27#include <mongocxx/events/server_changed_event.hpp>
28#include <mongocxx/events/server_closed_event.hpp>
29#include <mongocxx/events/server_opening_event.hpp>
30#include <mongocxx/events/topology_changed_event.hpp>
31#include <mongocxx/events/topology_closed_event.hpp>
32#include <mongocxx/events/topology_opening_event.hpp>
33
34#include <mongocxx/config/prelude.hpp>
35
36namespace mongocxx {
37namespace v_noabi {
38namespace options {
39
43class apm {
44 public:
60 std::function<void(const events::command_started_event&)> command_started);
61
67 const std::function<void(const events::command_started_event&)>& command_started() const;
68
84
90 const std::function<void(const events::command_failed_event&)>& command_failed() const;
91
107 std::function<void(const events::command_succeeded_event&)> command_succeeded);
108
114 const std::function<void(const events::command_succeeded_event&)>& command_succeeded() const;
115
131
137 const std::function<void(const events::server_opening_event&)>& server_opening() const;
138
154
160 const std::function<void(const events::server_closed_event&)>& server_closed() const;
161
178
184 const std::function<void(const events::server_changed_event&)>& server_changed() const;
185
201 std::function<void(const events::topology_opening_event&)> topology_opening);
202
208 const std::function<void(const events::topology_opening_event&)>& topology_opening() const;
209
225 std::function<void(const events::topology_closed_event&)> topology_closed);
226
232 const std::function<void(const events::topology_closed_event&)>& topology_closed() const;
233
250 std::function<void(const events::topology_changed_event&)> topology_changed);
251
257 const std::function<void(const events::topology_changed_event&)>& topology_changed() const;
258
274 std::function<void(const events::heartbeat_started_event&)> heartbeat_started);
275
281 const std::function<void(const events::heartbeat_started_event&)>& heartbeat_started() const;
282
298 std::function<void(const events::heartbeat_failed_event&)> heartbeat_failed);
299
305 const std::function<void(const events::heartbeat_failed_event&)>& heartbeat_failed() const;
306
323 std::function<void(const events::heartbeat_succeeded_event&)> heartbeat_succeeded);
324
330 const std::function<void(const events::heartbeat_succeeded_event&)>& heartbeat_succeeded()
331 const;
332
333 private:
334 std::function<void(const events::command_started_event&)> _command_started;
335 std::function<void(const events::command_failed_event&)> _command_failed;
336 std::function<void(const events::command_succeeded_event&)> _command_succeeded;
337 std::function<void(const events::server_closed_event&)> _server_closed;
338 std::function<void(const events::server_changed_event&)> _server_changed;
339 std::function<void(const events::server_opening_event&)> _server_opening;
340 std::function<void(const events::topology_closed_event&)> _topology_closed;
341 std::function<void(const events::topology_changed_event&)> _topology_changed;
342 std::function<void(const events::topology_opening_event&)> _topology_opening;
343 std::function<void(const events::heartbeat_started_event&)> _heartbeat_started;
344 std::function<void(const events::heartbeat_failed_event&)> _heartbeat_failed;
345 std::function<void(const events::heartbeat_succeeded_event&)> _heartbeat_succeeded;
346};
347
348} // namespace options
349} // namespace v_noabi
350} // namespace mongocxx
351
352#include <mongocxx/config/postlude.hpp>
An event notification sent when the driver fails to execute a MongoDB command.
Definition command_failed_event.hpp:37
An event notification sent when the driver begins executing a MongoDB command.
Definition command_started_event.hpp:37
An event notification sent when the driver successfully executes a MongoDB command.
Definition command_succeeded_event.hpp:37
An event notification sent when the driver failed to send an "hello" command to check the status of a...
Definition heartbeat_failed_event.hpp:36
An event notification sent when the driver begins executing a "hello" command to check the status of ...
Definition heartbeat_started_event.hpp:36
An event notification sent when the driver completes a "hello" command to check the status of a serve...
Definition heartbeat_succeeded_event.hpp:35
An event notification sent when the driver observes a change in the status of a server it is connecte...
Definition server_changed_event.hpp:36
An event notification sent when the driver stops monitoring a MongoDB server and removes it from the ...
Definition server_closed_event.hpp:37
An event notification sent when the driver adds a MongoDB server to the topology description and begi...
Definition server_opening_event.hpp:36
An event notification sent when the driver observes a change in any of the servers it is connected to...
Definition topology_changed_event.hpp:35
An event notification sent when the driver stops monitoring a server topology and destroys its descri...
Definition topology_closed_event.hpp:34
An event notification sent when the driver initializes a server topology.
Definition topology_opening_event.hpp:34
Class representing MongoDB application performance monitoring.
Definition apm.hpp:43
const std::function< void(const events::topology_changed_event &)> & topology_changed() const
Retrieves the topology description changed monitoring callback.
const std::function< void(const events::command_failed_event &)> & command_failed() const
Retrieves the command failed monitoring callback.
apm & on_command_started(std::function< void(const events::command_started_event &)> command_started)
Set the command started monitoring callback.
apm & on_heartbeat_failed(std::function< void(const events::heartbeat_failed_event &)> heartbeat_failed)
Set the heartbeat failed monitoring callback.
apm & on_heartbeat_started(std::function< void(const events::heartbeat_started_event &)> heartbeat_started)
Set the heartbeat started monitoring callback.
const std::function< void(const events::heartbeat_failed_event &)> & heartbeat_failed() const
Retrieves the heartbeat failed monitoring callback.
const std::function< void(const events::server_changed_event &)> & server_changed() const
Retrieves the server description changed monitoring callback.
const std::function< void(const events::server_opening_event &)> & server_opening() const
Retrieves the server opening monitoring callback.
apm & on_topology_opening(std::function< void(const events::topology_opening_event &)> topology_opening)
Set the topology_opening monitoring callback.
const std::function< void(const events::heartbeat_started_event &)> & heartbeat_started() const
Retrieves the heartbeat started monitoring callback.
const std::function< void(const events::server_closed_event &)> & server_closed() const
Retrieves the server closed monitoring callback.
const std::function< void(const events::heartbeat_succeeded_event &)> & heartbeat_succeeded() const
Retrieves the heartbeat succeeded monitoring callback.
const std::function< void(const events::topology_closed_event &)> & topology_closed() const
Retrieves the topology closed monitoring callback.
apm & on_server_opening(std::function< void(const events::server_opening_event &)> server_opening)
Set the server opening monitoring callback.
apm & on_topology_changed(std::function< void(const events::topology_changed_event &)> topology_changed)
Set the topology description changed monitoring callback.
const std::function< void(const events::command_succeeded_event &)> & command_succeeded() const
Retrieves the command succeeded monitoring callback.
apm & on_command_succeeded(std::function< void(const events::command_succeeded_event &)> command_succeeded)
Set the command succeeded monitoring callback.
apm & on_heartbeat_succeeded(std::function< void(const events::heartbeat_succeeded_event &)> heartbeat_succeeded)
Set the heartbeat succeeded monitoring callback.
apm & on_topology_closed(std::function< void(const events::topology_closed_event &)> topology_closed)
Set the topology closed monitoring callback.
apm & on_server_closed(std::function< void(const events::server_closed_event &)> server_closed)
Set the server closed monitoring callback.
apm & on_command_failed(std::function< void(const events::command_failed_event &)> command_failed)
Set the command failed monitoring callback.
apm & on_server_changed(std::function< void(const events::server_changed_event &)> server_changed)
Set the server description changed monitoring callback.
const std::function< void(const events::command_started_event &)> & command_started() const
Retrieves the command started monitoring callback.
const std::function< void(const events::topology_opening_event &)> & topology_opening() const
Retrieves the topology_opening monitoring callback.
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19