couchbase 3.1.1-universal-darwin-20 → 3.2.0-universal-darwin-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/CMakeLists.txt +3 -1
- data/ext/build_version.hxx.in +1 -1
- data/ext/cmake/Testing.cmake +1 -0
- data/ext/cmake/ThirdPartyDependencies.cmake +6 -0
- data/ext/cmake/VersionInfo.cmake +3 -0
- data/ext/couchbase/bucket.hxx +47 -28
- data/ext/couchbase/cbsasl/client.h +1 -1
- data/ext/couchbase/cbsasl/context.cc +1 -1
- data/ext/couchbase/cbsasl/context.h +3 -3
- data/ext/couchbase/cbsasl/mechanism.cc +5 -8
- data/ext/couchbase/cbsasl/mechanism.h +1 -4
- data/ext/couchbase/cbsasl/plain/plain.cc +1 -1
- data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +30 -36
- data/ext/couchbase/cluster.hxx +40 -22
- data/ext/couchbase/cluster_options.hxx +7 -1
- data/ext/couchbase/configuration.hxx +37 -16
- data/ext/couchbase/couchbase.cxx +1145 -291
- data/ext/couchbase/error_map.hxx +1 -1
- data/ext/couchbase/errors.hxx +25 -17
- data/ext/couchbase/io/dns_client.hxx +3 -3
- data/ext/couchbase/io/dns_codec.hxx +4 -5
- data/ext/couchbase/io/dns_config.hxx +5 -6
- data/ext/couchbase/io/dns_message.hxx +3 -3
- data/ext/couchbase/io/http_command.hxx +70 -35
- data/ext/couchbase/io/http_session.hxx +4 -3
- data/ext/couchbase/io/http_session_manager.hxx +28 -19
- data/ext/couchbase/io/mcbp_command.hxx +51 -19
- data/ext/couchbase/io/mcbp_context.hxx +1 -1
- data/ext/couchbase/io/mcbp_parser.hxx +4 -4
- data/ext/couchbase/io/mcbp_session.hxx +91 -101
- data/ext/couchbase/io/query_cache.hxx +2 -2
- data/ext/couchbase/io/retry_orchestrator.hxx +2 -4
- data/ext/couchbase/io/retry_reason.hxx +2 -2
- data/ext/couchbase/io/retry_strategy.hxx +1 -6
- data/ext/couchbase/io/streams.hxx +7 -7
- data/ext/couchbase/metrics/logging_meter.hxx +228 -0
- data/ext/couchbase/metrics/logging_meter_options.hxx +28 -0
- data/ext/couchbase/metrics/meter.hxx +49 -0
- data/ext/couchbase/metrics/noop_meter.hxx +43 -0
- data/ext/couchbase/operations.hxx +4 -0
- data/ext/couchbase/operations/analytics_dataset_create.hxx +16 -12
- data/ext/couchbase/operations/analytics_dataset_drop.hxx +11 -11
- data/ext/couchbase/operations/analytics_dataset_get_all.hxx +6 -6
- data/ext/couchbase/operations/analytics_dataverse_create.hxx +10 -11
- data/ext/couchbase/operations/analytics_dataverse_drop.hxx +10 -11
- data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +9 -11
- data/ext/couchbase/operations/analytics_index_create.hxx +14 -13
- data/ext/couchbase/operations/analytics_index_drop.hxx +18 -12
- data/ext/couchbase/operations/analytics_index_get_all.hxx +8 -6
- data/ext/couchbase/operations/analytics_link.hxx +39 -0
- data/ext/couchbase/operations/analytics_link_azure_blob_external.hxx +145 -0
- data/ext/couchbase/operations/analytics_link_connect.hxx +14 -12
- data/ext/couchbase/operations/analytics_link_couchbase_remote.hxx +220 -0
- data/ext/couchbase/operations/analytics_link_create.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_disconnect.hxx +11 -12
- data/ext/couchbase/operations/analytics_link_drop.hxx +130 -0
- data/ext/couchbase/operations/analytics_link_get_all.hxx +160 -0
- data/ext/couchbase/operations/analytics_link_replace.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_s3_external.hxx +122 -0
- data/ext/couchbase/operations/bucket_create.hxx +8 -8
- data/ext/couchbase/operations/bucket_drop.hxx +5 -5
- data/ext/couchbase/operations/bucket_flush.hxx +5 -5
- data/ext/couchbase/operations/bucket_get.hxx +7 -7
- data/ext/couchbase/operations/bucket_get_all.hxx +7 -5
- data/ext/couchbase/operations/bucket_settings.hxx +40 -49
- data/ext/couchbase/operations/bucket_update.hxx +8 -8
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +7 -7
- data/ext/couchbase/operations/collection_create.hxx +11 -11
- data/ext/couchbase/operations/collection_drop.hxx +12 -10
- data/ext/couchbase/operations/collections_manifest_get.hxx +3 -3
- data/ext/couchbase/operations/design_document.hxx +2 -2
- data/ext/couchbase/operations/document_analytics.hxx +29 -36
- data/ext/couchbase/operations/document_append.hxx +3 -3
- data/ext/couchbase/operations/document_decrement.hxx +3 -3
- data/ext/couchbase/operations/document_exists.hxx +2 -2
- data/ext/couchbase/operations/document_get.hxx +3 -3
- data/ext/couchbase/operations/document_get_and_lock.hxx +5 -3
- data/ext/couchbase/operations/document_get_and_touch.hxx +5 -3
- data/ext/couchbase/operations/document_get_projected.hxx +10 -11
- data/ext/couchbase/operations/document_increment.hxx +3 -3
- data/ext/couchbase/operations/document_insert.hxx +3 -3
- data/ext/couchbase/operations/document_lookup_in.hxx +12 -18
- data/ext/couchbase/operations/document_mutate_in.hxx +13 -18
- data/ext/couchbase/operations/document_prepend.hxx +3 -3
- data/ext/couchbase/operations/document_query.hxx +39 -41
- data/ext/couchbase/operations/document_remove.hxx +3 -3
- data/ext/couchbase/operations/document_replace.hxx +3 -3
- data/ext/couchbase/operations/document_search.hxx +56 -61
- data/ext/couchbase/operations/document_touch.hxx +3 -3
- data/ext/couchbase/operations/document_unlock.hxx +3 -3
- data/ext/couchbase/operations/document_upsert.hxx +3 -3
- data/ext/couchbase/operations/document_view.hxx +23 -23
- data/ext/couchbase/operations/group_drop.hxx +5 -5
- data/ext/couchbase/operations/group_get.hxx +7 -7
- data/ext/couchbase/operations/group_get_all.hxx +6 -6
- data/ext/couchbase/operations/group_upsert.hxx +11 -11
- data/ext/couchbase/operations/http_noop.hxx +6 -6
- data/ext/couchbase/operations/mcbp_noop.hxx +3 -3
- data/ext/couchbase/operations/query_index_build_deferred.hxx +6 -6
- data/ext/couchbase/operations/query_index_create.hxx +10 -8
- data/ext/couchbase/operations/query_index_drop.hxx +8 -8
- data/ext/couchbase/operations/query_index_get_all.hxx +43 -39
- data/ext/couchbase/operations/rbac.hxx +40 -63
- data/ext/couchbase/operations/role_get_all.hxx +6 -6
- data/ext/couchbase/operations/scope_create.hxx +10 -10
- data/ext/couchbase/operations/scope_drop.hxx +9 -9
- data/ext/couchbase/operations/scope_get_all.hxx +8 -8
- data/ext/couchbase/operations/search_get_stats.hxx +5 -3
- data/ext/couchbase/operations/search_index.hxx +6 -15
- data/ext/couchbase/operations/search_index_analyze_document.hxx +11 -11
- data/ext/couchbase/operations/search_index_control_ingest.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_query.hxx +9 -9
- data/ext/couchbase/operations/search_index_drop.hxx +11 -9
- data/ext/couchbase/operations/search_index_get.hxx +11 -9
- data/ext/couchbase/operations/search_index_get_all.hxx +11 -11
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +10 -10
- data/ext/couchbase/operations/search_index_get_stats.hxx +10 -8
- data/ext/couchbase/operations/search_index_upsert.hxx +12 -10
- data/ext/couchbase/operations/user_drop.hxx +5 -5
- data/ext/couchbase/operations/user_get.hxx +7 -7
- data/ext/couchbase/operations/user_get_all.hxx +6 -6
- data/ext/couchbase/operations/user_upsert.hxx +9 -9
- data/ext/couchbase/operations/view_index_drop.hxx +10 -10
- data/ext/couchbase/operations/view_index_get.hxx +13 -15
- data/ext/couchbase/operations/view_index_get_all.hxx +17 -20
- data/ext/couchbase/operations/view_index_upsert.hxx +9 -7
- data/ext/couchbase/origin.hxx +14 -10
- data/ext/couchbase/platform/backtrace.c +1 -1
- data/ext/couchbase/platform/base64.cc +5 -5
- data/ext/couchbase/platform/base64.h +2 -5
- data/ext/couchbase/protocol/client_opcode.hxx +7 -4
- data/ext/couchbase/protocol/client_request.hxx +2 -2
- data/ext/couchbase/protocol/client_response.hxx +41 -16
- data/ext/couchbase/protocol/cmd_append.hxx +17 -16
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +4 -4
- data/ext/couchbase/protocol/cmd_decrement.hxx +10 -11
- data/ext/couchbase/protocol/cmd_exists.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get.hxx +11 -14
- data/ext/couchbase/protocol/cmd_get_and_lock.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +13 -18
- data/ext/couchbase/protocol/cmd_get_collection_id.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +12 -16
- data/ext/couchbase/protocol/cmd_get_error_map.hxx +14 -17
- data/ext/couchbase/protocol/cmd_hello.hxx +8 -10
- data/ext/couchbase/protocol/cmd_increment.hxx +9 -10
- data/ext/couchbase/protocol/cmd_insert.hxx +9 -9
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +12 -13
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +11 -11
- data/ext/couchbase/protocol/cmd_noop.hxx +16 -20
- data/ext/couchbase/protocol/cmd_prepend.hxx +9 -10
- data/ext/couchbase/protocol/cmd_remove.hxx +10 -13
- data/ext/couchbase/protocol/cmd_replace.hxx +7 -7
- data/ext/couchbase/protocol/cmd_sasl_auth.hxx +8 -10
- data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +10 -15
- data/ext/couchbase/protocol/cmd_sasl_step.hxx +10 -12
- data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -18
- data/ext/couchbase/protocol/cmd_touch.hxx +8 -11
- data/ext/couchbase/protocol/cmd_unlock.hxx +10 -14
- data/ext/couchbase/protocol/cmd_upsert.hxx +8 -8
- data/ext/couchbase/protocol/datatype.hxx +3 -3
- data/ext/couchbase/protocol/durability_level.hxx +2 -2
- data/ext/couchbase/protocol/frame_info_id.hxx +4 -4
- data/ext/couchbase/protocol/hello_feature.hxx +2 -2
- data/ext/couchbase/protocol/magic.hxx +2 -2
- data/ext/couchbase/protocol/server_opcode.hxx +2 -2
- data/ext/couchbase/protocol/server_request.hxx +1 -1
- data/ext/couchbase/protocol/status.hxx +4 -7
- data/ext/couchbase/protocol/unsigned_leb128.h +5 -20
- data/ext/couchbase/service_type.hxx +4 -4
- data/ext/couchbase/tracing/constants.hxx +261 -0
- data/ext/couchbase/tracing/noop_tracer.hxx +50 -0
- data/ext/couchbase/tracing/request_tracer.hxx +77 -0
- data/ext/couchbase/tracing/threshold_logging_options.hxx +64 -0
- data/ext/couchbase/tracing/threshold_logging_tracer.hxx +366 -0
- data/ext/couchbase/utils/byteswap.hxx +1 -1
- data/ext/couchbase/utils/connection_string.hxx +21 -1
- data/ext/couchbase/utils/name_codec.hxx +41 -0
- data/ext/couchbase/utils/url_codec.hxx +236 -0
- data/ext/couchbase/version.hxx +1 -1
- data/ext/test/CMakeLists.txt +1 -0
- data/ext/test/test_native_trivial_query.cxx +60 -0
- data/ext/third_party/hdr_histogram_c/CMakeLists.txt +84 -0
- data/ext/third_party/hdr_histogram_c/COPYING.txt +121 -0
- data/ext/third_party/hdr_histogram_c/LICENSE.txt +41 -0
- data/ext/third_party/hdr_histogram_c/config.cmake.in +6 -0
- data/ext/third_party/hdr_histogram_c/src/CMakeLists.txt +83 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_atomic.h +146 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.c +322 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.h +79 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_endian.h +116 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.c +1196 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.h +516 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.c +1290 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.h +236 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log_no_op.c +171 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.c +227 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.h +109 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_malloc.h +19 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_tests.h +22 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.c +108 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.h +55 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.c +98 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.h +49 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.c +143 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.h +51 -0
- data/lib/couchbase/cluster.rb +1 -0
- data/lib/couchbase/errors.rb +3 -0
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/analytics_index_manager.rb +920 -226
- data/lib/couchbase/management/bucket_manager.rb +207 -69
- data/lib/couchbase/management/collection_manager.rb +173 -61
- data/lib/couchbase/management/query_index_manager.rb +357 -169
- data/lib/couchbase/options.rb +75 -3
- data/lib/couchbase/scope.rb +102 -0
- data/lib/couchbase/utils/time.rb +4 -0
- data/lib/couchbase/version.rb +6 -6
- metadata +48 -5
@@ -96,7 +96,7 @@ class server_request
|
|
96
96
|
{
|
97
97
|
Expects(header_[0] == static_cast<std::uint8_t>(magic_));
|
98
98
|
Expects(header_[1] == static_cast<std::uint8_t>(Body::opcode));
|
99
|
-
opcode_ =
|
99
|
+
opcode_ = server_opcode(header_[1]);
|
100
100
|
data_type_ = header_[5];
|
101
101
|
|
102
102
|
uint32_t field = 0;
|
@@ -17,9 +17,7 @@
|
|
17
17
|
|
18
18
|
#pragma once
|
19
19
|
|
20
|
-
namespace couchbase
|
21
|
-
{
|
22
|
-
namespace protocol
|
20
|
+
namespace couchbase::protocol
|
23
21
|
{
|
24
22
|
enum class status : uint16_t {
|
25
23
|
success = 0x00,
|
@@ -81,10 +79,10 @@ enum class status : uint16_t {
|
|
81
79
|
subdoc_invalid_xattr_order = 0xd4,
|
82
80
|
};
|
83
81
|
|
84
|
-
constexpr
|
82
|
+
constexpr bool
|
85
83
|
is_valid_status(uint16_t code)
|
86
84
|
{
|
87
|
-
switch (
|
85
|
+
switch (status(code)) {
|
88
86
|
case status::success:
|
89
87
|
case status::not_found:
|
90
88
|
case status::exists:
|
@@ -156,8 +154,7 @@ status_to_string(uint16_t code)
|
|
156
154
|
return fmt::format("{} (unknown)", code);
|
157
155
|
}
|
158
156
|
|
159
|
-
} // namespace protocol
|
160
|
-
} // namespace couchbase
|
157
|
+
} // namespace couchbase::protocol
|
161
158
|
|
162
159
|
template<>
|
163
160
|
struct fmt::formatter<couchbase::protocol::status> : formatter<string_view> {
|
@@ -46,8 +46,8 @@ struct Leb128NoThrow {
|
|
46
46
|
* leb128 data.
|
47
47
|
*/
|
48
48
|
template<class T>
|
49
|
-
typename std::
|
50
|
-
decode_unsigned_leb128(std::string_view buf, struct Leb128NoThrow)
|
49
|
+
typename std::enable_if_t<std::is_unsigned_v<T>, std::pair<T, std::string_view>>
|
50
|
+
decode_unsigned_leb128(std::string_view buf, struct Leb128NoThrow /* unused */)
|
51
51
|
{
|
52
52
|
T rv = static_cast<uint8_t>(buf[0]) & 0x7fULL;
|
53
53
|
size_t end = 0;
|
@@ -83,7 +83,7 @@ decode_unsigned_leb128(std::string_view buf, struct Leb128NoThrow)
|
|
83
83
|
* a stop byte.
|
84
84
|
*/
|
85
85
|
template<class T>
|
86
|
-
typename std::
|
86
|
+
typename std::enable_if_t<std::is_unsigned_v<T>, std::pair<T, std::string_view>>
|
87
87
|
decode_unsigned_leb128(std::string_view buf)
|
88
88
|
{
|
89
89
|
if (buf.size() > 0) {
|
@@ -99,27 +99,12 @@ decode_unsigned_leb128(std::string_view buf)
|
|
99
99
|
* @return a buffer to the data after the leb128 prefix
|
100
100
|
*/
|
101
101
|
template<class T>
|
102
|
-
typename std::
|
102
|
+
typename std::enable_if_t<std::is_unsigned_v<T>, std::string_view>
|
103
103
|
skip_unsigned_leb128(std::string_view buf)
|
104
104
|
{
|
105
105
|
return decode_unsigned_leb128<T>(buf).second;
|
106
106
|
}
|
107
107
|
|
108
|
-
/// @return the index of the stop byte within buf
|
109
|
-
static inline std::optional<size_t>
|
110
|
-
unsigned_leb128_get_stop_byte_index(std::string_view buf)
|
111
|
-
{
|
112
|
-
// If buf does not contain a stop-byte, invalid
|
113
|
-
size_t stopByte = 0;
|
114
|
-
for (auto c : buf) {
|
115
|
-
if ((static_cast<uint8_t>(c) & 0x80ULL) == 0) {
|
116
|
-
return stopByte;
|
117
|
-
}
|
118
|
-
stopByte++;
|
119
|
-
}
|
120
|
-
return {};
|
121
|
-
}
|
122
|
-
|
123
108
|
// Empty, non specialised version of the decoder class
|
124
109
|
template<class T, class Enable = void>
|
125
110
|
class unsigned_leb128
|
@@ -131,7 +116,7 @@ class unsigned_leb128
|
|
131
116
|
* provides a const_byte_buffer for access to the encoded
|
132
117
|
*/
|
133
118
|
template<class T>
|
134
|
-
class unsigned_leb128<T, typename std::
|
119
|
+
class unsigned_leb128<T, typename std::enable_if_t<std::is_unsigned_v<T>>>
|
135
120
|
{
|
136
121
|
public:
|
137
122
|
explicit unsigned_leb128(T in)
|
@@ -20,11 +20,11 @@
|
|
20
20
|
namespace couchbase
|
21
21
|
{
|
22
22
|
enum class service_type {
|
23
|
-
|
23
|
+
key_value = 0,
|
24
24
|
query,
|
25
25
|
analytics,
|
26
26
|
search,
|
27
|
-
|
27
|
+
view,
|
28
28
|
management,
|
29
29
|
};
|
30
30
|
} // namespace couchbase
|
@@ -36,7 +36,7 @@ struct fmt::formatter<couchbase::service_type> : formatter<std::string_view> {
|
|
36
36
|
{
|
37
37
|
string_view name = "unknown";
|
38
38
|
switch (type) {
|
39
|
-
case couchbase::service_type::
|
39
|
+
case couchbase::service_type::key_value:
|
40
40
|
name = "kv";
|
41
41
|
break;
|
42
42
|
case couchbase::service_type::query:
|
@@ -48,7 +48,7 @@ struct fmt::formatter<couchbase::service_type> : formatter<std::string_view> {
|
|
48
48
|
case couchbase::service_type::search:
|
49
49
|
name = "search";
|
50
50
|
break;
|
51
|
-
case couchbase::service_type::
|
51
|
+
case couchbase::service_type::view:
|
52
52
|
name = "views";
|
53
53
|
break;
|
54
54
|
case couchbase::service_type::management:
|
@@ -0,0 +1,261 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2020-2021 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 <string_view>
|
21
|
+
|
22
|
+
#include <protocol/client_opcode.hxx>
|
23
|
+
#include <service_type.hxx>
|
24
|
+
|
25
|
+
namespace couchbase::tracing
|
26
|
+
{
|
27
|
+
namespace operation
|
28
|
+
{
|
29
|
+
constexpr auto step_dispatch = "cb.dispatch_to_server";
|
30
|
+
constexpr auto step_request_encoding = "cb.request_encoding";
|
31
|
+
constexpr auto http_query = "cb.query";
|
32
|
+
constexpr auto http_analytics = "cb.analytics";
|
33
|
+
constexpr auto http_search = "cb.search";
|
34
|
+
constexpr auto http_views = "cb.views";
|
35
|
+
constexpr auto http_manager = "cb.manager";
|
36
|
+
constexpr auto http_manager_analytics = "cb.manager_analytics";
|
37
|
+
constexpr auto http_manager_query = "cb.manager_query";
|
38
|
+
constexpr auto http_manager_buckets = "cb.manager_buckets";
|
39
|
+
constexpr auto http_manager_collections = "cb.manager_collections";
|
40
|
+
constexpr auto http_manager_search = "cb.manager_search";
|
41
|
+
constexpr auto http_manager_users = "cb.manager_users";
|
42
|
+
constexpr auto http_manager_views = "cb.manager_views";
|
43
|
+
constexpr auto mcbp_get = "cb.get";
|
44
|
+
constexpr auto mcbp_get_replica = "cb.get_replica";
|
45
|
+
constexpr auto mcbp_upsert = "cb.upsert";
|
46
|
+
constexpr auto mcbp_replace = "cb.replace";
|
47
|
+
constexpr auto mcbp_insert = "cb.insert";
|
48
|
+
constexpr auto mcbp_remove = "cb.remove";
|
49
|
+
constexpr auto mcbp_get_and_lock = "cb.get_and_lock";
|
50
|
+
constexpr auto mcbp_get_and_touch = "cb.get_and_touch";
|
51
|
+
constexpr auto mcbp_exists = "cb.exists";
|
52
|
+
constexpr auto mcbp_touch = "cb.touch";
|
53
|
+
constexpr auto mcbp_unlock = "cb.unlock";
|
54
|
+
constexpr auto mcbp_lookup_in = "cb.lookup_in";
|
55
|
+
constexpr auto mcbp_mutate_in = "cb.mutate_in";
|
56
|
+
constexpr auto mcbp_append = "cb.append";
|
57
|
+
constexpr auto mcbp_prepend = "cb.prepend";
|
58
|
+
constexpr auto mcbp_increment = "cb.increment";
|
59
|
+
constexpr auto mcbp_decrement = "cb.decrement";
|
60
|
+
constexpr auto mcbp_observe = "cb.observe";
|
61
|
+
/* multi-command operations */
|
62
|
+
constexpr auto mcbp_get_all_replicas = "cb.get_all_replicas";
|
63
|
+
constexpr auto mcbp_get_any_replica = "cb.get_any_replica";
|
64
|
+
constexpr auto mcbp_list = "cb.list";
|
65
|
+
constexpr auto mcbp_set = "cb.set";
|
66
|
+
constexpr auto mcbp_map = "cb.map";
|
67
|
+
constexpr auto mcbp_queue = "cb.queue";
|
68
|
+
constexpr auto mcbp_ping = "cb.ping";
|
69
|
+
} // namespace operation
|
70
|
+
|
71
|
+
namespace attributes
|
72
|
+
{
|
73
|
+
constexpr auto system = "db.system";
|
74
|
+
constexpr auto span_kind = "span.kind";
|
75
|
+
constexpr auto component = "db.couchbase.component";
|
76
|
+
constexpr auto instance = "db.instance";
|
77
|
+
|
78
|
+
constexpr auto orphan = "cb.orphan";
|
79
|
+
constexpr auto service = "cb.service";
|
80
|
+
constexpr auto operation_id = "cb.operation_id";
|
81
|
+
|
82
|
+
constexpr auto server_duration = "cb.server_duration";
|
83
|
+
constexpr auto local_id = "cb.local_id";
|
84
|
+
constexpr auto local_socket = "cb.local_socket";
|
85
|
+
constexpr auto remote_socket = "cb.remote_socket";
|
86
|
+
} // namespace attributes
|
87
|
+
|
88
|
+
namespace service
|
89
|
+
{
|
90
|
+
constexpr auto key_value = "kv";
|
91
|
+
constexpr auto query = "query";
|
92
|
+
constexpr auto search = "search";
|
93
|
+
constexpr auto view = "views";
|
94
|
+
constexpr auto analytics = "analytics";
|
95
|
+
constexpr auto management = "management";
|
96
|
+
} // namespace service
|
97
|
+
|
98
|
+
auto
|
99
|
+
span_name_for_http_service(service_type type)
|
100
|
+
{
|
101
|
+
switch (type) {
|
102
|
+
case service_type::query:
|
103
|
+
return operation::http_query;
|
104
|
+
|
105
|
+
case service_type::analytics:
|
106
|
+
return operation::http_analytics;
|
107
|
+
|
108
|
+
case service_type::search:
|
109
|
+
return operation::http_search;
|
110
|
+
|
111
|
+
case service_type::view:
|
112
|
+
return operation::http_views;
|
113
|
+
|
114
|
+
case service_type::management:
|
115
|
+
return operation::http_manager;
|
116
|
+
|
117
|
+
case service_type::key_value:
|
118
|
+
Expects(false);
|
119
|
+
}
|
120
|
+
Expects(false);
|
121
|
+
}
|
122
|
+
|
123
|
+
auto
|
124
|
+
service_name_for_http_service(service_type type)
|
125
|
+
{
|
126
|
+
switch (type) {
|
127
|
+
case service_type::query:
|
128
|
+
return service::query;
|
129
|
+
|
130
|
+
case service_type::analytics:
|
131
|
+
return service::analytics;
|
132
|
+
|
133
|
+
case service_type::search:
|
134
|
+
return service::search;
|
135
|
+
|
136
|
+
case service_type::view:
|
137
|
+
return service::view;
|
138
|
+
|
139
|
+
case service_type::management:
|
140
|
+
return service::management;
|
141
|
+
|
142
|
+
case service_type::key_value:
|
143
|
+
Expects(false);
|
144
|
+
}
|
145
|
+
Expects(false);
|
146
|
+
}
|
147
|
+
|
148
|
+
auto
|
149
|
+
span_name_for_mcbp_command(protocol::client_opcode opcode)
|
150
|
+
{
|
151
|
+
switch (opcode) {
|
152
|
+
case protocol::client_opcode::get:
|
153
|
+
return operation::mcbp_get;
|
154
|
+
|
155
|
+
case protocol::client_opcode::upsert:
|
156
|
+
return operation::mcbp_upsert;
|
157
|
+
|
158
|
+
case protocol::client_opcode::insert:
|
159
|
+
return operation::mcbp_insert;
|
160
|
+
|
161
|
+
case protocol::client_opcode::replace:
|
162
|
+
return operation::mcbp_replace;
|
163
|
+
|
164
|
+
case protocol::client_opcode::remove:
|
165
|
+
return operation::mcbp_remove;
|
166
|
+
|
167
|
+
case protocol::client_opcode::increment:
|
168
|
+
return operation::mcbp_increment;
|
169
|
+
|
170
|
+
case protocol::client_opcode::decrement:
|
171
|
+
return operation::mcbp_decrement;
|
172
|
+
|
173
|
+
case protocol::client_opcode::append:
|
174
|
+
return operation::mcbp_append;
|
175
|
+
|
176
|
+
case protocol::client_opcode::prepend:
|
177
|
+
return operation::mcbp_prepend;
|
178
|
+
|
179
|
+
case protocol::client_opcode::touch:
|
180
|
+
return operation::mcbp_touch;
|
181
|
+
|
182
|
+
case protocol::client_opcode::get_and_touch:
|
183
|
+
return operation::mcbp_get_and_touch;
|
184
|
+
|
185
|
+
case protocol::client_opcode::get_replica:
|
186
|
+
return operation::mcbp_get_replica;
|
187
|
+
|
188
|
+
case protocol::client_opcode::get_and_lock:
|
189
|
+
return operation::mcbp_get_and_lock;
|
190
|
+
|
191
|
+
case protocol::client_opcode::unlock:
|
192
|
+
return operation::mcbp_unlock;
|
193
|
+
|
194
|
+
case protocol::client_opcode::subdoc_multi_lookup:
|
195
|
+
return operation::mcbp_lookup_in;
|
196
|
+
|
197
|
+
case protocol::client_opcode::subdoc_multi_mutation:
|
198
|
+
return operation::mcbp_mutate_in;
|
199
|
+
|
200
|
+
case protocol::client_opcode::observe:
|
201
|
+
return operation::mcbp_exists;
|
202
|
+
|
203
|
+
case protocol::client_opcode::noop:
|
204
|
+
case protocol::client_opcode::version:
|
205
|
+
case protocol::client_opcode::stat:
|
206
|
+
case protocol::client_opcode::verbosity:
|
207
|
+
case protocol::client_opcode::hello:
|
208
|
+
case protocol::client_opcode::sasl_list_mechs:
|
209
|
+
case protocol::client_opcode::sasl_auth:
|
210
|
+
case protocol::client_opcode::sasl_step:
|
211
|
+
case protocol::client_opcode::get_all_vbucket_seqnos:
|
212
|
+
case protocol::client_opcode::dcp_open:
|
213
|
+
case protocol::client_opcode::dcp_add_stream:
|
214
|
+
case protocol::client_opcode::dcp_close_stream:
|
215
|
+
case protocol::client_opcode::dcp_stream_request:
|
216
|
+
case protocol::client_opcode::dcp_get_failover_log:
|
217
|
+
case protocol::client_opcode::dcp_stream_end:
|
218
|
+
case protocol::client_opcode::dcp_snapshot_marker:
|
219
|
+
case protocol::client_opcode::dcp_mutation:
|
220
|
+
case protocol::client_opcode::dcp_deletion:
|
221
|
+
case protocol::client_opcode::dcp_expiration:
|
222
|
+
case protocol::client_opcode::dcp_set_vbucket_state:
|
223
|
+
case protocol::client_opcode::dcp_noop:
|
224
|
+
case protocol::client_opcode::dcp_buffer_acknowledgement:
|
225
|
+
case protocol::client_opcode::dcp_control:
|
226
|
+
case protocol::client_opcode::dcp_system_event:
|
227
|
+
case protocol::client_opcode::dcp_prepare:
|
228
|
+
case protocol::client_opcode::dcp_seqno_acknowledged:
|
229
|
+
case protocol::client_opcode::dcp_commit:
|
230
|
+
case protocol::client_opcode::dcp_abort:
|
231
|
+
case protocol::client_opcode::dcp_seqno_advanced:
|
232
|
+
case protocol::client_opcode::dcp_oso_snapshot:
|
233
|
+
case protocol::client_opcode::list_buckets:
|
234
|
+
case protocol::client_opcode::select_bucket:
|
235
|
+
case protocol::client_opcode::observe_seqno:
|
236
|
+
case protocol::client_opcode::evict_key:
|
237
|
+
case protocol::client_opcode::get_failover_log:
|
238
|
+
case protocol::client_opcode::last_closed_checkpoint:
|
239
|
+
case protocol::client_opcode::get_meta:
|
240
|
+
case protocol::client_opcode::upsert_with_meta:
|
241
|
+
case protocol::client_opcode::insert_with_meta:
|
242
|
+
case protocol::client_opcode::remove_with_meta:
|
243
|
+
case protocol::client_opcode::create_checkpoint:
|
244
|
+
case protocol::client_opcode::checkpoint_persistence:
|
245
|
+
case protocol::client_opcode::return_meta:
|
246
|
+
case protocol::client_opcode::get_random_key:
|
247
|
+
case protocol::client_opcode::seqno_persistence:
|
248
|
+
case protocol::client_opcode::get_keys:
|
249
|
+
case protocol::client_opcode::set_collections_manifest:
|
250
|
+
case protocol::client_opcode::get_collections_manifest:
|
251
|
+
case protocol::client_opcode::get_collection_id:
|
252
|
+
case protocol::client_opcode::get_scope_id:
|
253
|
+
case protocol::client_opcode::get_cluster_config:
|
254
|
+
case protocol::client_opcode::get_error_map:
|
255
|
+
case protocol::client_opcode::invalid:
|
256
|
+
Expects(false);
|
257
|
+
}
|
258
|
+
Expects(false);
|
259
|
+
}
|
260
|
+
|
261
|
+
} // namespace couchbase::tracing
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2021 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 "request_tracer.hxx"
|
21
|
+
|
22
|
+
namespace couchbase::tracing
|
23
|
+
{
|
24
|
+
|
25
|
+
class noop_span : public request_span
|
26
|
+
{
|
27
|
+
void add_tag(const std::string& /* name */, std::uint64_t /* value */) override
|
28
|
+
{
|
29
|
+
}
|
30
|
+
|
31
|
+
void add_tag(const std::string& /* name */, const std::string& /* value */) override
|
32
|
+
{
|
33
|
+
}
|
34
|
+
|
35
|
+
void end() override
|
36
|
+
{
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
class noop_tracer : public request_tracer
|
41
|
+
{
|
42
|
+
public:
|
43
|
+
request_span* start_span(std::string /* name */, request_span* /* parent */) override
|
44
|
+
{
|
45
|
+
static noop_span instance{};
|
46
|
+
return &instance;
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
} // namespace couchbase::tracing
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2021 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 "constants.hxx"
|
21
|
+
|
22
|
+
namespace couchbase::tracing
|
23
|
+
{
|
24
|
+
|
25
|
+
class request_span
|
26
|
+
{
|
27
|
+
public:
|
28
|
+
request_span() = default;
|
29
|
+
request_span(const request_span& other) = default;
|
30
|
+
request_span(request_span&& other) = default;
|
31
|
+
request_span& operator=(const request_span& other) = default;
|
32
|
+
request_span& operator=(request_span&& other) = default;
|
33
|
+
virtual ~request_span() = default;
|
34
|
+
|
35
|
+
explicit request_span(const std::string& name)
|
36
|
+
: name_(name)
|
37
|
+
, parent_(nullptr)
|
38
|
+
{
|
39
|
+
}
|
40
|
+
request_span(std::string name, request_span* parent)
|
41
|
+
: name_(std::move(name))
|
42
|
+
, parent_(parent)
|
43
|
+
{
|
44
|
+
}
|
45
|
+
virtual void add_tag(const std::string& name, std::uint64_t value) = 0;
|
46
|
+
virtual void add_tag(const std::string& name, const std::string& value) = 0;
|
47
|
+
virtual void end() = 0;
|
48
|
+
|
49
|
+
[[nodiscard]] const std::string& name() const
|
50
|
+
{
|
51
|
+
return name_;
|
52
|
+
}
|
53
|
+
|
54
|
+
[[nodiscard]] const request_span* parent() const
|
55
|
+
{
|
56
|
+
return parent_;
|
57
|
+
}
|
58
|
+
|
59
|
+
private:
|
60
|
+
std::string name_{};
|
61
|
+
request_span* parent_{ nullptr };
|
62
|
+
};
|
63
|
+
|
64
|
+
class request_tracer
|
65
|
+
{
|
66
|
+
public:
|
67
|
+
request_tracer() = default;
|
68
|
+
request_tracer(const request_tracer& other) = default;
|
69
|
+
request_tracer(request_tracer&& other) = default;
|
70
|
+
request_tracer& operator=(const request_tracer& other) = default;
|
71
|
+
request_tracer& operator=(request_tracer&& other) = default;
|
72
|
+
virtual ~request_tracer() = default;
|
73
|
+
|
74
|
+
virtual request_span* start_span(std::string name, request_span* parent) = 0;
|
75
|
+
};
|
76
|
+
|
77
|
+
} // namespace couchbase::tracing
|