couchbase 4.4.3 → 4.4.4

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 (166) hide show
  1. package/BUILDING.md +182 -0
  2. package/CMakeLists.txt +11 -0
  3. package/CONTRIBUTING.md +1 -1
  4. package/README.md +4 -2
  5. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/BUILDING.md +206 -0
  6. package/deps/couchbase-cxx-client/CMakeLists.txt +3 -1
  7. package/deps/couchbase-cxx-client/README.md +2 -2
  8. package/deps/couchbase-cxx-client/cmake/APKBUILD.in +54 -0
  9. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +0 -5
  10. package/deps/couchbase-cxx-client/cmake/Packaging.cmake +174 -11
  11. package/deps/couchbase-cxx-client/cmake/RPath.cmake +10 -0
  12. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +4 -0
  13. package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
  14. package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +2 -2
  15. package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +2 -2
  16. package/deps/couchbase-cxx-client/cmake/debian/changelog.in +5 -0
  17. package/deps/couchbase-cxx-client/cmake/debian/compat +1 -0
  18. package/deps/couchbase-cxx-client/cmake/debian/control +40 -0
  19. package/deps/couchbase-cxx-client/cmake/debian/rules +41 -0
  20. package/deps/couchbase-cxx-client/cmake/debian/source/format +1 -0
  21. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
  22. package/deps/couchbase-cxx-client/core/impl/collection.cxx +27 -3
  23. package/deps/couchbase-cxx-client/core/impl/error.cxx +24 -3
  24. package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
  25. package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +2 -0
  26. package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
  27. package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
  28. package/deps/couchbase-cxx-client/core/impl/search.cxx +2 -0
  29. package/deps/couchbase-cxx-client/core/io/http_command.hxx +2 -2
  30. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +1 -1
  31. package/deps/couchbase-cxx-client/core/meta/features.hxx +11 -0
  32. package/deps/couchbase-cxx-client/core/meta/version.cxx +47 -6
  33. package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +23 -17
  34. package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +1 -0
  35. package/deps/couchbase-cxx-client/core/operations/document_append.hxx +2 -0
  36. package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +2 -0
  37. package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +2 -0
  38. package/deps/couchbase-cxx-client/core/operations/document_get.hxx +2 -0
  39. package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +2 -0
  40. package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +2 -0
  41. package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +2 -0
  42. package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +2 -0
  43. package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +2 -0
  44. package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +2 -0
  45. package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +2 -0
  46. package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +2 -0
  47. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +2 -0
  48. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +2 -0
  49. package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +2 -0
  50. package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +2 -0
  51. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
  52. package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +2 -0
  53. package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +2 -0
  54. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -0
  55. package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +2 -0
  56. package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +2 -0
  57. package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +2 -0
  58. package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
  59. package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
  60. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +1 -0
  61. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +1 -0
  62. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +1 -0
  63. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +1 -0
  64. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +1 -0
  65. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
  66. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +1 -0
  67. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +1 -0
  68. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +1 -0
  69. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +1 -0
  70. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +1 -0
  71. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +1 -0
  72. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +1 -0
  73. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +23 -15
  74. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +4 -3
  75. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +1 -0
  76. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +1 -0
  77. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +1 -0
  78. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +1 -0
  79. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +1 -0
  80. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +1 -0
  81. package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +1 -0
  82. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +1 -0
  83. package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +1 -0
  84. package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +1 -0
  85. package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +1 -0
  86. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
  87. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +1 -0
  88. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
  89. package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
  90. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +3 -2
  91. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +3 -2
  92. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +3 -2
  93. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +3 -2
  94. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +3 -2
  95. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +3 -2
  96. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +3 -2
  97. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +3 -2
  98. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +3 -2
  99. package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
  100. package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +1 -0
  101. package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +1 -0
  102. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +1 -0
  103. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +1 -0
  104. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
  105. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +3 -0
  106. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -0
  107. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +1 -0
  108. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +2 -0
  109. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -0
  110. package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +1 -0
  111. package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +1 -0
  112. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +1 -0
  113. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +1 -0
  114. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +1 -0
  115. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +1 -0
  116. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +1 -0
  117. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +1 -0
  118. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +1 -0
  119. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +1 -0
  120. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +1 -0
  121. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +1 -0
  122. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
  123. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +1 -0
  124. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +1 -0
  125. package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +1 -0
  126. package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +1 -0
  127. package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +1 -0
  128. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +3 -3
  129. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +1 -0
  130. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +1 -0
  131. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +1 -0
  132. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
  133. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +1 -0
  134. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +9 -21
  135. package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +6 -33
  136. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +41 -41
  137. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +15 -16
  138. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +2 -2
  139. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +0 -20
  140. package/deps/couchbase-cxx-client/couchbase/common_options.hxx +16 -1
  141. package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +16 -20
  142. package/dist/analyticsindexmanager.d.ts +98 -14
  143. package/dist/analyticsindexmanager.js +452 -411
  144. package/dist/binding.d.ts +53 -4
  145. package/dist/bindingutilities.d.ts +26 -1
  146. package/dist/bindingutilities.js +108 -1
  147. package/dist/couchbase.d.ts +3 -1
  148. package/dist/couchbase.js +2 -0
  149. package/dist/rangeScan.d.ts +1 -1
  150. package/dist/rangeScan.js +1 -1
  151. package/dist/transactions.d.ts +34 -3
  152. package/dist/transactions.js +25 -18
  153. package/dist/transcoders.d.ts +68 -0
  154. package/dist/transcoders.js +194 -1
  155. package/dist/usermanager.d.ts +14 -14
  156. package/dist/usermanager.js +178 -228
  157. package/dist/utilities.js +4 -6
  158. package/dist/utilities_internal.js +1 -2
  159. package/package.json +9 -8
  160. package/src/connection.cpp +22 -0
  161. package/src/connection.hpp +12 -0
  162. package/src/connection_autogen.cpp +100 -0
  163. package/src/jstocbpp_autogen.hpp +315 -8
  164. package/src/jstocbpp_transactions.hpp +1 -2
  165. package/tools/gen-bindings-js.js +38 -3
  166. package/tools/gen-bindings-json.py +575 -328
