couchbase 3.7.0 → 3.8.0

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.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/ext/CMakeLists.txt +4 -1
  4. data/ext/cache/extconf_include.rb +4 -3
  5. data/ext/cache/mozilla-ca-bundle.crt +66 -93
  6. data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
  7. data/ext/couchbase/CMakeLists.txt +24 -11
  8. data/ext/couchbase/cmake/APKBUILD.in +17 -1
  9. data/ext/couchbase/cmake/Bundler.cmake +9 -1
  10. data/ext/couchbase/cmake/Cache.cmake +48 -19
  11. data/ext/couchbase/cmake/CompilerOptions.cmake +3 -1
  12. data/ext/couchbase/cmake/OpenSSL.cmake +10 -2
  13. data/ext/couchbase/cmake/Packaging.cmake +48 -8
  14. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +43 -1
  15. data/ext/couchbase/cmake/build_config.hxx.in +2 -0
  16. data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +18 -0
  17. data/ext/couchbase/cmake/tarball_glob.txt +10 -0
  18. data/ext/couchbase/core/app_telemetry_meter.cxx +1 -0
  19. data/ext/couchbase/core/app_telemetry_reporter.cxx +45 -43
  20. data/ext/couchbase/core/app_telemetry_reporter.hxx +4 -3
  21. data/ext/couchbase/core/bucket.cxx +128 -13
  22. data/ext/couchbase/core/bucket.hxx +12 -2
  23. data/ext/couchbase/core/cluster.cxx +304 -152
  24. data/ext/couchbase/core/cluster.hxx +32 -0
  25. data/ext/couchbase/core/cluster_credentials.cxx +25 -0
  26. data/ext/couchbase/core/cluster_credentials.hxx +5 -0
  27. data/ext/couchbase/core/cluster_label_listener.cxx +72 -0
  28. data/ext/couchbase/core/cluster_label_listener.hxx +46 -0
  29. data/ext/couchbase/core/cluster_options.hxx +4 -0
  30. data/ext/couchbase/core/deprecation_utils.hxx +26 -0
  31. data/ext/couchbase/core/error.hxx +27 -0
  32. data/ext/couchbase/core/free_form_http_request.hxx +0 -2
  33. data/ext/couchbase/core/http_component.cxx +12 -48
  34. data/ext/couchbase/core/impl/analytics.cxx +3 -2
  35. data/ext/couchbase/core/impl/analytics.hxx +2 -1
  36. data/ext/couchbase/core/impl/analytics_index_manager.cxx +249 -137
  37. data/ext/couchbase/core/impl/binary_collection.cxx +134 -58
  38. data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
  39. data/ext/couchbase/core/impl/collection.cxx +560 -245
  40. data/ext/couchbase/core/impl/collection_manager.cxx +89 -49
  41. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +4 -4
  42. data/ext/couchbase/core/impl/error.cxx +20 -13
  43. data/ext/couchbase/core/impl/error.hxx +15 -10
  44. data/ext/couchbase/core/impl/get_all_replicas.hxx +1 -1
  45. data/ext/couchbase/core/impl/get_any_replica.hxx +2 -1
  46. data/ext/couchbase/core/impl/get_replica.hxx +2 -0
  47. data/ext/couchbase/core/impl/lookup_in_replica.hxx +1 -1
  48. data/ext/couchbase/core/impl/observability_recorder.cxx +161 -0
  49. data/ext/couchbase/core/impl/observability_recorder.hxx +77 -0
  50. data/ext/couchbase/core/impl/observe_seqno.hxx +2 -0
  51. data/ext/couchbase/core/impl/public_bucket.cxx +31 -7
  52. data/ext/couchbase/core/impl/public_cluster.cxx +107 -19
  53. data/ext/couchbase/core/impl/query.cxx +6 -3
  54. data/ext/couchbase/core/impl/query.hxx +3 -1
  55. data/ext/couchbase/core/impl/query_index_manager.cxx +267 -102
  56. data/ext/couchbase/core/impl/scope.cxx +53 -11
  57. data/ext/couchbase/core/impl/search.cxx +8 -4
  58. data/ext/couchbase/core/impl/search.hxx +6 -2
  59. data/ext/couchbase/core/impl/search_index_manager.cxx +131 -41
  60. data/ext/couchbase/core/impl/with_cancellation.hxx +75 -0
  61. data/ext/couchbase/core/io/config_tracker.cxx +9 -9
  62. data/ext/couchbase/core/io/config_tracker.hxx +2 -1
  63. data/ext/couchbase/core/io/http_command.hxx +98 -49
  64. data/ext/couchbase/core/io/http_context.hxx +2 -0
  65. data/ext/couchbase/core/io/http_session.cxx +23 -10
  66. data/ext/couchbase/core/io/http_session.hxx +17 -9
  67. data/ext/couchbase/core/io/http_session_manager.hxx +163 -228
  68. data/ext/couchbase/core/io/http_traits.hxx +0 -7
  69. data/ext/couchbase/core/io/mcbp_command.hxx +123 -44
  70. data/ext/couchbase/core/io/mcbp_session.cxx +251 -26
  71. data/ext/couchbase/core/io/mcbp_session.hxx +9 -1
  72. data/ext/couchbase/core/io/mcbp_traits.hxx +0 -8
  73. data/ext/couchbase/core/io/streams.cxx +3 -3
  74. data/ext/couchbase/core/io/streams.hxx +3 -2
  75. data/ext/couchbase/core/meta/features.hxx +15 -0
  76. data/ext/couchbase/core/meta/version.cxx +13 -0
  77. data/ext/couchbase/core/meta/version.hxx +3 -0
  78. data/ext/couchbase/core/metrics/constants.hxx +23 -0
  79. data/ext/couchbase/core/metrics/logging_meter.cxx +5 -5
  80. data/ext/couchbase/core/metrics/meter_wrapper.cxx +65 -63
  81. data/ext/couchbase/core/metrics/meter_wrapper.hxx +12 -10
  82. data/ext/couchbase/core/operations/document_analytics.hxx +0 -5
  83. data/ext/couchbase/core/operations/document_append.hxx +0 -4
  84. data/ext/couchbase/core/operations/document_decrement.hxx +0 -5
  85. data/ext/couchbase/core/operations/document_exists.hxx +0 -7
  86. data/ext/couchbase/core/operations/document_get.hxx +0 -7
  87. data/ext/couchbase/core/operations/document_get_all_replicas.hxx +77 -27
  88. data/ext/couchbase/core/operations/document_get_and_lock.hxx +0 -9
  89. data/ext/couchbase/core/operations/document_get_and_touch.hxx +0 -9
  90. data/ext/couchbase/core/operations/document_get_any_replica.hxx +83 -2
  91. data/ext/couchbase/core/operations/document_get_projected.hxx +0 -9
  92. data/ext/couchbase/core/operations/document_increment.hxx +0 -5
  93. data/ext/couchbase/core/operations/document_insert.hxx +0 -4
  94. data/ext/couchbase/core/operations/document_lookup_in.hxx +0 -9
  95. data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +46 -4
  96. data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +121 -43
  97. data/ext/couchbase/core/operations/document_mutate_in.hxx +0 -5
  98. data/ext/couchbase/core/operations/document_prepend.hxx +0 -4
  99. data/ext/couchbase/core/operations/document_query.hxx +0 -4
  100. data/ext/couchbase/core/operations/document_remove.hxx +0 -4
  101. data/ext/couchbase/core/operations/document_replace.hxx +0 -4
  102. data/ext/couchbase/core/operations/document_search.hxx +0 -7
  103. data/ext/couchbase/core/operations/document_touch.hxx +0 -7
  104. data/ext/couchbase/core/operations/document_unlock.hxx +0 -6
  105. data/ext/couchbase/core/operations/document_upsert.hxx +0 -4
  106. data/ext/couchbase/core/operations/document_view.cxx +2 -0
  107. data/ext/couchbase/core/operations/document_view.hxx +10 -13
  108. data/ext/couchbase/core/operations/http_noop.hxx +2 -0
  109. data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +2 -0
  110. data/ext/couchbase/core/operations/management/analytics_dataset_drop.hxx +2 -0
  111. data/ext/couchbase/core/operations/management/analytics_dataset_get_all.hxx +2 -0
  112. data/ext/couchbase/core/operations/management/analytics_dataverse_create.hxx +2 -0
  113. data/ext/couchbase/core/operations/management/analytics_dataverse_drop.hxx +2 -0
  114. data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
  115. data/ext/couchbase/core/operations/management/analytics_index_create.hxx +2 -0
  116. data/ext/couchbase/core/operations/management/analytics_index_drop.hxx +2 -0
  117. data/ext/couchbase/core/operations/management/analytics_index_get_all.hxx +2 -0
  118. data/ext/couchbase/core/operations/management/analytics_link_connect.hxx +2 -0
  119. data/ext/couchbase/core/operations/management/analytics_link_create.hxx +2 -0
  120. data/ext/couchbase/core/operations/management/analytics_link_disconnect.hxx +2 -0
  121. data/ext/couchbase/core/operations/management/analytics_link_drop.hxx +2 -0
  122. data/ext/couchbase/core/operations/management/analytics_link_get_all.hxx +2 -0
  123. data/ext/couchbase/core/operations/management/analytics_link_replace.hxx +2 -0
  124. data/ext/couchbase/core/operations/management/bucket_create.hxx +2 -0
  125. data/ext/couchbase/core/operations/management/bucket_describe.hxx +2 -0
  126. data/ext/couchbase/core/operations/management/bucket_drop.hxx +2 -0
  127. data/ext/couchbase/core/operations/management/bucket_flush.hxx +2 -0
  128. data/ext/couchbase/core/operations/management/bucket_get.hxx +2 -0
  129. data/ext/couchbase/core/operations/management/bucket_get_all.hxx +2 -0
  130. data/ext/couchbase/core/operations/management/bucket_update.hxx +2 -0
  131. data/ext/couchbase/core/operations/management/change_password.hxx +2 -0
  132. data/ext/couchbase/core/operations/management/cluster_describe.hxx +2 -0
  133. data/ext/couchbase/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
  134. data/ext/couchbase/core/operations/management/collection_create.hxx +2 -0
  135. data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
  136. data/ext/couchbase/core/operations/management/collection_update.hxx +2 -0
  137. data/ext/couchbase/core/operations/management/collections_manifest_get.hxx +2 -0
  138. data/ext/couchbase/core/operations/management/error_utils.cxx +4 -1
  139. data/ext/couchbase/core/operations/management/eventing_deploy_function.hxx +2 -0
  140. data/ext/couchbase/core/operations/management/eventing_drop_function.hxx +2 -0
  141. data/ext/couchbase/core/operations/management/eventing_get_all_functions.hxx +2 -0
  142. data/ext/couchbase/core/operations/management/eventing_get_function.hxx +2 -0
  143. data/ext/couchbase/core/operations/management/eventing_get_status.hxx +2 -0
  144. data/ext/couchbase/core/operations/management/eventing_pause_function.hxx +2 -0
  145. data/ext/couchbase/core/operations/management/eventing_resume_function.hxx +2 -0
  146. data/ext/couchbase/core/operations/management/eventing_undeploy_function.hxx +2 -0
  147. data/ext/couchbase/core/operations/management/eventing_upsert_function.hxx +2 -0
  148. data/ext/couchbase/core/operations/management/freeform.hxx +2 -0
  149. data/ext/couchbase/core/operations/management/group_drop.hxx +2 -0
  150. data/ext/couchbase/core/operations/management/group_get.hxx +2 -0
  151. data/ext/couchbase/core/operations/management/group_get_all.hxx +2 -0
  152. data/ext/couchbase/core/operations/management/group_upsert.hxx +2 -0
  153. data/ext/couchbase/core/operations/management/query_index_build.hxx +2 -0
  154. data/ext/couchbase/core/operations/management/query_index_build_deferred.hxx +68 -30
  155. data/ext/couchbase/core/operations/management/query_index_create.hxx +2 -0
  156. data/ext/couchbase/core/operations/management/query_index_drop.hxx +2 -0
  157. data/ext/couchbase/core/operations/management/query_index_get_all.hxx +4 -3
  158. data/ext/couchbase/core/operations/management/query_index_get_all_deferred.hxx +2 -1
  159. data/ext/couchbase/core/operations/management/role_get_all.hxx +2 -0
  160. data/ext/couchbase/core/operations/management/scope_create.hxx +2 -0
  161. data/ext/couchbase/core/operations/management/scope_drop.hxx +2 -0
  162. data/ext/couchbase/core/operations/management/scope_get_all.hxx +2 -0
  163. data/ext/couchbase/core/operations/management/search_get_stats.hxx +2 -0
  164. data/ext/couchbase/core/operations/management/search_index_analyze_document.hxx +2 -0
  165. data/ext/couchbase/core/operations/management/search_index_control_ingest.hxx +2 -0
  166. data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
  167. data/ext/couchbase/core/operations/management/search_index_control_query.hxx +2 -0
  168. data/ext/couchbase/core/operations/management/search_index_drop.hxx +2 -0
  169. data/ext/couchbase/core/operations/management/search_index_get.hxx +2 -0
  170. data/ext/couchbase/core/operations/management/search_index_get_all.hxx +2 -0
  171. data/ext/couchbase/core/operations/management/search_index_get_documents_count.hxx +2 -0
  172. data/ext/couchbase/core/operations/management/search_index_get_stats.hxx +2 -0
  173. data/ext/couchbase/core/operations/management/search_index_upsert.hxx +2 -0
  174. data/ext/couchbase/core/operations/management/user_drop.hxx +2 -0
  175. data/ext/couchbase/core/operations/management/user_get.hxx +2 -0
  176. data/ext/couchbase/core/operations/management/user_get_all.hxx +2 -0
  177. data/ext/couchbase/core/operations/management/user_upsert.hxx +2 -0
  178. data/ext/couchbase/core/operations/management/view_index_drop.hxx +2 -0
  179. data/ext/couchbase/core/operations/management/view_index_get.hxx +2 -0
  180. data/ext/couchbase/core/operations/management/view_index_get_all.hxx +2 -0
  181. data/ext/couchbase/core/operations/management/view_index_upsert.hxx +2 -0
  182. data/ext/couchbase/core/operations/operation_traits.hxx +6 -0
  183. data/ext/couchbase/core/operations.hxx +0 -1
  184. data/ext/couchbase/core/operations_fwd.hxx +8 -0
  185. data/ext/couchbase/core/origin.cxx +67 -12
  186. data/ext/couchbase/core/origin.hxx +13 -8
  187. data/ext/couchbase/core/orphan_reporter.cxx +164 -0
  188. data/ext/couchbase/core/orphan_reporter.hxx +65 -0
  189. data/ext/couchbase/core/sasl/CMakeLists.txt +1 -0
  190. data/ext/couchbase/core/sasl/client.cc +6 -0
  191. data/ext/couchbase/core/sasl/mechanism.cc +2 -1
  192. data/ext/couchbase/core/sasl/mechanism.h +2 -1
  193. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.cc +41 -0
  194. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.h +47 -0
  195. data/ext/couchbase/core/tls_context_provider.cxx +44 -0
  196. data/ext/couchbase/core/tls_context_provider.hxx +44 -0
  197. data/ext/couchbase/core/tracing/attribute_helpers.hxx +45 -0
  198. data/ext/couchbase/core/tracing/constants.hxx +148 -68
  199. data/ext/couchbase/core/tracing/threshold_logging_options.hxx +0 -3
  200. data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +122 -170
  201. data/ext/couchbase/core/tracing/tracer_wrapper.cxx +17 -24
  202. data/ext/couchbase/core/tracing/tracer_wrapper.hxx +8 -10
  203. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.cxx +114 -0
  204. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.hxx +85 -0
  205. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +16 -14
  206. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +4 -4
  207. data/ext/couchbase/core/transactions/transactions.cxx +1 -1
  208. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +1 -2
  209. data/ext/couchbase/core/utils/byteswap.hxx +12 -0
  210. data/ext/couchbase/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
  211. data/ext/couchbase/core/utils/connection_string.cxx +2 -0
  212. data/ext/couchbase/couchbase/certificate_authenticator.hxx +1 -0
  213. data/ext/couchbase/couchbase/cluster.hxx +47 -0
  214. data/ext/couchbase/couchbase/cluster_options.hxx +16 -0
  215. data/ext/couchbase/couchbase/collection.hxx +60 -15
  216. data/ext/couchbase/couchbase/error_codes.hxx +48 -48
  217. data/ext/couchbase/couchbase/jwt_authenticator.hxx +52 -0
  218. data/ext/couchbase/couchbase/metrics/meter.hxx +2 -1
  219. data/ext/couchbase/couchbase/metrics/otel_meter.hxx +75 -80
  220. data/ext/couchbase/couchbase/network_options.hxx +19 -0
  221. data/ext/couchbase/couchbase/password_authenticator.hxx +1 -0
  222. data/ext/couchbase/couchbase/tracing/otel_tracer.hxx +15 -17
  223. data/ext/couchbase/couchbase/tracing/request_span.hxx +2 -2
  224. data/ext/couchbase.cxx +4 -0
  225. data/ext/extconf.rb +1 -0
  226. data/ext/rcb_analytics.cxx +157 -47
  227. data/ext/rcb_backend.cxx +118 -71
  228. data/ext/rcb_buckets.cxx +39 -16
  229. data/ext/rcb_collections.cxx +36 -12
  230. data/ext/rcb_crud.cxx +587 -294
  231. data/ext/rcb_hdr_histogram.cxx +219 -0
  232. data/ext/rcb_hdr_histogram.hxx +28 -0
  233. data/ext/rcb_multi.cxx +142 -59
  234. data/ext/rcb_observability.cxx +132 -0
  235. data/ext/rcb_observability.hxx +49 -0
  236. data/ext/rcb_query.cxx +77 -27
  237. data/ext/rcb_search.cxx +92 -31
  238. data/ext/rcb_users.cxx +69 -26
  239. data/ext/rcb_utils.cxx +91 -0
  240. data/ext/rcb_utils.hxx +141 -168
  241. data/ext/rcb_views.cxx +36 -12
  242. data/lib/active_support/cache/couchbase_store.rb +6 -6
  243. data/lib/couchbase/authenticator.rb +14 -0
  244. data/lib/couchbase/binary_collection.rb +37 -22
  245. data/lib/couchbase/bucket.rb +46 -31
  246. data/lib/couchbase/cluster.rb +146 -61
  247. data/lib/couchbase/collection.rb +257 -186
  248. data/lib/couchbase/datastructures/couchbase_list.rb +81 -50
  249. data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
  250. data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
  251. data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
  252. data/lib/couchbase/deprecations.rb +1 -1
  253. data/lib/couchbase/diagnostics.rb +8 -8
  254. data/lib/couchbase/errors.rb +6 -0
  255. data/lib/couchbase/management/analytics_index_manager.rb +90 -59
  256. data/lib/couchbase/management/bucket_manager.rb +73 -45
  257. data/lib/couchbase/management/collection_manager.rb +86 -43
  258. data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
  259. data/lib/couchbase/management/query_index_manager.rb +88 -36
  260. data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
  261. data/lib/couchbase/management/search_index_manager.rb +401 -178
  262. data/lib/couchbase/management/user_manager.rb +343 -174
  263. data/lib/couchbase/management/view_index_manager.rb +166 -73
  264. data/lib/couchbase/metrics/logging_meter.rb +108 -0
  265. data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
  266. data/lib/couchbase/metrics/meter.rb +27 -0
  267. data/lib/couchbase/metrics/noop_meter.rb +30 -0
  268. data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
  269. data/lib/couchbase/metrics/value_recorder.rb +25 -0
  270. data/lib/couchbase/options.rb +69 -3
  271. data/lib/couchbase/protostellar/cluster.rb +3 -0
  272. data/lib/couchbase/scope.rb +62 -48
  273. data/lib/couchbase/search_options.rb +18 -18
  274. data/lib/couchbase/tracing/noop_span.rb +29 -0
  275. data/lib/couchbase/tracing/noop_tracer.rb +29 -0
  276. data/lib/couchbase/tracing/request_span.rb +34 -0
  277. data/lib/couchbase/tracing/request_tracer.rb +28 -0
  278. data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
  279. data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
  280. data/lib/couchbase/utils/hdr_histogram.rb +55 -0
  281. data/lib/couchbase/utils/observability.rb +257 -0
  282. data/lib/couchbase/utils/observability_constants.rb +200 -0
  283. data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
  284. data/lib/couchbase/version.rb +1 -1
  285. data/lib/couchbase.rb +2 -2
  286. metadata +58 -6
