MongoDB C++ Driver current
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/events/command_failed_event.hpp>
20#include <mongocxx/events/command_started_event.hpp>
21#include <mongocxx/events/command_succeeded_event.hpp>
22#include <mongocxx/events/heartbeat_failed_event.hpp>
23#include <mongocxx/events/heartbeat_started_event.hpp>
24#include <mongocxx/events/heartbeat_succeeded_event.hpp>
25#include <mongocxx/events/server_changed_event.hpp>
26#include <mongocxx/events/server_closed_event.hpp>
27#include <mongocxx/events/server_opening_event.hpp>
28#include <mongocxx/events/topology_changed_event.hpp>
29#include <mongocxx/events/topology_closed_event.hpp>
30#include <mongocxx/events/topology_opening_event.hpp>
31
32#include <mongocxx/config/prelude.hpp>
33
34namespace mongocxx {
35inline namespace v_noabi {
36namespace options {
37
41class MONGOCXX_API apm {
42 public:
58 std::function<void(const mongocxx::events::command_started_event&)> command_started);
59
65 const std::function<void(const mongocxx::events::command_started_event&)>& command_started()
66 const;
67
83 std::function<void(const mongocxx::events::command_failed_event&)> command_failed);
84
90 const std::function<void(const mongocxx::events::command_failed_event&)>& command_failed()
91 const;
92
108 std::function<void(const mongocxx::events::command_succeeded_event&)> command_succeeded);
109
115 const std::function<void(const mongocxx::events::command_succeeded_event&)>& command_succeeded()
116 const;
117
133 std::function<void(const mongocxx::events::server_opening_event&)> server_opening);
134
140 const std::function<void(const mongocxx::events::server_opening_event&)>& server_opening()
141 const;
142
158 std::function<void(const mongocxx::events::server_closed_event&)> server_closed);
159
165 const std::function<void(const mongocxx::events::server_closed_event&)>& server_closed() const;
166
183 std::function<void(const mongocxx::events::server_changed_event&)> server_changed);
184
190 const std::function<void(const mongocxx::events::server_changed_event&)>& server_changed()
191 const;
192
208 std::function<void(const mongocxx::events::topology_opening_event&)> topology_opening);
209
215 const std::function<void(const mongocxx::events::topology_opening_event&)>& topology_opening()
216 const;
217
233 std::function<void(const mongocxx::events::topology_closed_event&)> topology_closed);
234
240 const std::function<void(const mongocxx::events::topology_closed_event&)>& topology_closed()
241 const;
242
259 std::function<void(const mongocxx::events::topology_changed_event&)> topology_changed);
260
266 const std::function<void(const mongocxx::events::topology_changed_event&)>& topology_changed()
267 const;
268
284 std::function<void(const mongocxx::events::heartbeat_started_event&)> heartbeat_started);
285
291 const std::function<void(const mongocxx::events::heartbeat_started_event&)>& heartbeat_started()
292 const;
293
309 std::function<void(const mongocxx::events::heartbeat_failed_event&)> heartbeat_failed);
310
316 const std::function<void(const mongocxx::events::heartbeat_failed_event&)>& heartbeat_failed()
317 const;
318
335 std::function<void(const mongocxx::events::heartbeat_succeeded_event&)>
336 heartbeat_succeeded);
337
343 const std::function<void(const mongocxx::events::heartbeat_succeeded_event&)>&
345
346 private:
347 std::function<void(const mongocxx::events::command_started_event&)> _command_started;
348 std::function<void(const mongocxx::events::command_failed_event&)> _command_failed;
349 std::function<void(const mongocxx::events::command_succeeded_event&)> _command_succeeded;
350 std::function<void(const mongocxx::events::server_closed_event&)> _server_closed;
351 std::function<void(const mongocxx::events::server_changed_event&)> _server_changed;
352 std::function<void(const mongocxx::events::server_opening_event&)> _server_opening;
353 std::function<void(const mongocxx::events::topology_closed_event&)> _topology_closed;
354 std::function<void(const mongocxx::events::topology_changed_event&)> _topology_changed;
355 std::function<void(const mongocxx::events::topology_opening_event&)> _topology_opening;
356 std::function<void(const mongocxx::events::heartbeat_started_event&)> _heartbeat_started;
357 std::function<void(const mongocxx::events::heartbeat_failed_event&)> _heartbeat_failed;
358 std::function<void(const mongocxx::events::heartbeat_succeeded_event&)> _heartbeat_succeeded;
359};
360
361} // namespace options
362} // namespace v_noabi
363} // namespace mongocxx
364
365#include <mongocxx/config/postlude.hpp>
Class representing MongoDB application performance monitoring.
Definition apm.hpp:41
const std::function< void(const mongocxx::events::heartbeat_succeeded_event &)> & heartbeat_succeeded() const
Retrieves the heartbeat succeeded monitoring callback.
apm & on_heartbeat_failed(std::function< void(const mongocxx::events::heartbeat_failed_event &)> heartbeat_failed)
Set the heartbeat failed monitoring callback.
const std::function< void(const mongocxx::events::topology_opening_event &)> & topology_opening() const
Retrieves the topology_opening monitoring callback.
apm & on_server_closed(std::function< void(const mongocxx::events::server_closed_event &)> server_closed)
Set the server closed monitoring callback.
apm & on_command_succeeded(std::function< void(const mongocxx::events::command_succeeded_event &)> command_succeeded)
Set the command succeeded monitoring callback.
const std::function< void(const mongocxx::events::command_failed_event &)> & command_failed() const
Retrieves the command failed monitoring callback.
const std::function< void(const mongocxx::events::server_closed_event &)> & server_closed() const
Retrieves the server closed monitoring callback.
const std::function< void(const mongocxx::events::server_changed_event &)> & server_changed() const
Retrieves the server description changed monitoring callback.
const std::function< void(const mongocxx::events::server_opening_event &)> & server_opening() const
Retrieves the server opening monitoring callback.
const std::function< void(const mongocxx::events::topology_changed_event &)> & topology_changed() const
Retrieves the topology description changed monitoring callback.
const std::function< void(const mongocxx::events::topology_closed_event &)> & topology_closed() const
Retrieves the topology closed monitoring callback.
apm & on_heartbeat_succeeded(std::function< void(const mongocxx::events::heartbeat_succeeded_event &)> heartbeat_succeeded)
Set the heartbeat succeeded monitoring callback.
apm & on_topology_closed(std::function< void(const mongocxx::events::topology_closed_event &)> topology_closed)
Set the topology closed monitoring callback.
const std::function< void(const mongocxx::events::heartbeat_started_event &)> & heartbeat_started() const
Retrieves the heartbeat started monitoring callback.
const std::function< void(const mongocxx::events::command_started_event &)> & command_started() const
Retrieves the command started monitoring callback.
apm & on_topology_opening(std::function< void(const mongocxx::events::topology_opening_event &)> topology_opening)
Set the topology_opening monitoring callback.
apm & on_command_started(std::function< void(const mongocxx::events::command_started_event &)> command_started)
Set the command started monitoring callback.
apm & on_server_changed(std::function< void(const mongocxx::events::server_changed_event &)> server_changed)
Set the server description changed monitoring callback.
const std::function< void(const mongocxx::events::heartbeat_failed_event &)> & heartbeat_failed() const
Retrieves the heartbeat failed monitoring callback.
apm & on_topology_changed(std::function< void(const mongocxx::events::topology_changed_event &)> topology_changed)
Set the topology description changed monitoring callback.
const std::function< void(const mongocxx::events::command_succeeded_event &)> & command_succeeded() const
Retrieves the command succeeded monitoring callback.
apm & on_command_failed(std::function< void(const mongocxx::events::command_failed_event &)> command_failed)
Set the command failed monitoring callback.
apm & on_server_opening(std::function< void(const mongocxx::events::server_opening_event &)> server_opening)
Set the server opening monitoring callback.
apm & on_heartbeat_started(std::function< void(const mongocxx::events::heartbeat_started_event &)> heartbeat_started)
Set the heartbeat started monitoring callback.
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24