@@ -41,6 +41,8 @@ struct get_replica_request {
41
41
  using encoded_response_type =
42
42
  core::protocol::client_response<core::protocol::get_replica_response_body>;
43
43
 
44
+ static const inline std::string observability_identifier = "get_replica";
45
+
44
46
  core::document_id id;
45
47
  std::optional<std::chrono::milliseconds> timeout{};
46
48
  std::uint16_t partition{};
@@ -53,6 +53,8 @@ struct lookup_in_replica_request {
53
53
  using encoded_response_type =
54
54
  protocol::client_response<protocol::lookup_in_replica_response_body>;
55
55
 
56
+ static const inline std::string observability_identifier = "lookup_in_replica";
57
+
56
58
  document_id id;
57
59
  std::vector<couchbase::core::impl::subdoc::command> specs{};
58
60
  std::optional<std::chrono::milliseconds> timeout{};
@@ -50,6 +50,8 @@ struct observe_seqno_request {
50
50
  using encoded_response_type =
51
51
  core::protocol::client_response<core::protocol::observe_seqno_response_body>;
52
52
 
53
+ static const inline std::string observability_identifier = "observe_seqno";
54
+
53
55
  core::document_id id;
54
56
  bool active{};
55
57
  std::uint64_t partition_uuid{};
@@ -180,6 +180,7 @@ build_query_request(std::string statement,
180
180
  std::move(query_context), std::move(options.client_context_id),
181
181
  options.timeout, options.profile,
182
182
  };
183
+ request.parent_span = options.parent_span;
183
184
  if (!options.raw.empty()) {
184
185
  for (auto& [name, value] : options.raw) {
185
186
  request.raw[name] = std::move(value);
@@ -165,6 +165,7 @@ build_search_request(std::string index_name,
165
165
  options.client_context_id,
166
166
  options.timeout,
167
167
  };
168
+ request.parent_span = options.parent_span;
168
169
  return request;
169
170
  }
170
171
 
@@ -207,6 +208,7 @@ build_search_request(std::string index_name,
207
208
  options.client_context_id,
208
209
  options.timeout,
209
210
  };
211
+ core_request.parent_span = options.parent_span;
210
212
 
211
213
  if (auto vector_search = request.vector_search(); vector_search.has_value()) {
212
214
  core_request.vector_search = core::utils::json::generate_binary(vector_search->query);
@@ -246,8 +246,8 @@ private:
246
246
  }
247
247
  if (self->meter_) {
248
248
  metrics::metric_attributes attrs{
249
- service_type::key_value,
250
- fmt::format("{}", self->encoded.path),
249
+ self->request.type,
250
+ self->request.observability_identifier,
251
251
  ec,
252
252
  };
253
253
  self->meter_->record_value(std::move(attrs), start);
@@ -269,7 +269,7 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
269
269
  std::optional<key_value_error_map_info> /* error_info */) mutable {
270
270
  metrics::metric_attributes attrs{
271
271
  service_type::key_value,
272
- fmt::format("{}", encoded_request_type::body_type::opcode),
272
+ self->request.observability_identifier,
273
273
  ec,
274
274
  self->request.id.bucket(),
275
275
  self->request.id.scope(),
@@ -195,3 +195,14 @@
195
195
  * encode document content or decode results.
196
196
  */
197
197
  #define COUCHBASE_CXX_CLIENT_PUBLIC_API_USES_TAO_JSON_ONLY_FOR_CONTENT
198
+
199
+ /**
200
+ * couchbase::metrics::otel_meter uses the GA version of the OpenTelemetry Metrics API.
201
+ * The Metrics API for OpenTelemetry was GA'd in version 1.7.0.
202
+ */
203
+ #define COUCHBASE_CXX_CLIENT_OTEL_METER_USES_GA_METRICS_API 1
204
+
205
+ /**
206
+ * All options classes in the Public API expose the parent_span option.
207
+ */
208
+ #define COUCHBASE_CXX_CLIENT_PUBLIC_API_PARENT_SPAN 1
@@ -316,6 +316,28 @@ os() -> const std::string&
316
316
  return system;
317
317
  }
318
318
 
319
+ namespace
320
+ {
321
+ constexpr auto
322
+ has_wrapper_sdk_id() -> bool
323
+ {
324
+ return COUCHBASE_CXX_CLIENT_WRAPPER_UNIFIED_ID != nullptr &&
325
+ COUCHBASE_CXX_CLIENT_WRAPPER_UNIFIED_ID[0] != '\0';
326
+ }
327
+
328
+ auto
329
+ wrapper_sdk_id() -> std::string
330
+ {
331
+ return COUCHBASE_CXX_CLIENT_WRAPPER_UNIFIED_ID;
332
+ }
333
+
334
+ auto
335
+ cxx_sdk_id() -> std::string
336
+ {
337
+ return fmt::format("cxx/{}", sdk_semver());
338
+ }
339
+ } // namespace
340
+
319
341
  constexpr const char* ssl_lib_id =
320
342
  #if defined(COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL)
321
343
  "bssl"
@@ -329,16 +351,24 @@ user_agent_for_http(const std::string& client_id,
329
351
  const std::string& session_id,
330
352
  const std::string& extra) -> std::string
331
353
  {
332
- auto user_agent = fmt::format("{};{}/0x{:x};client/{};session/{};{}",
333
- couchbase::core::meta::sdk_id(),
354
+ std::string user_agent{ has_wrapper_sdk_id() ? wrapper_sdk_id() : cxx_sdk_id() };
355
+ user_agent.append(" (");
356
+ if (has_wrapper_sdk_id()) {
357
+ user_agent.append(cxx_sdk_id()).append(";");
358
+ }
359
+
360
+ user_agent.append(fmt::format("{}/{};{}/0x{:x};client/{};session/{};{}",
361
+ COUCHBASE_CXX_CLIENT_SYSTEM_NAME,
362
+ COUCHBASE_CXX_CLIENT_SYSTEM_PROCESSOR,
334
363
  ssl_lib_id,
335
364
  OpenSSL_version_num(),
336
365
  client_id,
337
366
  session_id,
338
- couchbase::core::meta::os());
367
+ couchbase::core::meta::os()));
339
368
  if (!extra.empty()) {
340
369
  user_agent.append(";").append(extra);
341
370
  }
371
+ user_agent.append(")");
342
372
  for (auto& ch : user_agent) {
343
373
  if (ch == '\n' || ch == '\r') {
344
374
  ch = ' ';
@@ -356,12 +386,22 @@ user_agent_for_mcbp(const std::string& client_id,
356
386
  tao::json::value user_agent{
357
387
  { "i", fmt::format("{}/{}", client_id, session_id) },
358
388
  };
359
- const std::string core_id =
360
- fmt::format("{};{}/0x{:x}", couchbase::core::meta::sdk_id(), ssl_lib_id, OpenSSL_version_num());
389
+ std::string core_id{ has_wrapper_sdk_id() ? wrapper_sdk_id() : cxx_sdk_id() };
390
+ core_id.append(" (");
391
+ if (has_wrapper_sdk_id()) {
392
+ core_id.append(cxx_sdk_id()).append(";");
393
+ }
394
+ core_id.append(fmt::format("{}/{};{}/0x{:x}",
395
+ COUCHBASE_CXX_CLIENT_SYSTEM_NAME,
396
+ COUCHBASE_CXX_CLIENT_SYSTEM_PROCESSOR,
397
+ ssl_lib_id,
398
+ OpenSSL_version_num()));
361
399
  std::string sdk_id = core_id;
400
+ core_id.append(")");
362
401
  if (!extra.empty()) {
363
402
  sdk_id.append(";").append(extra);
364
403
  }
404
+ sdk_id.append(")");
365
405
  if (max_length > 0) {
366
406
  auto current_length = utils::json::generate(user_agent).size();
367
407
  auto allowed_length = max_length - current_length;
@@ -373,7 +413,8 @@ user_agent_for_mcbp(const std::string& client_id,
373
413
  /* user-provided string is too weird, lets just fall back to just core */
374
414
  sdk_id = core_id;
375
415
  } else {
376
- sdk_id.erase(allowed_length - escaped_characters);
416
+ sdk_id.erase(allowed_length - escaped_characters - 1);
417
+ sdk_id.append(")");
377
418
  }
378
419
  }
379
420
  }
@@ -116,12 +116,16 @@ analytics_request::make_response(error_context::analytics&& ctx,
116
116
  response.ctx.ec = errc::common::parsing_failure;
117
117
  return response;
118
118
  }
119
- response.meta.request_id = payload.at("requestID").get_string();
120
- response.meta.client_context_id = payload.at("clientContextID").get_string();
121
- if (response.ctx.client_context_id != response.meta.client_context_id) {
122
- CB_LOG_WARNING(R"(unexpected clientContextID returned by service: "{}", expected "{}")",
123
- response.meta.client_context_id,
124
- response.ctx.client_context_id);
119
+ if (const auto* i = payload.find("requestID"); i != nullptr) {
120
+ response.meta.request_id = i->get_string();
121
+ }
122
+ if (const auto* i = payload.find("clientContextID"); i != nullptr) {
123
+ response.meta.client_context_id = i->get_string();
124
+ if (response.ctx.client_context_id != response.meta.client_context_id) {
125
+ CB_LOG_WARNING(R"(unexpected clientContextID returned by service: "{}", expected "{}")",
126
+ response.meta.client_context_id,
127
+ response.ctx.client_context_id);
128
+ }
125
129
  }
126
130
  if (auto& status_prop = payload.at("status"); status_prop.is_string()) {
127
131
  const auto& status = status_prop.get_string();
@@ -154,17 +158,19 @@ analytics_request::make_response(error_context::analytics&& ctx,
154
158
  response.meta.signature = couchbase::core::utils::json::generate(*s);
155
159
  }
156
160
 
157
- const tao::json::value& metrics = payload.at("metrics");
158
- response.meta.metrics.result_count = metrics.at("resultCount").get_unsigned();
159
- response.meta.metrics.result_size = metrics.at("resultSize").get_unsigned();
160
- response.meta.metrics.elapsed_time =
161
- utils::parse_duration(metrics.at("elapsedTime").get_string());
162
- response.meta.metrics.execution_time =
163
- utils::parse_duration(metrics.at("executionTime").get_string());
164
- response.meta.metrics.processed_objects = metrics.at("processedObjects").get_unsigned();
165
- response.meta.metrics.error_count = metrics.optional<std::uint64_t>("errorCount").value_or(0);
166
- response.meta.metrics.warning_count =
167
- metrics.optional<std::uint64_t>("warningCount").value_or(0);
161
+ if (const auto* metrics = payload.find("metrics"); metrics != nullptr) {
162
+ response.meta.metrics.result_count = metrics->at("resultCount").get_unsigned();
163
+ response.meta.metrics.result_size = metrics->at("resultSize").get_unsigned();
164
+ response.meta.metrics.elapsed_time =
165
+ utils::parse_duration(metrics->at("elapsedTime").get_string());
166
+ response.meta.metrics.execution_time =
167
+ utils::parse_duration(metrics->at("executionTime").get_string());
168
+ response.meta.metrics.processed_objects = metrics->at("processedObjects").get_unsigned();
169
+ response.meta.metrics.error_count =
170
+ metrics->optional<std::uint64_t>("errorCount").value_or(0);
171
+ response.meta.metrics.warning_count =
172
+ metrics->optional<std::uint64_t>("warningCount").value_or(0);
173
+ }
168
174
 
169
175
  if (const auto* e = payload.find("errors"); e != nullptr) {
170
176
  for (const auto& err : e->get_array()) {
@@ -80,6 +80,7 @@ struct analytics_request {
80
80
  using error_context_type = error_context::analytics;
81
81
 
82
82
  static const inline service_type type = service_type::analytics;
83
+ static const inline std::string observability_identifier = "analytics";
83
84
 
84
85
  std::string statement;
85
86
 
@@ -44,6 +44,8 @@ struct append_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::append_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::append_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "append";
48
+
47
49
  document_id id;
48
50
  std::vector<std::byte> value;
49
51
  std::uint16_t partition{};
@@ -45,6 +45,8 @@ struct decrement_request {
45
45
  using encoded_request_type = protocol::client_request<protocol::decrement_request_body>;
46
46
  using encoded_response_type = protocol::client_response<protocol::decrement_response_body>;
47
47
 
48
+ static const inline std::string observability_identifier = "decrement";
49
+
48
50
  document_id id;
49
51
  std::uint16_t partition{};
50
52
  std::uint32_t opaque{};
@@ -50,6 +50,8 @@ struct exists_request {
50
50
  using encoded_request_type = protocol::client_request<protocol::get_meta_request_body>;
51
51
  using encoded_response_type = protocol::client_response<protocol::get_meta_response_body>;
52
52
 
53
+ static const inline std::string observability_identifier = "exists";
54
+
53
55
  document_id id;
54
56
  std::uint16_t partition{};
55
57
  std::uint32_t opaque{};
@@ -41,6 +41,8 @@ struct get_request {
41
41
  using encoded_request_type = protocol::client_request<protocol::get_request_body>;
42
42
  using encoded_response_type = protocol::client_response<protocol::get_response_body>;
43
43
 
44
+ static const inline std::string observability_identifier = "get";
45
+
44
46
  document_id id;
45
47
  std::uint16_t partition{};
46
48
  std::uint32_t opaque{};
@@ -50,6 +50,8 @@ struct get_all_replicas_request {
50
50
  using encoded_response_type =
51
51
  core::protocol::client_response<core::protocol::get_replica_response_body>;
52
52
 
53
+ static const inline std::string observability_identifier = "get_all_replicas";
54
+
53
55
  core::document_id id;
54
56
  std::optional<std::chrono::milliseconds> timeout{};
55
57
  couchbase::read_preference read_preference{ couchbase::read_preference::no_preference };
@@ -41,6 +41,8 @@ struct get_and_lock_request {
41
41
  using encoded_request_type = protocol::client_request<protocol::get_and_lock_request_body>;
42
42
  using encoded_response_type = protocol::client_response<protocol::get_and_lock_response_body>;
43
43
 
44
+ static const inline std::string observability_identifier = "get_and_lock";
45
+
44
46
  document_id id;
45
47
  std::uint16_t partition{};
46
48
  std::uint32_t opaque{};
@@ -42,6 +42,8 @@ struct get_and_touch_request {
42
42
  using encoded_request_type = protocol::client_request<protocol::get_and_touch_request_body>;
43
43
  using encoded_response_type = protocol::client_response<protocol::get_and_touch_response_body>;
44
44
 
45
+ static const inline std::string observability_identifier = "get_and_touch";
46
+
45
47
  document_id id;
46
48
  std::uint16_t partition{};
47
49
  std::uint32_t opaque{};
@@ -46,6 +46,8 @@ struct get_any_replica_request {
46
46
  using encoded_response_type =
47
47
  core::protocol::client_response<core::protocol::get_replica_response_body>;
48
48
 
49
+ static const inline std::string observability_identifier = "get_any_replica";
50
+
49
51
  core::document_id id;
50
52
  std::optional<std::chrono::milliseconds> timeout{};
51
53
  couchbase::read_preference read_preference{ couchbase::read_preference::no_preference };
@@ -42,6 +42,8 @@ struct get_projected_request {
42
42
  using encoded_request_type = protocol::client_request<protocol::lookup_in_request_body>;
43
43
  using encoded_response_type = protocol::client_response<protocol::lookup_in_response_body>;
44
44
 
45
+ static const inline std::string observability_identifier = "get";
46
+
45
47
  document_id id;
46
48
  std::uint16_t partition{};
47
49
  std::uint32_t opaque{};
@@ -45,6 +45,8 @@ struct increment_request {
45
45
  using encoded_request_type = protocol::client_request<protocol::increment_request_body>;
46
46
  using encoded_response_type = protocol::client_response<protocol::increment_response_body>;
47
47
 
48
+ static const inline std::string observability_identifier = "increment";
49
+
48
50
  document_id id;
49
51
  std::uint16_t partition{};
50
52
  std::uint32_t opaque{};
@@ -44,6 +44,8 @@ struct insert_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::insert_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::insert_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "insert";
48
+
47
49
  document_id id;
48
50
  std::vector<std::byte> value;
49
51
  std::uint16_t partition{};
@@ -54,6 +54,8 @@ struct lookup_in_request {
54
54
  using encoded_request_type = protocol::client_request<protocol::lookup_in_request_body>;
55
55
  using encoded_response_type = protocol::client_response<protocol::lookup_in_response_body>;
56
56
 
57
+ static const inline std::string observability_identifier = "lookup_in";
58
+
57
59
  document_id id;
58
60
  std::uint16_t partition{};
59
61
  std::uint32_t opaque{};
@@ -61,6 +61,8 @@ struct lookup_in_all_replicas_request {
61
61
  using encoded_response_type =
62
62
  core::protocol::client_response<core::protocol::lookup_in_replica_response_body>;
63
63
 
64
+ static const inline std::string observability_identifier = "lookup_in_all_replicas";
65
+
64
66
  core::document_id id;
65
67
  std::vector<couchbase::core::impl::subdoc::command> specs{};
66
68
  std::optional<std::chrono::milliseconds> timeout{};
@@ -59,6 +59,8 @@ struct lookup_in_any_replica_request {
59
59
  using encoded_response_type =
60
60
  core::protocol::client_response<core::protocol::lookup_in_replica_response_body>;
61
61
 
62
+ static const inline std::string observability_identifier = "lookup_in_any_replica";
63
+
62
64
  core::document_id id;
63
65
  std::vector<couchbase::core::impl::subdoc::command> specs{};
64
66
  std::optional<std::chrono::milliseconds> timeout{};
@@ -55,6 +55,8 @@ struct mutate_in_request {
55
55
  using encoded_request_type = protocol::client_request<protocol::mutate_in_request_body>;
56
56
  using encoded_response_type = protocol::client_response<protocol::mutate_in_response_body>;
57
57
 
58
+ static const inline std::string observability_identifier = "mutate_in";
59
+
58
60
  document_id id;
59
61
  std::uint16_t partition{};
60
62
  std::uint32_t opaque{};
@@ -44,6 +44,8 @@ struct prepend_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::prepend_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::prepend_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "prepend";
48
+
47
49
  document_id id;
48
50
  std::vector<std::byte> value;
49
51
  std::uint16_t partition{};
@@ -80,6 +80,7 @@ struct query_request {
80
80
  using error_context_type = error_context::query;
81
81
 
82
82
  static const inline service_type type = service_type::query;
83
+ static const inline std::string observability_identifier = "query";
83
84
 
84
85
  std::string statement;
85
86
 
@@ -44,6 +44,8 @@ struct remove_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::remove_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::remove_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "remove";
48
+
47
49
  document_id id;
48
50
  std::uint16_t partition{};
49
51
  std::uint32_t opaque{};
@@ -44,6 +44,8 @@ struct replace_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::replace_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::replace_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "replace";
48
+
47
49
  document_id id;
48
50
  std::vector<std::byte> value;
49
51
  std::uint16_t partition{};
@@ -116,6 +116,7 @@ struct search_request {
116
116
  using error_context_type = error_context::search;
117
117
 
118
118
  static const inline service_type type = service_type::search;
119
+ static const inline std::string observability_identifier = "search";
119
120
 
120
121
  std::string index_name;
121
122
  couchbase::core::json_string query;
@@ -39,6 +39,8 @@ struct touch_request {
39
39
  using encoded_request_type = protocol::client_request<protocol::touch_request_body>;
40
40
  using encoded_response_type = protocol::client_response<protocol::touch_response_body>;
41
41
 
42
+ static const inline std::string observability_identifier = "touch";
43
+
42
44
  document_id id;
43
45
  std::uint16_t partition{};
44
46
  std::uint32_t opaque{};
@@ -39,6 +39,8 @@ struct unlock_request {
39
39
  using encoded_request_type = protocol::client_request<protocol::unlock_request_body>;
40
40
  using encoded_response_type = protocol::client_response<protocol::unlock_response_body>;
41
41
 
42
+ static const inline std::string observability_identifier = "unlock";
43
+
42
44
  document_id id;
43
45
  std::uint16_t partition{};
44
46
  std::uint32_t opaque{};
@@ -44,6 +44,8 @@ struct upsert_request {
44
44
  using encoded_request_type = protocol::client_request<protocol::upsert_request_body>;
45
45
  using encoded_response_type = protocol::client_response<protocol::upsert_response_body>;
46
46
 
47
+ static const inline std::string observability_identifier = "upsert";
48
+
47
49
  document_id id;
48
50
  std::vector<std::byte> value;
49
51
  std::uint16_t partition{};
@@ -61,6 +61,7 @@ struct document_view_request {
61
61
  using error_context_type = error_context::view;
62
62
 
63
63
  static const inline service_type type = service_type::view;
64
+ static const inline std::string observability_identifier = "views";
64
65
 
65
66
  std::string bucket_name;
66
67
  std::string document_name;
@@ -35,6 +35,8 @@ struct http_noop_request {
35
35
  using encoded_response_type = io::http_response;
36
36
  using error_context_type = error_context::http;
37
37
 
38
+ static const inline std::string observability_identifier = "noop";
39
+
38
40
  service_type type{};
39
41
 
40
42
  std::optional<std::string> client_context_id{};
@@ -39,6 +39,7 @@ struct analytics_dataset_create_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_create_dataset";
42
43
 
43
44
  std::string dataverse_name{ "Default" };
44
45
  std::string dataset_name;
@@ -39,6 +39,7 @@ struct analytics_dataset_drop_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_drop_dataset";
42
43
 
43
44
  std::string dataverse_name{ "Default" };
44
45
  std::string dataset_name;
@@ -41,6 +41,7 @@ struct analytics_dataset_get_all_request {
41
41
  using error_context_type = error_context::http;
42
42
 
43
43
  static const inline service_type type = service_type::analytics;
44
+ static const inline std::string observability_identifier = "manager_analytics_get_all_datasets";
44
45
 
45
46
  std::optional<std::string> client_context_id{};
46
47
  std::optional<std::chrono::milliseconds> timeout{};
@@ -39,6 +39,7 @@ struct analytics_dataverse_create_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_create_dataverse";
42
43
 
43
44
  std::string dataverse_name;
44
45
 
@@ -39,6 +39,7 @@ struct analytics_dataverse_drop_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_drop_dataverse";
42
43
 
43
44
  std::string dataverse_name;
44
45
 
@@ -40,6 +40,8 @@ struct analytics_get_pending_mutations_request {
40
40
  using error_context_type = error_context::http;
41
41
 
42
42
  static const inline service_type type = service_type::analytics;
43
+ static const inline std::string observability_identifier =
44
+ "manager_analytics_get_pending_mutations";
43
45
 
44
46
  std::optional<std::string> client_context_id{};
45
47
  std::optional<std::chrono::milliseconds> timeout{};
@@ -39,6 +39,7 @@ struct analytics_index_create_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_create_index";
42
43
 
43
44
  std::string dataverse_name{ "Default" };
44
45
  std::string dataset_name;
@@ -39,6 +39,7 @@ struct analytics_index_drop_request {
39
39
  using error_context_type = error_context::http;
40
40
 
41
41
  static const inline service_type type = service_type::analytics;
42
+ static const inline std::string observability_identifier = "manager_analytics_drop_index";
42
43
 
43
44
  std::string dataverse_name{ "Default" };
44
45
  std::string dataset_name;
@@ -41,6 +41,7 @@ struct analytics_index_get_all_request {
41
41
  using error_context_type = error_context::http;
42
42
 
43
43
  static const inline service_type type = service_type::analytics;
44
+ static const inline std::string observability_identifier = "manager_analytics_get_all_indexes";
44
45
 
45
46
  std::optional<std::string> client_context_id{};
46
47
  std::optional<std::chrono::milliseconds> timeout{};
@@ -43,6 +43,7 @@ struct analytics_link_connect_request {
43
43
  using error_context_type = error_context::http;
44
44
 
45
45
  static const inline service_type type = service_type::analytics;
46
+ static const inline std::string observability_identifier = "manager_analytics_connect_link";
46
47
 
47
48
  std::string dataverse_name{ "Default" };
48
49
  std::string link_name{ "Local" };
@@ -51,6 +51,7 @@ struct analytics_link_create_request {
51
51
  using error_context_type = error_context::http;
52
52
 
53
53
  static const inline service_type type = service_type::analytics;
54
+ static const inline std::string observability_identifier = "manager_analytics_create_link";
54
55
 
55
56
  analytics_link_type link{};
56
57
  std::optional<std::string> client_context_id{};
@@ -43,6 +43,7 @@ struct analytics_link_disconnect_request {
43
43
  using error_context_type = error_context::http;
44
44
 
45
45
  static const inline service_type type = service_type::analytics;
46
+ static const inline std::string observability_identifier = "manager_analytics_disconnect_link";
46
47
 
47
48
  std::string dataverse_name{ "Default" };
48
49
  std::string link_name{ "Local" };
@@ -43,6 +43,7 @@ struct analytics_link_drop_request {
43
43
  using error_context_type = error_context::http;
44
44
 
45
45
  static const inline service_type type = service_type::analytics;
46
+ static const inline std::string observability_identifier = "manager_analytics_drop_link";
46
47
 
47
48
  std::string link_name{};
48
49
  std::string dataverse_name{};