Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
query_metrics.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include <chrono>
21#include <cinttypes>
22
23namespace couchbase
24{
25
33{
34public:
39 query_metrics() = default;
40
45 query_metrics(std::chrono::nanoseconds elapsed_time,
46 std::chrono::nanoseconds execution_time,
47 std::uint64_t result_count,
48 std::uint64_t result_size,
49 std::uint64_t sort_count,
50 std::uint64_t mutation_count,
51 std::uint64_t error_count,
52 std::uint64_t warning_count)
53 : elapsed_time_{ elapsed_time }
54 , execution_time_{ execution_time }
55 , result_count_{ result_count }
56 , result_size_{ result_size }
57 , sort_count_{ sort_count }
58 , mutation_count_{ mutation_count }
59 , error_count_{ error_count }
60 , warning_count_{ warning_count }
61 {
62 }
63
73 [[nodiscard]] auto elapsed_time() const -> std::chrono::nanoseconds
74 {
75 return elapsed_time_;
76 }
77
87 [[nodiscard]] auto execution_time() const -> std::chrono::nanoseconds
88 {
89 return execution_time_;
90 }
91
100 [[nodiscard]] auto result_count() const -> std::uint64_t
101 {
102 return result_count_;
103 }
104
113 [[nodiscard]] auto result_size() const -> std::uint64_t
114 {
115 return result_size_;
116 }
117
126 [[nodiscard]] auto sort_count() const -> std::uint64_t
127 {
128 return sort_count_;
129 }
130
139 [[nodiscard]] auto mutation_count() const -> std::uint64_t
140 {
141 return mutation_count_;
142 }
143
152 [[nodiscard]] auto error_count() const -> std::uint64_t
153 {
154 return error_count_;
155 }
156
165 [[nodiscard]] auto warning_count() const -> std::uint64_t
166 {
167 return warning_count_;
168 }
169
170private:
171 std::chrono::nanoseconds elapsed_time_{};
172 std::chrono::nanoseconds execution_time_{};
173 std::uint64_t result_count_{};
174 std::uint64_t result_size_{};
175 std::uint64_t sort_count_{};
176 std::uint64_t mutation_count_{};
177 std::uint64_t error_count_{};
178 std::uint64_t warning_count_{};
179};
180
181} // namespace couchbase
Query Metrics contains the query result metrics containing counts and timings.
Definition query_metrics.hxx:33
auto result_size() const -> std::uint64_t
The total number of bytes in the results.
Definition query_metrics.hxx:113
auto result_count() const -> std::uint64_t
The total number of objects in the results.
Definition query_metrics.hxx:100
auto error_count() const -> std::uint64_t
The number of errors that occurred during the request.
Definition query_metrics.hxx:152
auto sort_count() const -> std::uint64_t
The total number of results selected by the engine before restriction through LIMIT clause.
Definition query_metrics.hxx:126
query_metrics(std::chrono::nanoseconds elapsed_time, std::chrono::nanoseconds execution_time, std::uint64_t result_count, std::uint64_t result_size, std::uint64_t sort_count, std::uint64_t mutation_count, std::uint64_t error_count, std::uint64_t warning_count)
Definition query_metrics.hxx:45
auto execution_time() const -> std::chrono::nanoseconds
The time taken for the execution of the request, that is the time from when query execution started u...
Definition query_metrics.hxx:87
auto elapsed_time() const -> std::chrono::nanoseconds
The total time taken for the request, that is the time from when the request was received until the r...
Definition query_metrics.hxx:73
auto warning_count() const -> std::uint64_t
The number of warnings that occurred during the request.
Definition query_metrics.hxx:165
auto mutation_count() const -> std::uint64_t
The number of mutations that were made during the request.
Definition query_metrics.hxx:139
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28