@@ -19,8 +19,10 @@
19
19
 
20
20
  #include <couchbase/build_config.hxx>
21
21
 
22
+ #include "core/cluster_credentials.hxx"
22
23
  #include "core/protocol/hello_feature.hxx"
23
24
  #include "core/response_handler.hxx"
25
+ #include "core/tls_context_provider.hxx"
24
26
  #include "core/utils/movable_function.hxx"
25
27
  #include "mcbp_context.hxx"
26
28
  #include "mcbp_message.hxx"
@@ -100,7 +102,7 @@ public:
100
102
  mcbp_session(const std::string& client_id,
101
103
  const std::string& node_uuid,
102
104
  asio::io_context& ctx,
103
- asio::ssl::context& tls,
105
+ tls_context_provider& tls,
104
106
  couchbase::core::origin origin,
105
107
  std::shared_ptr<impl::bootstrap_state_listener> state_listener,
106
108
  std::optional<std::string> bucket_name = {},
@@ -119,6 +121,8 @@ public:
119
121
  [[nodiscard]] auto id() const -> const std::string&;
120
122
  [[nodiscard]] auto node_uuid() const -> const std::string&;
121
123
  [[nodiscard]] auto remote_address() const -> std::string;
124
+ [[nodiscard]] auto remote_hostname() const -> std::string;
125
+ [[nodiscard]] auto remote_port() const -> std::uint16_t;
122
126
  [[nodiscard]] auto local_address() const -> std::string;
123
127
  [[nodiscard]] auto bootstrap_address() const -> const std::string&;
124
128
  [[nodiscard]] auto bootstrap_hostname() const -> const std::string&;
@@ -126,6 +130,8 @@ public:
126
130
  [[nodiscard]] auto bootstrap_port_number() const -> std::uint16_t;
127
131
  [[nodiscard]] auto last_bootstrap_error() && -> std::optional<impl::bootstrap_error>;
128
132
  [[nodiscard]] auto last_bootstrap_error() const& -> const std::optional<impl::bootstrap_error>&;
133
+ [[nodiscard]] auto canonical_hostname() const -> const std::string&;
134
+ [[nodiscard]] auto canonical_port_number() const -> std::uint16_t;
129
135
  void write_and_flush(std::vector<std::byte>&& buffer);
130
136
  void write_and_subscribe(const std::shared_ptr<mcbp::queue_request>&,
131
137
  const std::shared_ptr<response_handler>& handler);
@@ -134,6 +140,8 @@ public:
134
140
  command_handler&& handler);
