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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/ext/CMakeLists.txt +4 -1
- data/ext/cache/extconf_include.rb +4 -3
- data/ext/cache/mozilla-ca-bundle.crt +66 -93
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +24 -11
- data/ext/couchbase/cmake/APKBUILD.in +17 -1
- data/ext/couchbase/cmake/Bundler.cmake +9 -1
- data/ext/couchbase/cmake/Cache.cmake +48 -19
- data/ext/couchbase/cmake/CompilerOptions.cmake +3 -1
- data/ext/couchbase/cmake/OpenSSL.cmake +10 -2
- data/ext/couchbase/cmake/Packaging.cmake +48 -8
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +43 -1
- data/ext/couchbase/cmake/build_config.hxx.in +2 -0
- data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +18 -0
- data/ext/couchbase/cmake/tarball_glob.txt +10 -0
- data/ext/couchbase/core/app_telemetry_meter.cxx +1 -0
- data/ext/couchbase/core/app_telemetry_reporter.cxx +45 -43
- data/ext/couchbase/core/app_telemetry_reporter.hxx +4 -3
- data/ext/couchbase/core/bucket.cxx +128 -13
- data/ext/couchbase/core/bucket.hxx +12 -2
- data/ext/couchbase/core/cluster.cxx +304 -152
- data/ext/couchbase/core/cluster.hxx +32 -0
- data/ext/couchbase/core/cluster_credentials.cxx +25 -0
- data/ext/couchbase/core/cluster_credentials.hxx +5 -0
- data/ext/couchbase/core/cluster_label_listener.cxx +72 -0
- data/ext/couchbase/core/cluster_label_listener.hxx +46 -0
- data/ext/couchbase/core/cluster_options.hxx +4 -0
- data/ext/couchbase/core/deprecation_utils.hxx +26 -0
- data/ext/couchbase/core/error.hxx +27 -0
- data/ext/couchbase/core/free_form_http_request.hxx +0 -2
- data/ext/couchbase/core/http_component.cxx +12 -48
- data/ext/couchbase/core/impl/analytics.cxx +3 -2
- data/ext/couchbase/core/impl/analytics.hxx +2 -1
- data/ext/couchbase/core/impl/analytics_index_manager.cxx +249 -137
- data/ext/couchbase/core/impl/binary_collection.cxx +134 -58
- data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
- data/ext/couchbase/core/impl/collection.cxx +560 -245
- data/ext/couchbase/core/impl/collection_manager.cxx +89 -49
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +4 -4
- data/ext/couchbase/core/impl/error.cxx +20 -13
- data/ext/couchbase/core/impl/error.hxx +15 -10
- data/ext/couchbase/core/impl/get_all_replicas.hxx +1 -1
- data/ext/couchbase/core/impl/get_any_replica.hxx +2 -1
- data/ext/couchbase/core/impl/get_replica.hxx +2 -0
- data/ext/couchbase/core/impl/lookup_in_replica.hxx +1 -1
- data/ext/couchbase/core/impl/observability_recorder.cxx +161 -0
- data/ext/couchbase/core/impl/observability_recorder.hxx +77 -0
- data/ext/couchbase/core/impl/observe_seqno.hxx +2 -0
- data/ext/couchbase/core/impl/public_bucket.cxx +31 -7
- data/ext/couchbase/core/impl/public_cluster.cxx +107 -19
- data/ext/couchbase/core/impl/query.cxx +6 -3
- data/ext/couchbase/core/impl/query.hxx +3 -1
- data/ext/couchbase/core/impl/query_index_manager.cxx +267 -102
- data/ext/couchbase/core/impl/scope.cxx +53 -11
- data/ext/couchbase/core/impl/search.cxx +8 -4
- data/ext/couchbase/core/impl/search.hxx +6 -2
- data/ext/couchbase/core/impl/search_index_manager.cxx +131 -41
- data/ext/couchbase/core/impl/with_cancellation.hxx +75 -0
- data/ext/couchbase/core/io/config_tracker.cxx +9 -9
- data/ext/couchbase/core/io/config_tracker.hxx +2 -1
- data/ext/couchbase/core/io/http_command.hxx +98 -49
- data/ext/couchbase/core/io/http_context.hxx +2 -0
- data/ext/couchbase/core/io/http_session.cxx +23 -10
- data/ext/couchbase/core/io/http_session.hxx +17 -9
- data/ext/couchbase/core/io/http_session_manager.hxx +163 -228
- data/ext/couchbase/core/io/http_traits.hxx +0 -7
- data/ext/couchbase/core/io/mcbp_command.hxx +123 -44
- data/ext/couchbase/core/io/mcbp_session.cxx +251 -26
- data/ext/couchbase/core/io/mcbp_session.hxx +9 -1
- data/ext/couchbase/core/io/mcbp_traits.hxx +0 -8
- data/ext/couchbase/core/io/streams.cxx +3 -3
- data/ext/couchbase/core/io/streams.hxx +3 -2
- data/ext/couchbase/core/meta/features.hxx +15 -0
- data/ext/couchbase/core/meta/version.cxx +13 -0
- data/ext/couchbase/core/meta/version.hxx +3 -0
- data/ext/couchbase/core/metrics/constants.hxx +23 -0
- data/ext/couchbase/core/metrics/logging_meter.cxx +5 -5
- data/ext/couchbase/core/metrics/meter_wrapper.cxx +65 -63
- data/ext/couchbase/core/metrics/meter_wrapper.hxx +12 -10
- data/ext/couchbase/core/operations/document_analytics.hxx +0 -5
- data/ext/couchbase/core/operations/document_append.hxx +0 -4
- data/ext/couchbase/core/operations/document_decrement.hxx +0 -5
- data/ext/couchbase/core/operations/document_exists.hxx +0 -7
- data/ext/couchbase/core/operations/document_get.hxx +0 -7
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +77 -27
- data/ext/couchbase/core/operations/document_get_and_lock.hxx +0 -9
- data/ext/couchbase/core/operations/document_get_and_touch.hxx +0 -9
- data/ext/couchbase/core/operations/document_get_any_replica.hxx +83 -2
- data/ext/couchbase/core/operations/document_get_projected.hxx +0 -9
- data/ext/couchbase/core/operations/document_increment.hxx +0 -5
- data/ext/couchbase/core/operations/document_insert.hxx +0 -4
- data/ext/couchbase/core/operations/document_lookup_in.hxx +0 -9
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +46 -4
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +121 -43
- data/ext/couchbase/core/operations/document_mutate_in.hxx +0 -5
- data/ext/couchbase/core/operations/document_prepend.hxx +0 -4
- data/ext/couchbase/core/operations/document_query.hxx +0 -4
- data/ext/couchbase/core/operations/document_remove.hxx +0 -4
- data/ext/couchbase/core/operations/document_replace.hxx +0 -4
- data/ext/couchbase/core/operations/document_search.hxx +0 -7
- data/ext/couchbase/core/operations/document_touch.hxx +0 -7
- data/ext/couchbase/core/operations/document_unlock.hxx +0 -6
- data/ext/couchbase/core/operations/document_upsert.hxx +0 -4
- data/ext/couchbase/core/operations/document_view.cxx +2 -0
- data/ext/couchbase/core/operations/document_view.hxx +10 -13
- data/ext/couchbase/core/operations/http_noop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataverse_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataverse_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_connect.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_disconnect.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_replace.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_describe.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_flush.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_update.hxx +2 -0
- data/ext/couchbase/core/operations/management/change_password.hxx +2 -0
- data/ext/couchbase/core/operations/management/cluster_describe.hxx +2 -0
- data/ext/couchbase/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_update.hxx +2 -0
- data/ext/couchbase/core/operations/management/collections_manifest_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/error_utils.cxx +4 -1
- data/ext/couchbase/core/operations/management/eventing_deploy_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_drop_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_all_functions.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_status.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_pause_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_resume_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_undeploy_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_upsert_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/freeform.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_build.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_build_deferred.hxx +68 -30
- data/ext/couchbase/core/operations/management/query_index_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_get_all.hxx +4 -3
- data/ext/couchbase/core/operations/management/query_index_get_all_deferred.hxx +2 -1
- data/ext/couchbase/core/operations/management/role_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_get_stats.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_analyze_document.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_ingest.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_query.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_documents_count.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_stats.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/operation_traits.hxx +6 -0
- data/ext/couchbase/core/operations.hxx +0 -1
- data/ext/couchbase/core/operations_fwd.hxx +8 -0
- data/ext/couchbase/core/origin.cxx +67 -12
- data/ext/couchbase/core/origin.hxx +13 -8
- data/ext/couchbase/core/orphan_reporter.cxx +164 -0
- data/ext/couchbase/core/orphan_reporter.hxx +65 -0
- data/ext/couchbase/core/sasl/CMakeLists.txt +1 -0
- data/ext/couchbase/core/sasl/client.cc +6 -0
- data/ext/couchbase/core/sasl/mechanism.cc +2 -1
- data/ext/couchbase/core/sasl/mechanism.h +2 -1
- data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.cc +41 -0
- data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.h +47 -0
- data/ext/couchbase/core/tls_context_provider.cxx +44 -0
- data/ext/couchbase/core/tls_context_provider.hxx +44 -0
- data/ext/couchbase/core/tracing/attribute_helpers.hxx +45 -0
- data/ext/couchbase/core/tracing/constants.hxx +148 -68
- data/ext/couchbase/core/tracing/threshold_logging_options.hxx +0 -3
- data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +122 -170
- data/ext/couchbase/core/tracing/tracer_wrapper.cxx +17 -24
- data/ext/couchbase/core/tracing/tracer_wrapper.hxx +8 -10
- data/ext/couchbase/core/tracing/wrapper_sdk_tracer.cxx +114 -0
- data/ext/couchbase/core/tracing/wrapper_sdk_tracer.hxx +85 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +16 -14
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +4 -4
- data/ext/couchbase/core/transactions/transactions.cxx +1 -1
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +1 -2
- data/ext/couchbase/core/utils/byteswap.hxx +12 -0
- data/ext/couchbase/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
- data/ext/couchbase/core/utils/connection_string.cxx +2 -0
- data/ext/couchbase/couchbase/certificate_authenticator.hxx +1 -0
- data/ext/couchbase/couchbase/cluster.hxx +47 -0
- data/ext/couchbase/couchbase/cluster_options.hxx +16 -0
- data/ext/couchbase/couchbase/collection.hxx +60 -15
- data/ext/couchbase/couchbase/error_codes.hxx +48 -48
- data/ext/couchbase/couchbase/jwt_authenticator.hxx +52 -0
- data/ext/couchbase/couchbase/metrics/meter.hxx +2 -1
- data/ext/couchbase/couchbase/metrics/otel_meter.hxx +75 -80
- data/ext/couchbase/couchbase/network_options.hxx +19 -0
- data/ext/couchbase/couchbase/password_authenticator.hxx +1 -0
- data/ext/couchbase/couchbase/tracing/otel_tracer.hxx +15 -17
- data/ext/couchbase/couchbase/tracing/request_span.hxx +2 -2
- data/ext/couchbase.cxx +4 -0
- data/ext/extconf.rb +1 -0
- data/ext/rcb_analytics.cxx +157 -47
- data/ext/rcb_backend.cxx +118 -71
- data/ext/rcb_buckets.cxx +39 -16
- data/ext/rcb_collections.cxx +36 -12
- data/ext/rcb_crud.cxx +587 -294
- data/ext/rcb_hdr_histogram.cxx +219 -0
- data/ext/rcb_hdr_histogram.hxx +28 -0
- data/ext/rcb_multi.cxx +142 -59
- data/ext/rcb_observability.cxx +132 -0
- data/ext/rcb_observability.hxx +49 -0
- data/ext/rcb_query.cxx +77 -27
- data/ext/rcb_search.cxx +92 -31
- data/ext/rcb_users.cxx +69 -26
- data/ext/rcb_utils.cxx +91 -0
- data/ext/rcb_utils.hxx +141 -168
- data/ext/rcb_views.cxx +36 -12
- data/lib/active_support/cache/couchbase_store.rb +6 -6
- data/lib/couchbase/authenticator.rb +14 -0
- data/lib/couchbase/binary_collection.rb +37 -22
- data/lib/couchbase/bucket.rb +46 -31
- data/lib/couchbase/cluster.rb +146 -61
- data/lib/couchbase/collection.rb +257 -186
- data/lib/couchbase/datastructures/couchbase_list.rb +81 -50
- data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
- data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
- data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
- data/lib/couchbase/deprecations.rb +1 -1
- data/lib/couchbase/diagnostics.rb +8 -8
- data/lib/couchbase/errors.rb +6 -0
- data/lib/couchbase/management/analytics_index_manager.rb +90 -59
- data/lib/couchbase/management/bucket_manager.rb +73 -45
- data/lib/couchbase/management/collection_manager.rb +86 -43
- data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
- data/lib/couchbase/management/query_index_manager.rb +88 -36
- data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
- data/lib/couchbase/management/search_index_manager.rb +401 -178
- data/lib/couchbase/management/user_manager.rb +343 -174
- data/lib/couchbase/management/view_index_manager.rb +166 -73
- data/lib/couchbase/metrics/logging_meter.rb +108 -0
- data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
- data/lib/couchbase/metrics/meter.rb +27 -0
- data/lib/couchbase/metrics/noop_meter.rb +30 -0
- data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
- data/lib/couchbase/metrics/value_recorder.rb +25 -0
- data/lib/couchbase/options.rb +69 -3
- data/lib/couchbase/protostellar/cluster.rb +3 -0
- data/lib/couchbase/scope.rb +62 -48
- data/lib/couchbase/search_options.rb +18 -18
- data/lib/couchbase/tracing/noop_span.rb +29 -0
- data/lib/couchbase/tracing/noop_tracer.rb +29 -0
- data/lib/couchbase/tracing/request_span.rb +34 -0
- data/lib/couchbase/tracing/request_tracer.rb +28 -0
- data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
- data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
- data/lib/couchbase/utils/hdr_histogram.rb +55 -0
- data/lib/couchbase/utils/observability.rb +257 -0
- data/lib/couchbase/utils/observability_constants.rb +200 -0
- data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase.rb +2 -2
- metadata +58 -6
|
@@ -17,14 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
#include "core/cluster.hxx"
|
|
19
19
|
|
|
20
|
+
#include "core/impl/error.hxx"
|
|
21
|
+
#include "core/impl/observability_recorder.hxx"
|
|
22
|
+
#include "core/logger/logger.hxx"
|
|
20
23
|
#include "core/operations/management/query_index_build_deferred.hxx"
|
|
21
24
|
#include "core/operations/management/query_index_create.hxx"
|
|
22
25
|
#include "core/operations/management/query_index_drop.hxx"
|
|
23
26
|
#include "core/operations/management/query_index_get_all.hxx"
|
|
24
|
-
|
|
25
|
-
#include "core/
|
|
26
|
-
|
|
27
|
-
#include "core/logger/logger.hxx"
|
|
27
|
+
#include "core/tracing/constants.hxx"
|
|
28
|
+
#include "core/tracing/tracer_wrapper.hxx"
|
|
28
29
|
|
|
29
30
|
#include <couchbase/collection_query_index_manager.hxx>
|
|
30
31
|
#include <couchbase/query_index_manager.hxx>
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
#include <algorithm>
|
|
35
36
|
#include <utility>
|
|
36
37
|
|
|
38
|
+
#include "couchbase/bucket.hxx"
|
|
39
|
+
|
|
37
40
|
namespace couchbase
|
|
38
41
|
{
|
|
39
42
|
namespace
|
|
@@ -56,6 +59,9 @@ public:
|
|
|
56
59
|
, scope_name_(std::move(scope_name))
|
|
57
60
|
, collection_name_(std::move(collection_name))
|
|
58
61
|
, handler_(std::move(handler))
|
|
62
|
+
, observability_recorder_(
|
|
63
|
+
create_observability_recorder(core::tracing::operation::mgr_query_watch_indexes,
|
|
64
|
+
options_.parent_span))
|
|
59
65
|
{
|
|
60
66
|
}
|
|
61
67
|
|
|
@@ -67,6 +73,7 @@ public:
|
|
|
67
73
|
, scope_name_(std::move(other.scope_name_))
|
|
68
74
|
, collection_name_(std::move(other.collection_name_))
|
|
69
75
|
, handler_(std::move(other.handler_))
|
|
76
|
+
, observability_recorder_(std::move(other.observability_recorder_))
|
|
70
77
|
, timer_(std::move(other.timer_))
|
|
71
78
|
, start_time_(other.start_time_)
|
|
72
79
|
, timeout_(other.timeout_)
|
|
@@ -81,16 +88,21 @@ public:
|
|
|
81
88
|
|
|
82
89
|
void execute()
|
|
83
90
|
{
|
|
91
|
+
auto get_all_obs_rec = create_suboperation_observability_recorder(
|
|
92
|
+
core::tracing::operation::mgr_query_get_all_indexes, observability_recorder_);
|
|
93
|
+
core::operations::management::query_index_get_all_request get_all_request{
|
|
94
|
+
bucket_name_,
|
|
95
|
+
scope_name_,
|
|
96
|
+
collection_name_,
|
|
97
|
+
{},
|
|
98
|
+
{},
|
|
99
|
+
remaining(),
|
|
100
|
+
get_all_obs_rec->operation_span(),
|
|
101
|
+
};
|
|
84
102
|
return core_.execute(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
collection_name_,
|
|
89
|
-
{},
|
|
90
|
-
{},
|
|
91
|
-
remaining(),
|
|
92
|
-
},
|
|
93
|
-
[ctx = shared_from_this()](auto resp) {
|
|
103
|
+
std::move(get_all_request),
|
|
104
|
+
[ctx = shared_from_this(), get_all_obs_rec = std::move(get_all_obs_rec)](auto resp) {
|
|
105
|
+
get_all_obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
94
106
|
if (ctx->check(resp)) {
|
|
95
107
|
ctx->finish(resp, {});
|
|
96
108
|
} else if (ctx->remaining().count() <= 0) {
|
|
@@ -111,6 +123,7 @@ private:
|
|
|
111
123
|
if (ec.has_value()) {
|
|
112
124
|
resp.ctx.ec = ec.value();
|
|
113
125
|
}
|
|
126
|
+
observability_recorder_->finish(resp.ctx.ec);
|
|
114
127
|
handler(core::impl::make_error(resp.ctx));
|
|
115
128
|
timer_.cancel();
|
|
116
129
|
}
|
|
@@ -160,6 +173,37 @@ private:
|
|
|
160
173
|
});
|
|
161
174
|
}
|
|
162
175
|
|
|
176
|
+
[[nodiscard]] auto create_observability_recorder(
|
|
177
|
+
const std::string& operation_name,
|
|
178
|
+
const std::shared_ptr<tracing::request_span>& parent_span) const
|
|
179
|
+
-> std::unique_ptr<core::impl::observability_recorder>
|
|
180
|
+
{
|
|
181
|
+
auto rec = core::impl::observability_recorder::create(
|
|
182
|
+
operation_name, parent_span, core_.tracer(), core_.meter());
|
|
183
|
+
rec->with_service(core::tracing::service::query);
|
|
184
|
+
rec->with_bucket_name(bucket_name_);
|
|
185
|
+
if (!collection_name_.empty()) {
|
|
186
|
+
rec->with_scope_name(scope_name_);
|
|
187
|
+
rec->with_collection_name(collection_name_);
|
|
188
|
+
}
|
|
189
|
+
return rec;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[[nodiscard]] auto create_suboperation_observability_recorder(
|
|
193
|
+
const std::string& subop_name,
|
|
194
|
+
const std::unique_ptr<core::impl::observability_recorder>& parent_recorder) const
|
|
195
|
+
-> std::unique_ptr<core::impl::observability_recorder>
|
|
196
|
+
{
|
|
197
|
+
auto rec = parent_recorder->record_suboperation(subop_name);
|
|
198
|
+
rec->with_service(core::tracing::service::query);
|
|
199
|
+
rec->with_bucket_name(bucket_name_);
|
|
200
|
+
if (!collection_name_.empty()) {
|
|
201
|
+
rec->with_scope_name(scope_name_);
|
|
202
|
+
rec->with_collection_name(collection_name_);
|
|
203
|
+
}
|
|
204
|
+
return rec;
|
|
205
|
+
}
|
|
206
|
+
|
|
163
207
|
couchbase::core::cluster core_;
|
|
164
208
|
std::string bucket_name_;
|
|
165
209
|
std::vector<std::string> index_names_;
|
|
@@ -167,6 +211,7 @@ private:
|
|
|
167
211
|
std::string scope_name_;
|
|
168
212
|
std::string collection_name_;
|
|
169
213
|
watch_query_indexes_handler handler_;
|
|
214
|
+
std::unique_ptr<core::impl::observability_recorder> observability_recorder_;
|
|
170
215
|
asio::steady_timer timer_{ core_.io_context() };
|
|
171
216
|
std::chrono::steady_clock::time_point start_time_{ std::chrono::steady_clock::now() };
|
|
172
217
|
std::chrono::milliseconds timeout_{ options_.timeout.value_or(
|
|
@@ -190,22 +235,25 @@ public:
|
|
|
190
235
|
const get_all_query_indexes_options::built& options,
|
|
191
236
|
get_all_query_indexes_handler&& handler) const
|
|
192
237
|
{
|
|
193
|
-
|
|
194
|
-
core::
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
238
|
+
auto obs_rec =
|
|
239
|
+
create_observability_recorder(core::tracing::operation::mgr_query_get_all_indexes,
|
|
240
|
+
bucket_name,
|
|
241
|
+
scope_name,
|
|
242
|
+
collection_name,
|
|
243
|
+
options.parent_span);
|
|
244
|
+
|
|
245
|
+
core::operations::management::query_index_get_all_request request{
|
|
246
|
+
bucket_name, scope_name, collection_name, {}, {}, options.timeout, obs_rec->operation_span(),
|
|
247
|
+
};
|
|
248
|
+
return core_.execute(std::move(request),
|
|
249
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](
|
|
250
|
+
const core::operations::management::query_index_get_all_response& resp) {
|
|
251
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
252
|
+
if (resp.ctx.ec) {
|
|
253
|
+
return handler(core::impl::make_error(resp.ctx), {});
|
|
254
|
+
}
|
|
255
|
+
handler(core::impl::make_error(resp.ctx), resp.indexes);
|
|
256
|
+
});
|
|
209
257
|
}
|
|
210
258
|
|
|
211
259
|
void create_index(const std::string& bucket_name,
|
|
@@ -216,23 +264,32 @@ public:
|
|
|
216
264
|
const create_query_index_options::built& options,
|
|
217
265
|
create_query_index_handler&& handler) const
|
|
218
266
|
{
|
|
267
|
+
auto obs_rec = create_observability_recorder(core::tracing::operation::mgr_query_create_index,
|
|
268
|
+
bucket_name,
|
|
269
|
+
scope_name,
|
|
270
|
+
collection_name,
|
|
271
|
+
options.parent_span);
|
|
272
|
+
|
|
273
|
+
core::operations::management::query_index_create_request request{
|
|
274
|
+
bucket_name,
|
|
275
|
+
scope_name,
|
|
276
|
+
collection_name,
|
|
277
|
+
std::move(index_name),
|
|
278
|
+
std::move(keys),
|
|
279
|
+
{},
|
|
280
|
+
false /* is_primary */,
|
|
281
|
+
options.ignore_if_exists,
|
|
282
|
+
options.condition,
|
|
283
|
+
options.deferred,
|
|
284
|
+
options.num_replicas,
|
|
285
|
+
{},
|
|
286
|
+
options.timeout,
|
|
287
|
+
obs_rec->operation_span(),
|
|
288
|
+
};
|
|
219
289
|
return core_.execute(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
collection_name,
|
|
224
|
-
std::move(index_name),
|
|
225
|
-
std::move(keys),
|
|
226
|
-
{},
|
|
227
|
-
false /* is_primary */,
|
|
228
|
-
options.ignore_if_exists,
|
|
229
|
-
options.condition,
|
|
230
|
-
options.deferred,
|
|
231
|
-
options.num_replicas,
|
|
232
|
-
{},
|
|
233
|
-
options.timeout,
|
|
234
|
-
},
|
|
235
|
-
[handler = std::move(handler)](const auto& resp) {
|
|
290
|
+
std::move(request),
|
|
291
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](const auto& resp) {
|
|
292
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
236
293
|
handler(core::impl::make_error(resp.ctx));
|
|
237
294
|
});
|
|
238
295
|
}
|
|
@@ -243,23 +300,33 @@ public:
|
|
|
243
300
|
const create_primary_query_index_options::built& options,
|
|
244
301
|
create_primary_query_index_handler&& handler) const
|
|
245
302
|
{
|
|
303
|
+
auto obs_rec =
|
|
304
|
+
create_observability_recorder(core::tracing::operation::mgr_query_create_primary_index,
|
|
305
|
+
bucket_name,
|
|
306
|
+
scope_name,
|
|
307
|
+
collection_name,
|
|
308
|
+
options.parent_span);
|
|
309
|
+
|
|
310
|
+
core::operations::management::query_index_create_request request{
|
|
311
|
+
bucket_name,
|
|
312
|
+
scope_name,
|
|
313
|
+
collection_name,
|
|
314
|
+
options.index_name.value_or(""),
|
|
315
|
+
{},
|
|
316
|
+
{},
|
|
317
|
+
true /* is_primary */,
|
|
318
|
+
options.ignore_if_exists,
|
|
319
|
+
{},
|
|
320
|
+
options.deferred,
|
|
321
|
+
options.num_replicas,
|
|
322
|
+
{},
|
|
323
|
+
options.timeout,
|
|
324
|
+
obs_rec->operation_span(),
|
|
325
|
+
};
|
|
246
326
|
return core_.execute(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
collection_name,
|
|
251
|
-
options.index_name.value_or(""),
|
|
252
|
-
{},
|
|
253
|
-
{},
|
|
254
|
-
true /* is_primary */,
|
|
255
|
-
options.ignore_if_exists,
|
|
256
|
-
{},
|
|
257
|
-
options.deferred,
|
|
258
|
-
options.num_replicas,
|
|
259
|
-
{},
|
|
260
|
-
options.timeout,
|
|
261
|
-
},
|
|
262
|
-
[handler = std::move(handler)](const auto& resp) {
|
|
327
|
+
std::move(request),
|
|
328
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](const auto& resp) {
|
|
329
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
263
330
|
handler(core::impl::make_error(resp.ctx));
|
|
264
331
|
});
|
|
265
332
|
}
|
|
@@ -271,19 +338,28 @@ public:
|
|
|
271
338
|
const drop_query_index_options::built& options,
|
|
272
339
|
drop_query_index_handler&& handler) const
|
|
273
340
|
{
|
|
341
|
+
auto obs_rec = create_observability_recorder(core::tracing::operation::mgr_query_drop_index,
|
|
342
|
+
bucket_name,
|
|
343
|
+
scope_name,
|
|
344
|
+
collection_name,
|
|
345
|
+
options.parent_span);
|
|
346
|
+
|
|
347
|
+
core::operations::management::query_index_drop_request request{
|
|
348
|
+
bucket_name,
|
|
349
|
+
scope_name,
|
|
350
|
+
collection_name,
|
|
351
|
+
std::move(index_name),
|
|
352
|
+
{},
|
|
353
|
+
false /* is_primary */,
|
|
354
|
+
options.ignore_if_not_exists,
|
|
355
|
+
{},
|
|
356
|
+
options.timeout,
|
|
357
|
+
obs_rec->operation_span(),
|
|
358
|
+
};
|
|
274
359
|
return core_.execute(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
collection_name,
|
|
279
|
-
std::move(index_name),
|
|
280
|
-
{},
|
|
281
|
-
false /* is_primary */,
|
|
282
|
-
options.ignore_if_not_exists,
|
|
283
|
-
{},
|
|
284
|
-
options.timeout,
|
|
285
|
-
},
|
|
286
|
-
[handler = std::move(handler)](const auto& resp) {
|
|
360
|
+
std::move(request),
|
|
361
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](const auto& resp) {
|
|
362
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
287
363
|
handler(core::impl::make_error(resp.ctx));
|
|
288
364
|
});
|
|
289
365
|
}
|
|
@@ -294,22 +370,31 @@ public:
|
|
|
294
370
|
const drop_primary_query_index_options::built& options,
|
|
295
371
|
drop_primary_query_index_handler&& handler) const
|
|
296
372
|
{
|
|
297
|
-
|
|
298
|
-
core::
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
373
|
+
auto obs_rec =
|
|
374
|
+
create_observability_recorder(core::tracing::operation::mgr_query_drop_primary_index,
|
|
375
|
+
bucket_name,
|
|
376
|
+
scope_name,
|
|
377
|
+
collection_name,
|
|
378
|
+
options.parent_span);
|
|
379
|
+
|
|
380
|
+
core::operations::management::query_index_drop_request request{
|
|
381
|
+
bucket_name,
|
|
382
|
+
scope_name,
|
|
383
|
+
collection_name,
|
|
384
|
+
options.index_name.value_or(""),
|
|
385
|
+
{},
|
|
386
|
+
true,
|
|
387
|
+
options.ignore_if_not_exists,
|
|
388
|
+
{},
|
|
389
|
+
options.timeout,
|
|
390
|
+
obs_rec->operation_span(),
|
|
391
|
+
};
|
|
392
|
+
return core_.execute(std::move(request),
|
|
393
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](
|
|
394
|
+
const core::operations::management::query_index_drop_response& resp) {
|
|
395
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
396
|
+
handler(core::impl::make_error(resp.ctx));
|
|
397
|
+
});
|
|
313
398
|
}
|
|
314
399
|
|
|
315
400
|
void build_deferred_indexes(const std::string& bucket_name,
|
|
@@ -319,32 +404,75 @@ public:
|
|
|
319
404
|
build_deferred_query_indexes_handler&& handler) const
|
|
320
405
|
{
|
|
321
406
|
auto timeout = options.timeout;
|
|
407
|
+
|
|
408
|
+
auto top_obs_rec =
|
|
409
|
+
create_observability_recorder(core::tracing::operation::mgr_query_build_deferred_indexes,
|
|
410
|
+
bucket_name,
|
|
411
|
+
scope_name,
|
|
412
|
+
collection_name,
|
|
413
|
+
options.parent_span);
|
|
414
|
+
|
|
415
|
+
auto get_all_deferred_obs_rec = create_suboperation_observability_recorder(
|
|
416
|
+
core::tracing::operation::mgr_query_get_all_deferred_indexes,
|
|
417
|
+
bucket_name,
|
|
418
|
+
scope_name,
|
|
419
|
+
collection_name,
|
|
420
|
+
top_obs_rec);
|
|
421
|
+
|
|
422
|
+
core::operations::management::query_index_get_all_deferred_request get_all_deferred_request{
|
|
423
|
+
bucket_name,
|
|
424
|
+
scope_name,
|
|
425
|
+
collection_name,
|
|
426
|
+
{},
|
|
427
|
+
{},
|
|
428
|
+
options.timeout,
|
|
429
|
+
get_all_deferred_obs_rec->operation_span(),
|
|
430
|
+
};
|
|
431
|
+
|
|
322
432
|
return core_.execute(
|
|
323
|
-
|
|
324
|
-
bucket_name, scope_name, collection_name, {}, {}, timeout },
|
|
433
|
+
std::move(get_all_deferred_request),
|
|
325
434
|
[self = shared_from_this(),
|
|
326
435
|
bucket = bucket_name,
|
|
327
436
|
scope = scope_name,
|
|
328
437
|
collection = collection_name,
|
|
329
438
|
timeout,
|
|
439
|
+
get_all_deferred_obs_rec = std::move(get_all_deferred_obs_rec),
|
|
440
|
+
top_obs_rec = std::move(top_obs_rec),
|
|
330
441
|
handler = std::move(handler)](auto list_resp) mutable {
|
|
442
|
+
get_all_deferred_obs_rec->finish(list_resp.ctx.retry_attempts, list_resp.ctx.ec);
|
|
331
443
|
if (list_resp.ctx.ec) {
|
|
444
|
+
top_obs_rec->finish(list_resp.ctx.ec);
|
|
332
445
|
return handler(core::impl::make_error(list_resp.ctx));
|
|
333
446
|
}
|
|
334
447
|
if (list_resp.index_names.empty()) {
|
|
448
|
+
top_obs_rec->finish(list_resp.ctx.ec);
|
|
335
449
|
return handler(core::impl::make_error(list_resp.ctx));
|
|
336
450
|
}
|
|
337
|
-
self->
|
|
338
|
-
core::
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
451
|
+
auto build_obs_rec = self->create_suboperation_observability_recorder(
|
|
452
|
+
core::tracing::operation::mgr_query_build_indexes,
|
|
453
|
+
bucket,
|
|
454
|
+
scope,
|
|
455
|
+
collection,
|
|
456
|
+
top_obs_rec);
|
|
457
|
+
core::operations::management::query_index_build_request build_request{
|
|
458
|
+
std::move(bucket),
|
|
459
|
+
scope,
|
|
460
|
+
collection,
|
|
461
|
+
{},
|
|
462
|
+
std::move(list_resp.index_names),
|
|
463
|
+
{},
|
|
464
|
+
timeout,
|
|
465
|
+
build_obs_rec->operation_span(),
|
|
466
|
+
};
|
|
467
|
+
self->core_.execute(std::move(build_request),
|
|
468
|
+
[top_obs_rec = std::move(top_obs_rec),
|
|
469
|
+
build_obs_rec = std::move(build_obs_rec),
|
|
470
|
+
handler = std::move(handler)](const auto& build_resp) {
|
|
471
|
+
build_obs_rec->finish(build_resp.ctx.retry_attempts,
|
|
472
|
+
build_resp.ctx.ec);
|
|
473
|
+
top_obs_rec->finish(build_resp.ctx.ec);
|
|
474
|
+
return handler(core::impl::make_error(build_resp.ctx));
|
|
475
|
+
});
|
|
348
476
|
});
|
|
349
477
|
}
|
|
350
478
|
|
|
@@ -366,6 +494,43 @@ public:
|
|
|
366
494
|
}
|
|
367
495
|
|
|
368
496
|
private:
|
|
497
|
+
[[nodiscard]] auto create_observability_recorder(
|
|
498
|
+
const std::string& operation_name,
|
|
499
|
+
const std::string& bucket_name,
|
|
500
|
+
const std::string& scope_name,
|
|
501
|
+
const std::string& collection_name,
|
|
502
|
+
const std::shared_ptr<tracing::request_span>& parent_span) const
|
|
503
|
+
-> std::unique_ptr<core::impl::observability_recorder>
|
|
504
|
+
{
|
|
505
|
+
auto rec = core::impl::observability_recorder::create(
|
|
506
|
+
operation_name, parent_span, core_.tracer(), core_.meter());
|
|
507
|
+
rec->with_service(core::tracing::service::query);
|
|
508
|
+
rec->with_bucket_name(bucket_name);
|
|
509
|
+
if (!collection_name.empty()) {
|
|
510
|
+
rec->with_scope_name(scope_name);
|
|
511
|
+
rec->with_collection_name(collection_name);
|
|
512
|
+
}
|
|
513
|
+
return rec;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
[[nodiscard]] auto create_suboperation_observability_recorder(
|
|
517
|
+
const std::string& subop_name,
|
|
518
|
+
const std::string& bucket_name,
|
|
519
|
+
const std::string& scope_name,
|
|
520
|
+
const std::string& collection_name,
|
|
521
|
+
const std::unique_ptr<core::impl::observability_recorder>& parent_recorder) const
|
|
522
|
+
-> std::unique_ptr<core::impl::observability_recorder>
|
|
523
|
+
{
|
|
524
|
+
auto rec = parent_recorder->record_suboperation(subop_name);
|
|
525
|
+
rec->with_service(core::tracing::service::query);
|
|
526
|
+
rec->with_bucket_name(bucket_name);
|
|
527
|
+
if (!collection_name.empty()) {
|
|
528
|
+
rec->with_scope_name(scope_name);
|
|
529
|
+
rec->with_collection_name(collection_name);
|
|
530
|
+
}
|
|
531
|
+
return rec;
|
|
532
|
+
}
|
|
533
|
+
|
|
369
534
|
core::cluster core_;
|
|
370
535
|
};
|
|
371
536
|
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
#include "analytics.hxx"
|
|
19
19
|
#include "core/cluster.hxx"
|
|
20
|
+
#include "core/tracing/constants.hxx"
|
|
21
|
+
#include "core/tracing/tracer_wrapper.hxx"
|
|
20
22
|
#include "error.hxx"
|
|
21
23
|
#include "internal_search_error_context.hxx"
|
|
22
24
|
#include "internal_search_meta_data.hxx"
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
#include "internal_search_row.hxx"
|
|
25
27
|
#include "internal_search_row_location.hxx"
|
|
26
28
|
#include "internal_search_row_locations.hxx"
|
|
29
|
+
#include "observability_recorder.hxx"
|
|
27
30
|
#include "query.hxx"
|
|
28
31
|
#include "search.hxx"
|
|
29
32
|
|
|
@@ -75,9 +78,16 @@ public:
|
|
|
75
78
|
|
|
76
79
|
void query(std::string statement, query_options::built options, query_handler&& handler) const
|
|
77
80
|
{
|
|
81
|
+
auto obs_rec = create_observability_recorder(
|
|
82
|
+
core::tracing::operation::query, core::service_type::query, options.parent_span);
|
|
83
|
+
obs_rec->with_query_statement(statement, options);
|
|
84
|
+
|
|
85
|
+
auto request = core::impl::build_query_request(
|
|
86
|
+
std::move(statement), query_context_, std::move(options), obs_rec->operation_span());
|
|
87
|
+
|
|
78
88
|
return core_.execute(
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
std::move(request), [obs_rec = std::move(obs_rec), handler = std::move(handler)](auto resp) {
|
|
90
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
81
91
|
return handler(core::impl::make_error(resp.ctx), core::impl::build_result(resp));
|
|
82
92
|
});
|
|
83
93
|
}
|
|
@@ -86,12 +96,19 @@ public:
|
|
|
86
96
|
analytics_options::built options,
|
|
87
97
|
analytics_handler&& handler) const
|
|
88
98
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
auto obs_rec = create_observability_recorder(
|
|
100
|
+
core::tracing::operation::analytics, core::service_type::analytics, options.parent_span);
|
|
101
|
+
obs_rec->with_query_statement(statement, options);
|
|
102
|
+
|
|
103
|
+
auto request = core::impl::build_analytics_request(
|
|
104
|
+
std::move(statement), std::move(options), bucket_name_, name_, obs_rec->operation_span());
|
|
105
|
+
|
|
106
|
+
return core_.execute(
|
|
107
|
+
std::move(request),
|
|
108
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](auto resp) mutable {
|
|
109
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
110
|
+
return handler(core::impl::make_error(resp.ctx), core::impl::build_result(resp));
|
|
111
|
+
});
|
|
95
112
|
}
|
|
96
113
|
|
|
97
114
|
void search(std::string index_name,
|
|
@@ -99,16 +116,41 @@ public:
|
|
|
99
116
|
search_options::built options,
|
|
100
117
|
search_handler&& handler) const
|
|
101
118
|
{
|
|
119
|
+
auto obs_rec = create_observability_recorder(
|
|
120
|
+
core::tracing::operation::search, core::service_type::search, options.parent_span);
|
|
121
|
+
|
|
122
|
+
auto core_req = core::impl::build_search_request(std::move(index_name),
|
|
123
|
+
std::move(request),
|
|
124
|
+
std::move(options),
|
|
125
|
+
bucket_name_,
|
|
126
|
+
name_,
|
|
127
|
+
obs_rec->operation_span());
|
|
102
128
|
return core_.execute(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
std::move(core_req),
|
|
130
|
+
[obs_rec = std::move(obs_rec), handler = std::move(handler)](auto&& resp) mutable {
|
|
131
|
+
obs_rec->finish(resp.ctx.retry_attempts, resp.ctx.ec);
|
|
106
132
|
return handler(core::impl::make_error(resp.ctx),
|
|
107
133
|
search_result{ internal_search_result{ resp } });
|
|
108
134
|
});
|
|
109
135
|
}
|
|
110
136
|
|
|
111
137
|
private:
|
|
138
|
+
[[nodiscard]] auto create_observability_recorder(
|
|
139
|
+
const std::string& operation_name,
|
|
140
|
+
const core::service_type service,
|
|
141
|
+
const std::shared_ptr<tracing::request_span>& parent_span) const
|
|
142
|
+
-> std::unique_ptr<core::impl::observability_recorder>
|
|
143
|
+
{
|
|
144
|
+
auto rec = core::impl::observability_recorder::create(
|
|
145
|
+
operation_name, parent_span, core_.tracer(), core_.meter());
|
|
146
|
+
|
|
147
|
+
rec->with_service(core::tracing::service_name_for_http_service(service));
|
|
148
|
+
rec->with_bucket_name(bucket_name_);
|
|
149
|
+
rec->with_scope_name(name_);
|
|
150
|
+
|
|
151
|
+
return rec;
|
|
152
|
+
}
|
|
153
|
+
|
|
112
154
|
core::cluster core_;
|
|
113
155
|
std::string bucket_name_;
|
|
114
156
|
std::string name_;
|
|
@@ -132,7 +132,9 @@ build_search_request(std::string index_name,
|
|
|
132
132
|
const search_query& query,
|
|
133
133
|
search_options::built options,
|
|
134
134
|
std::optional<std::string> bucket_name,
|
|
135
|
-
std::optional<std::string> scope_name
|
|
135
|
+
std::optional<std::string> scope_name,
|
|
136
|
+
std::shared_ptr<couchbase::tracing::request_span> op_span)
|
|
137
|
+
-> core::operations::search_request
|
|
136
138
|
{
|
|
137
139
|
auto encoded = query.encode();
|
|
138
140
|
if (encoded.ec) {
|
|
@@ -165,7 +167,7 @@ build_search_request(std::string index_name,
|
|
|
165
167
|
options.client_context_id,
|
|
166
168
|
options.timeout,
|
|
167
169
|
};
|
|
168
|
-
request.parent_span =
|
|
170
|
+
request.parent_span = std::move(op_span);
|
|
169
171
|
return request;
|
|
170
172
|
}
|
|
171
173
|
|
|
@@ -174,7 +176,9 @@ build_search_request(std::string index_name,
|
|
|
174
176
|
couchbase::search_request request,
|
|
175
177
|
search_options::built options,
|
|
176
178
|
std::optional<std::string> bucket_name,
|
|
177
|
-
std::optional<std::string> scope_name
|
|
179
|
+
std::optional<std::string> scope_name,
|
|
180
|
+
std::shared_ptr<couchbase::tracing::request_span> op_span)
|
|
181
|
+
-> core::operations::search_request
|
|
178
182
|
{
|
|
179
183
|
if (!request.search_query().has_value()) {
|
|
180
184
|
request.search_query(couchbase::match_none_query{});
|
|
@@ -208,7 +212,7 @@ build_search_request(std::string index_name,
|
|
|
208
212
|
options.client_context_id,
|
|
209
213
|
options.timeout,
|
|
210
214
|
};
|
|
211
|
-
core_request.parent_span =
|
|
215
|
+
core_request.parent_span = std::move(op_span);
|
|
212
216
|
|
|
213
217
|
if (auto vector_search = request.vector_search(); vector_search.has_value()) {
|
|
214
218
|
core_request.vector_search = core::utils::json::generate_binary(vector_search->query);
|
|
@@ -33,13 +33,17 @@ build_search_request(std::string index_name,
|
|
|
33
33
|
const search_query& query,
|
|
34
34
|
search_options::built options,
|
|
35
35
|
std::optional<std::string> bucket_name,
|
|
36
|
-
std::optional<std::string> scope_name
|
|
36
|
+
std::optional<std::string> scope_name,
|
|
37
|
+
std::shared_ptr<couchbase::tracing::request_span> op_span)
|
|
38
|
+
-> core::operations::search_request;
|
|
37
39
|
|
|
38
40
|
auto
|
|
39
41
|
build_search_request(std::string index_name,
|
|
40
42
|
search_request request,
|
|
41
43
|
search_options::built options,
|
|
42
44
|
std::optional<std::string> bucket_name,
|
|
43
|
-
std::optional<std::string> scope_name
|
|
45
|
+
std::optional<std::string> scope_name,
|
|
46
|
+
std::shared_ptr<couchbase::tracing::request_span> op_span)
|
|
47
|
+
-> core::operations::search_request;
|
|
44
48
|
|
|
45
49
|
} // namespace couchbase::core::impl
|