135
141
  void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& handler,
136
142
  bool retry_on_bucket_not_found = false);
143
+ void reauthenticate();
144
+ void update_credentials(cluster_credentials credentials);
137
145
  void on_stop(utils::movable_function<void()> handler);
138
146
  void stop(retry_reason reason);
139
147
  [[nodiscard]] auto index() const -> std::size_t;
@@ -27,12 +27,4 @@ struct supports_durability : public std::false_type {
27
27
 
28
28
  template<typename T>
29
29
  inline constexpr bool supports_durability_v = supports_durability<T>::value;
30
-
31
- template<typename T>
32
- struct supports_parent_span : public std::false_type {
33
- };
34
-
35
- template<typename T>
36
- inline constexpr bool supports_parent_span_v = supports_parent_span<T>::value;
37
-
38
30
  } // namespace couchbase::core::io::mcbp_traits
@@ -140,12 +140,12 @@ plain_stream_impl::async_read_some(
140
140
  return stream_->async_read_some(buffer, std::move(handler));
141
141
  }
142
142
 
143
- tls_stream_impl::tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls)
143
+ tls_stream_impl::tls_stream_impl(asio::io_context& ctx, tls_context_provider& tls)
144
144
  : stream_impl(ctx, true)
145
145
  , tls_(tls)
146
146
  , stream_(
147
147
  std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(asio::ip::tcp::socket(strand_),
148
- tls_))
148
+ *tls_.get_ctx()))
149
149
  {
150
150
  }
151
151
 
@@ -204,7 +204,7 @@ tls_stream_impl::async_connect(const asio::ip::tcp::resolver::results_type::endp
204
204
  if (!stream_) {
205
205
  id_ = uuid::to_string(uuid::random());
206
206
  stream_ = std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(
207
- asio::ip::tcp::socket(strand_), tls_);
207
+ asio::ip::tcp::socket(strand_), *tls_.get_ctx());
208
208
  }
209
209
  return stream_->lowest_layer().async_connect(
210
210
  endpoint, [stream = stream_, handler = std::move(handler)](std::error_code ec_connect) mutable {
@@ -17,6 +17,7 @@
17
17
 
18
18
  #pragma once
19
19
 
20
+ #include "core/tls_context_provider.hxx"
20
21
  #include "core/utils/movable_function.hxx"
21
22
  #include "ip_protocol.hxx"
22
23
 
@@ -129,11 +130,11 @@ public:
129
130
  class tls_stream_impl : public stream_impl
130
131
  {
131
132
  private:
132
- asio::ssl::context& tls_;
133
+ tls_context_provider& tls_;
133
134
  std::shared_ptr<asio::ssl::stream<asio::ip::tcp::socket>> stream_;
134
135
 
135
136
  public:
136
- tls_stream_impl(asio::io_context& ctx, asio::ssl::context& tls);
137
+ tls_stream_impl(asio::io_context& ctx, tls_context_provider& tls);
137
138
 
138
139
  [[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override;
139
140
 
@@ -253,3 +253,18 @@
253
253
  * couchbase::vector_query has a prefilter option.
254
254
  */
255
255
  #define COUCHBASE_CXX_CLIENT_HAS_VECTOR_SEARCH_PREFILTER 1
256
+
257
+ /**
258
+ * couchbase::cluster has set_authenticator() method.
259
+ */
260
+ #define COUCHBASE_CXX_CLIENT_HAS_SET_AUTHENTICATOR 1
261
+
262
+ /**
263
+ * Support for the jwt_authenticator
264
+ */
265
+ #define COUCHBASE_CXX_CLIENT_HAS_JWT_AUTHENTICATOR 1
266
+
267
+ /**
268
+ * Support for the stable OpenTelemetry conventions (Observability RFC revisions 26 & 27)
269
+ */
270
+ #define COUCHBASE_CXX_CLIENT_STABLE_OTEL_CONVENTIONS 1
@@ -34,6 +34,9 @@
34
34
  #include <snappy-stubs-public.h>
35
35
  #include <spdlog/fmt/bundled/core.h>
36
36
  #include <spdlog/version.h>
37
+ #ifdef COUCHBASE_CXX_CLIENT_BUILD_OPENTELEMETRY
38
+ #include <opentelemetry/version.h>
39
+ #endif
37
40
 
38
41
  #include <regex>
39
42
 
@@ -168,10 +171,20 @@ sdk_build_info() -> std::map<std::string, std::string>
168
171
  #if defined(__GLIBC__)
169
172
  info["libc"] = fmt::format("glibc {}.{}", __GLIBC__, __GLIBC_MINOR__);
170
173
  #endif
174
+ #ifdef COUCHBASE_CXX_CLIENT_BUILD_OPENTELEMETRY
175
+ info["opentelemetry"] = OPENTELEMETRY_VERSION;
176
+ info["opentelemetry_abi"] = OPENTELEMETRY_ABI_VERSION;
177
+ #endif
171
178
 
172
179
  return info;
173
180
  }
174
181
 
182
+ auto
183
+ is_debug() -> bool
184
+ {
185
+ return COUCHBASE_CXX_CLIENT_DEBUG_BUILD;
186
+ }
187
+
175
188
  auto
176
189
  sdk_build_info_json() -> std::string
177
190
  {
@@ -64,4 +64,7 @@ user_agent_for_mcbp(const std::string& client_id,
64
64
  const std::string& session_id,
65
65
  const std::string& extra = "",
66
66
  std::size_t max_length = 0) -> std::string;
67
+
68
+ auto
69
+ is_debug() -> bool;
67
70
  } // namespace couchbase::core::meta
@@ -0,0 +1,23 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2025-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
+ namespace couchbase::core::metrics
21
+ {
22
+ constexpr auto operation_meter_name = "db.client.operation.duration";
23
+ } // namespace couchbase::core::metrics
@@ -19,7 +19,9 @@
19
19
 
20
20
  #include "couchbase/build_info.hxx"
21
21
 
22
+ #include "constants.hxx"
22
23
  #include "core/logger/logger.hxx"
24
+ #include "core/tracing/constants.hxx"
23
25
  #include "core/utils/json.hxx"
24
26
  #include "noop_meter.hxx"
25
27
 
@@ -209,18 +211,16 @@ logging_meter::get_value_recorder(const std::string& name,
209
211
  std::make_shared<noop_value_recorder>()
210
212
  };
211
213
 
212
- if (static const std::string meter_name = "db.couchbase.operations"; name != meter_name) {
214
+ if (name != operation_meter_name) {
213
215
  return noop_recorder;
214
216
  }
215
217
 
216
- static const std::string service_tag = "db.couchbase.service";
217
- const auto service = tags.find(service_tag);
218
+ const auto service = tags.find(tracing::attributes::op::service);
218
219
  if (service == tags.end()) {
219
220
  return noop_recorder;
220
221
  }
221
222
 
222
- static const std::string operation_tag = "db.operation";
223
- const auto operation = tags.find(operation_tag);
223
+ const auto operation = tags.find(tracing::attributes::op::operation_name);
224
224
  if (operation == tags.end()) {
225
225
  return noop_recorder;
226
226
  }
@@ -19,8 +19,14 @@
19
19
 
20
20
  #include <couchbase/error_codes.hxx>
21
21
 
22
- #include <mutex>
22
+ #include "core/metrics/constants.hxx"
23
+ #include "core/tracing/constants.hxx"
24
+
25
+ #include <map>
26
+ #include <memory>
27
+ #include <string>
23
28
  #include <system_error>
29
+ #include <utility>
24
30
 
25
31
  namespace couchbase::core::metrics
26
32
  {
@@ -57,32 +63,10 @@ extract_error_name(std::error_code ec) -> std::string
57
63
  }
58
64
 
59
65
  auto
60
- service_to_string(service_type s) -> std::string
61
- {
62
- switch (s) {
63
- case service_type::analytics:
64
- return "analytics";
65
- case service_type::search:
66
- return "search";
67
- case service_type::key_value:
68
- return "kv";
69
- case service_type::management:
70
- return "management";
71
- case service_type::eventing:
72
- return "eventing";
73
- case service_type::query:
74
- return "query";
75
- case service_type::view:
76
- return "views";
77
- }
78
- return {};
79
- }
80
-
81
- auto
82
- get_standardized_outcome(std::error_code ec) -> std::string
66
+ get_standardized_error_type(std::error_code ec) -> std::string
83
67
  {
84
68
  if (!ec) {
85
- return "Success";
69
+ return {};
86
70
  }
87
71
 
88
72
  // SDK-specific errors
@@ -95,39 +79,62 @@ get_standardized_outcome(std::error_code ec) -> std::string
95
79
  return "CryptoError";
96
80
  }
97
81
 
98
- return snake_case_to_camel_case(extract_error_name(ec));
82
+ static const std::array<const std::error_category*, 12> cb_categories = {
83
+ &impl::common_category(), &impl::key_value_category(),
84
+ &impl::query_category(), &impl::analytics_category(),
85
+ &impl::search_category(), &impl::view_category(),
86
+ &impl::management_category(), &impl::field_level_encryption_category(),
87
+ &impl::network_category(), &impl::streaming_json_lexer_category(),
88
+ &impl::transaction_category(), &impl::transaction_op_category(),
89
+ };
90
+
91
+ if (std::any_of(
92
+ cb_categories.begin(), cb_categories.end(), [&ec](const std::error_category* cat) -> bool {
93
+ return &ec.category() == cat;
94
+ })) {
95
+ return snake_case_to_camel_case(extract_error_name(ec));
96
+ }
97
+
98
+ return "_OTHER";
99
99
  }
100
100
  } // namespace
101
101
 
102
102
  auto
103
103
  metric_attributes::encode() const -> std::map<std::string, std::string>
104
104
  {
105
- std::map<std::string, std::string> tags = { { "db.couchbase.service",
106
- service_to_string(service) },
107
- { "db.operation", operation },
108
- { "outcome", get_standardized_outcome(ec) } };
105
+ std::map<std::string, std::string> tags = {
106
+ { tracing::attributes::reserved::target_unit, "s" },
107
+ { tracing::attributes::common::system, "couchbase" },
108
+ { tracing::attributes::op::service, service },
109
+ { tracing::attributes::op::operation_name, operation },
110
+ };
109
111
 
110
112
  if (internal.cluster_name.has_value()) {
111
- tags.emplace("db.couchbase.cluster_name", internal.cluster_name.value());
113
+ tags.emplace(tracing::attributes::common::cluster_name, internal.cluster_name.value());
112
114
  }
113
115
  if (internal.cluster_uuid.has_value()) {
114
- tags.emplace("db.couchbase.cluster_uuid", internal.cluster_uuid.value());
116
+ tags.emplace(tracing::attributes::common::cluster_uuid, internal.cluster_uuid.value());
115
117
  }
116
118
  if (bucket_name) {
117
- tags.emplace("db.name", bucket_name.value());
119
+ tags.emplace(tracing::attributes::op::bucket_name, bucket_name.value());
118
120
  }
119
121
  if (scope_name) {
120
- tags.emplace("db.couchbase.scope", scope_name.value());
122
+ tags.emplace(tracing::attributes::op::scope_name, scope_name.value());
121
123
  }
122
124
  if (collection_name) {
123
- tags.emplace("db.couchbase.collection", collection_name.value());
125
+ tags.emplace(tracing::attributes::op::collection_name, collection_name.value());
126
+ }
127
+ if (ec) {
128
+ tags.emplace(tracing::attributes::op::error_type, get_standardized_error_type(ec));
124
129
  }
125
130
 
126
131
  return tags;
127
132
  }
128
133
 
129
- meter_wrapper::meter_wrapper(std::shared_ptr<couchbase::metrics::meter> meter)
134
+ meter_wrapper::meter_wrapper(std::shared_ptr<couchbase::metrics::meter> meter,
135
+ std::shared_ptr<cluster_label_listener> label_listener)
130
136
  : meter_{ std::move(meter) }
137
+ , cluster_label_listener_{ std::move(label_listener) }
131
138
  {
132
139
  }
133
140
 
@@ -143,46 +150,41 @@ meter_wrapper::stop()
143
150
  meter_->stop();
144
151
  }
145
152
 
153
+ void
154
+ meter_wrapper::record_value(const std::map<std::string, std::string>& raw_attrs,
155
+ std::chrono::microseconds duration)
156
+ {
157
+ meter_->get_value_recorder(operation_meter_name, raw_attrs)->record_value(duration.count());
158
+ }
159
+
146
160
  void
147
161
  meter_wrapper::record_value(metric_attributes attrs,
148
162
  std::chrono::steady_clock::time_point start_time)
149
163
  {
150
- static const std::string meter_name{ "db.couchbase.operations" };
151
-
152
- {
153
- const std::shared_lock lock{ cluster_labels_mutex_ };
154
-
155
- if (cluster_name_) {
156
- attrs.internal.cluster_name = cluster_name_;
157
- }
158
- if (cluster_uuid_) {
159
- attrs.internal.cluster_uuid = cluster_uuid_;
160
- }
164
+ auto [cluster_name, cluster_uuid] = cluster_label_listener_->cluster_labels();
165
+ if (cluster_name) {
166
+ attrs.internal.cluster_name = cluster_name;
167
+ }
168
+ if (cluster_uuid) {
169
+ attrs.internal.cluster_uuid = cluster_uuid;
161
170
  }
162
171
 
163
- auto tags = attrs.encode();
164
- meter_->get_value_recorder(meter_name, tags)
165
- ->record_value(std::chrono::duration_cast<std::chrono::microseconds>(
166
- std::chrono::steady_clock::now() - start_time)
167
- .count());
172
+ record_value(attrs.encode(),
173
+ std::chrono::duration_cast<std::chrono::microseconds>(
174
+ std::chrono::steady_clock::now() - start_time));
168
175
  }
169
176
 
170
- void
171
- meter_wrapper::update_config(topology::configuration config)
177
+ auto
178
+ meter_wrapper::wrapped() -> std::shared_ptr<couchbase::metrics::meter>
172
179
  {
173
- const std::scoped_lock<std::shared_mutex> lock{ cluster_labels_mutex_ };
174
- if (config.cluster_uuid.has_value()) {
175
- cluster_uuid_ = config.cluster_uuid;
176
- }
177
- if (config.cluster_name.has_value()) {
178
- cluster_name_ = config.cluster_name;
179
- }
180
+ return meter_;
180
181
  }
181
182
 
182
183
  auto
183
- meter_wrapper::create(std::shared_ptr<couchbase::metrics::meter> meter)
184
+ meter_wrapper::create(std::shared_ptr<couchbase::metrics::meter> meter,
185
+ std::shared_ptr<cluster_label_listener> label_listener)
184
186
  -> std::shared_ptr<meter_wrapper>
185
187
  {
186
- return std::make_shared<meter_wrapper>(std::move(meter));
188
+ return std::make_shared<meter_wrapper>(std::move(meter), std::move(label_listener));
187
189
  }
188
190
  } // namespace couchbase::core::metrics
@@ -26,14 +26,15 @@
26
26
  #include <chrono>
27
27
  #include <map>
28
28
  #include <optional>
29
- #include <shared_mutex>
30
29
  #include <string>
31
30
  #include <system_error>
32
31
 
32
+ #include "core/cluster_label_listener.hxx"
33
+
33
34
  namespace couchbase::core::metrics
34
35
  {
35
36
  struct metric_attributes {
36
- couchbase::core::service_type service;
37
+ std::string service;
37
38
  std::string operation;
38
39
  std::error_code ec;
39
40
  std::optional<std::string> bucket_name{};
@@ -48,26 +49,27 @@ struct metric_attributes {
48
49
  [[nodiscard]] auto encode() const -> std::map<std::string, std::string>;
49
50
  };
50
51
 
51
- class meter_wrapper : public config_listener
52
+ class meter_wrapper
52
53
  {
53
54
  public:
54
- explicit meter_wrapper(std::shared_ptr<couchbase::metrics::meter> meter);
55
+ explicit meter_wrapper(std::shared_ptr<couchbase::metrics::meter> meter,
56
+ std::shared_ptr<cluster_label_listener> label_listener);
55
57
 
56
58
  void start();
57
59
  void stop();
58
60
 
59
61
  void record_value(metric_attributes attrs, std::chrono::steady_clock::time_point start_time);
62
+ void record_value(const std::map<std::string, std::string>& raw_attrs,
63
+ std::chrono::microseconds duration);
60
64
 
61
- void update_config(topology::configuration config) override;
65
+ [[nodiscard]] auto wrapped() -> std::shared_ptr<couchbase::metrics::meter>;
62
66
 
63
- [[nodiscard]] static auto create(std::shared_ptr<couchbase::metrics::meter> meter)
67
+ [[nodiscard]] static auto create(std::shared_ptr<couchbase::metrics::meter> meter,
68
+ std::shared_ptr<cluster_label_listener> label_listener)
64
69
  -> std::shared_ptr<meter_wrapper>;
65
70
 
66
71
  private:
67
72
  std::shared_ptr<couchbase::metrics::meter> meter_;
68
-
69
- std::optional<std::string> cluster_name_{};
70
- std::optional<std::string> cluster_uuid_{};
71
- std::shared_mutex cluster_labels_mutex_{};
73
+ std::shared_ptr<cluster_label_listener> cluster_label_listener_;
72
74
  };
73
75
  } // namespace couchbase::core::metrics
@@ -114,11 +114,6 @@ struct analytics_request {
114
114
  } // namespace couchbase::core::operations
115
115
  namespace couchbase::core::io::http_traits
116
116
  {
117
- template<>
118
- struct supports_parent_span<couchbase::core::operations::analytics_request>
119
- : public std::true_type {
120
- };
121
-
122
117
  template<>
123
118
  struct supports_readonly<couchbase::core::operations::analytics_request> : public std::true_type {
124
119
  };
@@ -76,8 +76,4 @@ namespace couchbase::core::io::mcbp_traits
76
76
  template<>
77
77
  struct supports_durability<couchbase::core::operations::append_request> : public std::true_type {
78
78
  };
79
-
80
- template<>
81
- struct supports_parent_span<couchbase::core::operations::append_request> : public std::true_type {
82
- };
83
79
  } // namespace couchbase::core::io::mcbp_traits
@@ -79,9 +79,4 @@ namespace couchbase::core::io::mcbp_traits
79
79
  template<>
80
80
  struct supports_durability<couchbase::core::operations::decrement_request> : public std::true_type {
81
81
  };
82
-
83
- template<>
84
- struct supports_parent_span<couchbase::core::operations::decrement_request>
85
- : public std::true_type {
86
- };
87
82
  } // namespace couchbase::core::io::mcbp_traits
@@ -67,10 +67,3 @@ struct exists_request {
67
67
  };
68
68
 
69
69
  } // namespace couchbase::core::operations
70
-
71
- namespace couchbase::core::io::mcbp_traits
72
- {
73
- template<>
74
- struct supports_parent_span<couchbase::core::operations::exists_request> : public std::true_type {
75
- };
76
- } // namespace couchbase::core::io::mcbp_traits
@@ -57,10 +57,3 @@ struct get_request {
57
57
  const encoded_response_type& encoded) const -> get_response;
58
58
  };
59
59
  } // namespace couchbase::core::operations
60
-
61
- namespace couchbase::core::io::mcbp_traits
62
- {
63
- template<>
64
- struct supports_parent_span<couchbase::core::operations::get_request> : public std::true_type {
65
- };
66
- } // namespace couchbase::core::io::mcbp_traits