couchbase 3.7.0-aarch64-linux → 3.8.0-aarch64-linux

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/active_support/cache/couchbase_store.rb +6 -6
  4. data/lib/couchbase/3.2/libcouchbase.so +0 -0
  5. data/lib/couchbase/3.3/libcouchbase.so +0 -0
  6. data/lib/couchbase/3.4/libcouchbase.so +0 -0
  7. data/lib/couchbase/{3.1 → 4.0}/libcouchbase.so +0 -0
  8. data/lib/couchbase/authenticator.rb +14 -0
  9. data/lib/couchbase/binary_collection.rb +37 -22
  10. data/lib/couchbase/bucket.rb +46 -31
  11. data/lib/couchbase/cluster.rb +146 -61
  12. data/lib/couchbase/collection.rb +257 -186
  13. data/lib/couchbase/datastructures/couchbase_list.rb +81 -50
  14. data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
  15. data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
  16. data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
  17. data/lib/couchbase/deprecations.rb +1 -1
  18. data/lib/couchbase/diagnostics.rb +8 -8
  19. data/lib/couchbase/errors.rb +6 -0
  20. data/lib/couchbase/libcouchbase.rb +1 -1
  21. data/lib/couchbase/management/analytics_index_manager.rb +90 -59
  22. data/lib/couchbase/management/bucket_manager.rb +73 -45
  23. data/lib/couchbase/management/collection_manager.rb +86 -43
  24. data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
  25. data/lib/couchbase/management/query_index_manager.rb +88 -36
  26. data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
  27. data/lib/couchbase/management/search_index_manager.rb +401 -178
  28. data/lib/couchbase/management/user_manager.rb +343 -174
  29. data/lib/couchbase/management/view_index_manager.rb +166 -73
  30. data/lib/couchbase/metrics/logging_meter.rb +108 -0
  31. data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
  32. data/lib/couchbase/metrics/meter.rb +27 -0
  33. data/lib/couchbase/metrics/noop_meter.rb +30 -0
  34. data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
  35. data/lib/couchbase/metrics/value_recorder.rb +25 -0
  36. data/lib/couchbase/options.rb +69 -3
  37. data/lib/couchbase/protostellar/cluster.rb +3 -0
  38. data/lib/couchbase/scope.rb +62 -48
  39. data/lib/couchbase/search_options.rb +18 -18
  40. data/lib/couchbase/tracing/noop_span.rb +29 -0
  41. data/lib/couchbase/tracing/noop_tracer.rb +29 -0
  42. data/lib/couchbase/tracing/request_span.rb +34 -0
  43. data/lib/couchbase/tracing/request_tracer.rb +28 -0
  44. data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
  45. data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
  46. data/lib/couchbase/utils/hdr_histogram.rb +55 -0
  47. data/lib/couchbase/utils/observability.rb +257 -0
  48. data/lib/couchbase/utils/observability_constants.rb +200 -0
  49. data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
  50. data/lib/couchbase/version.rb +1 -1
  51. data/lib/couchbase.rb +2 -2
  52. metadata +37 -8
@@ -385,8 +385,12 @@ module Couchbase
385
385
  alias inspect to_s
386
386
 
387
387
  # @param [Couchbase::Backend] backend
388
- def initialize(backend)
388
+ # @param [Couchbase::Observability::Wrapper] observability wrapper
389
+ #
390
+ # @api private
391
+ def initialize(backend, observability)
389
392
  @backend = backend
393
+ @observability = observability
390
394
  end
391
395
 
392
396
  # Fetches all indexes from the server
@@ -402,19 +406,25 @@ module Couchbase
402
406
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
403
407
  end
404
408
 
405
- res = @backend.query_index_get_all(bucket_name, options.to_backend)
406
- res[:indexes].map do |idx|
407
- QueryIndex.new do |index|
408
- index.name = idx[:name]
409
- index.is_primary = idx[:is_primary]
410
- index.type = idx[:type]
411
- index.state = idx[:state]
412
- index.bucket = idx[:bucket_name]
413
- index.scope = idx[:scope_name]
414
- index.collection = idx[:collection_name]
415
- index.index_key = idx[:index_key]
416
- index.condition = idx[:condition]
417
- index.partition = idx[:partition]
409
+ @observability.record_operation(Observability::OP_QM_GET_ALL_INDEXES, options.parent_span, self, :query) do |obs_handler|
410
+ obs_handler.add_bucket_name(bucket_name)
411
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
412
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
413
+
414
+ res = @backend.query_index_get_all(bucket_name, options.to_backend, obs_handler)
415
+ res[:indexes].map do |idx|
416
+ QueryIndex.new do |index|
417
+ index.name = idx[:name]
418
+ index.is_primary = idx[:is_primary]
419
+ index.type = idx[:type]
420
+ index.state = idx[:state]
421
+ index.bucket = idx[:bucket_name]
422
+ index.scope = idx[:scope_name]
423
+ index.collection = idx[:collection_name]
424
+ index.index_key = idx[:index_key]
425
+ index.condition = idx[:condition]
426
+ index.partition = idx[:partition]
427
+ end
418
428
  end
419
429
  end
420
430
  end
@@ -435,7 +445,13 @@ module Couchbase
435
445
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
436
446
  end
437
447
 
438
- @backend.query_index_create(bucket_name, index_name, fields, options.to_backend)
448
+ @observability.record_operation(Observability::OP_QM_CREATE_INDEX, options.parent_span, self, :query) do |obs_handler|
449
+ obs_handler.add_bucket_name(bucket_name)
450
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
451
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
452
+
453
+ @backend.query_index_create(bucket_name, index_name, fields, options.to_backend, obs_handler)
454
+ end
439
455
  end
440
456
 
441
457
  # Creates new primary index
@@ -452,7 +468,13 @@ module Couchbase
452
468
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
453
469
  end
454
470
 
455
- @backend.query_index_create_primary(bucket_name, options.to_backend)
471
+ @observability.record_operation(Observability::OP_QM_CREATE_PRIMARY_INDEX, options.parent_span, self, :query) do |obs_handler|
472
+ obs_handler.add_bucket_name(bucket_name)
473
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
474
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
475
+
476
+ @backend.query_index_create_primary(bucket_name, options.to_backend, obs_handler)
477
+ end
456
478
  end
457
479
 
458
480
  # Drops the index
@@ -470,7 +492,13 @@ module Couchbase
470
492
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
471
493
  end
472
494
 
473
- @backend.query_index_drop(bucket_name, index_name, options.to_backend)
495
+ @observability.record_operation(Observability::OP_QM_DROP_INDEX, options.parent_span, self, :query) do |obs_handler|
496
+ obs_handler.add_bucket_name(bucket_name)
497
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
498
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
499
+
500
+ @backend.query_index_drop(bucket_name, index_name, options.to_backend, obs_handler)
501
+ end
474
502
  end
475
503
 
476
504
  # Drops the primary index
@@ -487,7 +515,13 @@ module Couchbase
487
515
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
488
516
  end
489
517
 
490
- @backend.query_index_drop_primary(bucket_name, options.to_backend)
518
+ @observability.record_operation(Observability::OP_QM_DROP_PRIMARY_INDEX, options.parent_span, self, :query) do |obs_handler|
519
+ obs_handler.add_bucket_name(bucket_name)
520
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
521
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
522
+
523
+ @backend.query_index_drop_primary(bucket_name, options.to_backend, obs_handler)
524
+ end
491
525
  end
492
526
 
493
527
  # Build all indexes which are currently in deferred state
@@ -503,7 +537,13 @@ module Couchbase
503
537
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
504
538
  end
505
539
 
506
- @backend.query_index_build_deferred(bucket_name, options.to_backend)
540
+ @observability.record_operation(Observability::OP_QM_BUILD_DEFERRED_INDEXES, options.parent_span, self, :query) do |obs_handler|
541
+ obs_handler.add_bucket_name(bucket_name)
542
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
543
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
544
+
545
+ @backend.query_index_build_deferred(bucket_name, options.to_backend, obs_handler)
546
+ end
507
547
  end
508
548
 
509
549
  # Polls indexes until they are online
@@ -520,24 +560,36 @@ module Couchbase
520
560
  warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
521
561
  end
522
562
 
523
- index_names.append("#primary") if options.watch_primary
524
-
525
- interval_millis = 50
526
- deadline = Time.now + (Utils::Time.extract_duration(timeout) * 0.001)
527
- while Time.now <= deadline
528
- get_all_opts = Options::Query::GetAllIndexes.new(timeout: ((deadline - Time.now) * 1000).round)
529
- indexes = get_all_indexes(bucket_name, get_all_opts).select { |idx| index_names.include? idx.name }
530
- indexes_not_found = index_names - indexes.map(&:name)
531
- raise Error::IndexNotFound, "Failed to find the indexes: #{indexes_not_found.join(', ')}" unless indexes_not_found.empty?
532
-
533
- all_online = indexes.all? { |idx| idx.state == :online }
534
- return if all_online
535
-
536
- sleep(interval_millis / 1000)
537
- interval_millis += 500
538
- interval_millis = 1000 if interval_millis > 1000
563
+ @observability.record_operation(Observability::OP_QM_WATCH_INDEXES, options.parent_span, self, :query) do |obs_handler|
564
+ obs_handler.add_bucket_name(bucket_name)
565
+ obs_handler.add_scope_name(options.scope_name) unless options.scope_name.nil?
566
+ obs_handler.add_collection_name(options.collection_name) unless options.collection_name.nil?
567
+
568
+ index_names.append("#primary") if options.watch_primary
569
+
570
+ interval_millis = 50
571
+ deadline = Time.now + (Utils::Time.extract_duration(timeout) * 0.001)
572
+ all_online = false
573
+ while Time.now <= deadline
574
+ get_all_opts = Options::Query::GetAllIndexes.new(
575
+ timeout: ((deadline - Time.now) * 1000).round,
576
+ scope_name: options.scope_name,
577
+ collection_name: options.collection_name,
578
+ parent_span: obs_handler.op_span,
579
+ )
580
+ indexes = get_all_indexes(bucket_name, get_all_opts).select { |idx| index_names.include? idx.name }
581
+ indexes_not_found = index_names - indexes.map(&:name)
582
+ raise Error::IndexNotFound, "Failed to find the indexes: #{indexes_not_found.join(', ')}" unless indexes_not_found.empty?
583
+
584
+ all_online = indexes.all? { |idx| idx.state == :online }
585
+ break if all_online
586
+
587
+ sleep(interval_millis / 1000)
588
+ interval_millis += 500
589
+ interval_millis = 1000 if interval_millis > 1000
590
+ end
591
+ raise Error::UnambiguousTimeout, "Failed to find all indexes online within the allotted time" unless all_online
539
592
  end
540
- raise Error::UnambiguousTimeout, "Failed to find all indexes online within the allotted time"
541
593
  end
542
594
 
543
595
  # @api private
@@ -14,6 +14,8 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require_relative "search_index_manager"
18
+
17
19
  module Couchbase
18
20
  module Management
19
21
  class ScopeSearchIndexManager
@@ -22,179 +24,244 @@ module Couchbase
22
24
  # @param [Couchbase::Backend] backend
23
25
  # @param [String] bucket_name
24
26
  # @param [String] scope_name
25
- def initialize(backend, bucket_name, scope_name)
27
+ # @param [Couchbase::Observability::Wrapper] observability wrapper
28
+ def initialize(backend, bucket_name, scope_name, observability)
26
29
  @backend = backend
27
30
  @bucket_name = bucket_name
28
31
  @scope_name = scope_name
32
+ @observability = observability
29
33
  end
30
34
 
31
35
  # Fetches an index from the server if it exists
32
36
  #
33
37
  # @param [String] index_name name of the index
34
- # @param [GetIndexOptions] options
38
+ # @param [Options::Search::GetIndex] options
35
39
  #
36
40
  # @return [SearchIndex]
37
41
  #
38
42
  # @raise [ArgumentError]
39
43
  # @raise [Error::IndexNotFound]
40
- def get_index(index_name, options = GetIndexOptions.new)
41
- res = @backend.search_index_get(@bucket_name, @scope_name, index_name, options.timeout)
42
- SearchIndexManager.extract_search_index(res)
44
+ def get_index(index_name, options = Options::Search::GetIndex::DEFAULT)
45
+ @observability.record_operation(Observability::OP_SM_GET_INDEX, options.parent_span, self, :search) do |obs_handler|
46
+ res = @backend.search_index_get(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
47
+ SearchIndexManager.extract_search_index(res)
48
+ end
43
49
  end
44
50
 
45
51
  # Fetches all indexes from the server
46
52
  #
47
- # @param [GetAllIndexesOptions] options
53
+ # @param [Options::Search::GetAllIndexes] options
48
54
  #
49
55
  # @return [Array<SearchIndex>]
50
- def get_all_indexes(options = GetAllIndexesOptions.new)
51
- res = @backend.search_index_get_all(@bucket_name, @scope_name, options.timeout)
52
- res[:indexes].map { |idx| SearchIndexManager.extract_search_index(idx) }
56
+ def get_all_indexes(options = Options::Search::GetAllIndexes::DEFAULT)
57
+ @observability.record_operation(Observability::OP_SM_GET_ALL_INDEXES, options.parent_span, self, :search) do |obs_handler|
58
+ res = @backend.search_index_get_all(@bucket_name, @scope_name, options.timeout, obs_handler)
59
+ res[:indexes].map { |idx| SearchIndexManager.extract_search_index(idx) }
60
+ end
53
61
  end
54
62
 
55
63
  # Creates or updates the index
56
64
  #
57
65
  # @param [SearchIndex] index_definition the index definition
58
- # @param [UpsertIndexOptions] options
66
+ # @param [Options::Search::UpsertIndex] options
59
67
  #
60
68
  # @return void
61
69
  #
62
70
  # @raise [ArgumentError] if name, type or source_type is empty
63
- def upsert_index(index_definition, options = UpsertIndexOptions.new)
64
- @backend.search_index_upsert(@bucket_name, @scope_name, index_definition.to_backend, options.timeout)
71
+ def upsert_index(index_definition, options = Options::Search::UpsertIndex::DEFAULT)
72
+ @observability.record_operation(Observability::OP_SM_UPSERT_INDEX, options.parent_span, self, :search) do |obs_handler|
73
+ @backend.search_index_upsert(@bucket_name, @scope_name, index_definition.to_backend, options.timeout, obs_handler)
74
+ end
65
75
  end
66
76
 
67
77
  # Drops the index
68
78
  #
69
79
  # @param [String] index_name name of the index
70
- # @param [DropIndexOptions] options
80
+ # @param [Options::Search::DropIndex] options
71
81
  #
72
82
  # @return void
73
83
  #
74
84
  # @raise [ArgumentError]
75
85
  # @raise [Error::IndexNotFound]
76
- def drop_index(index_name, options = DropIndexOptions.new)
77
- @backend.search_index_drop(@bucket_name, @scope_name, index_name, options.timeout)
86
+ def drop_index(index_name, options = Options::Search::DropIndex::DEFAULT)
87
+ @observability.record_operation(Observability::OP_SM_DROP_INDEX, options.parent_span, self, :search) do |obs_handler|
88
+ @backend.search_index_drop(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
89
+ end
78
90
  end
79
91
 
80
92
  # Retrieves the number of documents that have been indexed for an index
81
93
  #
82
94
  # @param [String] index_name name of the index
83
- # @param [GetIndexedDocumentsCountOptions] options
95
+ # @param [Options::Search::GetIndexedDocumentsCount] options
84
96
  #
85
97
  # @return [Integer]
86
98
  #
87
99
  # @raise [ArgumentError]
88
100
  # @raise [Error::IndexNotFound]
89
- def get_indexed_documents_count(index_name, options = GetIndexedDocumentsCountOptions.new)
90
- res = @backend.search_index_get_documents_count(@bucket_name, @scope_name, index_name, options.timeout)
91
- res[:count]
101
+ def get_indexed_documents_count(index_name, options = Options::Search::GetIndexedDocumentsCount::DEFAULT)
102
+ @observability.record_operation(Observability::OP_SM_GET_INDEXED_DOCUMENTS_COUNT, options.parent_span, self,
103
+ :search) do |obs_handler|
104
+ res = @backend.search_index_get_documents_count(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
105
+ res[:count]
106
+ end
92
107
  end
93
108
 
94
109
  # Pauses updates and maintenance for the index
95
110
  #
96
111
  # @param [String] index_name name of the index
97
- # @param [PauseIngestOptions] options
112
+ # @param [Options::Search::PauseIngest] options
98
113
  #
99
114
  # @return void
100
115
  #
101
116
  # @raise [ArgumentError]
102
117
  # @raise [Error::IndexNotFound]
103
- def pause_ingest(index_name, options = PauseIngestOptions.new)
104
- @backend.search_index_pause_ingest(@bucket_name, @scope_name, index_name, options.timeout)
118
+ def pause_ingest(index_name, options = Options::Search::PauseIngest::DEFAULT)
119
+ @observability.record_operation(Observability::OP_SM_PAUSE_INGEST, options.parent_span, self, :search) do |obs_handler|
120
+ @backend.search_index_pause_ingest(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
121
+ end
105
122
  end
106
123
 
107
124
  # Resumes updates and maintenance for an index
108
125
  #
109
126
  # @param [String] index_name name of the index
110
- # @param [ResumeIngestOptions] options
127
+ # @param [Options::Search::ResumeIngest] options
111
128
  #
112
129
  # @return void
113
130
  #
114
131
  # @raise [ArgumentError]
115
132
  # @raise [Error::IndexNotFound]
116
- def resume_ingest(index_name, options = ResumeIngestOptions.new)
117
- @backend.search_index_resume_ingest(@bucket_name, @scope_name, index_name, options.timeout)
133
+ def resume_ingest(index_name, options = Options::Search::ResumeIngest::DEFAULT)
134
+ @observability.record_operation(Observability::OP_SM_RESUME_INGEST, options.parent_span, self, :search) do |obs_handler|
135
+ @backend.search_index_resume_ingest(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
136
+ end
118
137
  end
119
138
 
120
139
  # Allows querying against the index
121
140
  #
122
141
  # @param [String] index_name name of the index
123
- # @param [AllowQueryingOptions] options
142
+ # @param [Options::Search::AllowQuerying] options
124
143
  #
125
144
  # @return void
126
145
  #
127
146
  # @raise [ArgumentError]
128
147
  # @raise [Error::IndexNotFound]
129
- def allow_querying(index_name, options = AllowQueryingOptions.new)
130
- @backend.search_index_allow_querying(@bucket_name, @scope_name, index_name, options.timeout)
148
+ def allow_querying(index_name, options = Options::Search::AllowQuerying::DEFAULT)
149
+ @observability.record_operation(Observability::OP_SM_ALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
150
+ @backend.search_index_allow_querying(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
151
+ end
131
152
  end
132
153
 
133
154
  # Disallows querying against the index
134
155
  #
135
156
  # @param [String] index_name name of the index
136
- # @param [DisallowQueryingOptions] options
157
+ # @param [Options::Search::DisallowQuerying] options
137
158
  #
138
159
  # @return void
139
160
  #
140
161
  # @raise [ArgumentError]
141
162
  # @raise [Error::IndexNotFound]
142
- def disallow_querying(index_name, options = DisallowQueryingOptions.new)
143
- @backend.search_index_disallow_querying(@bucket_name, @scope_name, index_name, options.timeout)
163
+ def disallow_querying(index_name, options = Options::Search::DisallowQuerying::DEFAULT)
164
+ @observability.record_operation(Observability::OP_SM_DISALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
165
+ @backend.search_index_disallow_querying(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
166
+ end
144
167
  end
145
168
 
146
169
  # Freeze the assignment of index partitions to nodes
147
170
  #
148
171
  # @param [String] index_name name of the index
149
- # @param [FreezePlanOptions] options
172
+ # @param [Options::Search::FreezePlan] options
150
173
  #
151
174
  # @return void
152
175
  #
153
176
  # @raise [ArgumentError]
154
177
  # @raise [Error::IndexNotFound]
155
- def freeze_plan(index_name, options = FreezePlanOptions.new)
156
- @backend.search_index_freeze_plan(@bucket_name, @scope_name, index_name, options.timeout)
178
+ def freeze_plan(index_name, options = Options::Search::FreezePlan::DEFAULT)
179
+ @observability.record_operation(Observability::OP_SM_FREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
180
+ @backend.search_index_freeze_plan(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
181
+ end
157
182
  end
158
183
 
159
184
  # Unfreeze the assignment of index partitions to nodes
160
185
  #
161
186
  # @param [String] index_name name of the index
162
- # @param [UnfreezePlanOptions] options
187
+ # @param [Options::Search::UnfreezePlan] options
163
188
  #
164
189
  # @return void
165
190
  #
166
191
  # @raise [ArgumentError]
167
192
  # @raise [Error::IndexNotFound]
168
- def unfreeze_plan(index_name, options = UnfreezePlanOptions.new)
169
- @backend.search_index_unfreeze_plan(@bucket_name, @scope_name, index_name, options.timeout)
193
+ def unfreeze_plan(index_name, options = Options::Search::UnfreezePlan::DEFAULT)
194
+ @observability.record_operation(Observability::OP_SM_UNFREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
195
+ @backend.search_index_unfreeze_plan(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
196
+ end
170
197
  end
171
198
 
172
199
  # Allows to see how a document is analyzed against a specific index
173
200
  #
174
201
  # @param [String] index_name name of the index
175
202
  # @param [Hash] document the document to be analyzed
203
+ # @param [Options::Search::AnalyzeDocument] options
176
204
  #
177
205
  # @return [Array<Hash>]
178
206
  #
179
207
  # @raise [ArgumentError]
180
208
  # @raise [Error::IndexNotFound]
181
- def analyze_document(index_name, document, options = AnalyzeDocumentOptions.new)
182
- res = @backend.search_index_analyze_document(@bucket_name, @scope_name, index_name, JSON.generate(document), options.timeout)
183
- JSON.parse(res[:analysis])
209
+ def analyze_document(index_name, document, options = Options::Search::AnalyzeDocument::DEFAULT)
210
+ @observability.record_operation(Observability::OP_SM_ANALYZE_DOCUMENT, options.parent_span, self, :search) do |obs_handler|
211
+ res = @backend.search_index_analyze_document(
212
+ @bucket_name, @scope_name, index_name, JSON.generate(document), options.timeout, obs_handler
213
+ )
214
+ JSON.parse(res[:analysis])
215
+ end
184
216
  end
185
217
 
186
- GetIndexOptions = SearchIndexManager::GetIndexOptions
187
- GetAllIndexesOptions = SearchIndexManager::GetAllIndexesOptions
188
- UpsertIndexOptions = SearchIndexManager::UpsertIndexOptions
189
- DropIndexOptions = SearchIndexManager::DropIndexOptions
190
- GetIndexedDocumentsCountOptions = SearchIndexManager::GetIndexedDocumentsCountOptions
191
- PauseIngestOptions = SearchIndexManager::PauseIngestOptions
192
- ResumeIngestOptions = SearchIndexManager::ResumeIngestOptions
193
- AllowQueryingOptions = SearchIndexManager::AllowQueryingOptions
194
- DisallowQueryingOptions = SearchIndexManager::DisallowQueryingOptions
195
- FreezePlanOptions = SearchIndexManager::FreezePlanOptions
196
- UnfreezePlanOptions = SearchIndexManager::UnfreezePlanOptions
197
- AnalyzeDocumentOptions = SearchIndexManager::AnalyzeDocumentOptions
218
+ # @api private
219
+ # @deprecated use {Options::Search::GetIndex} instead
220
+ GetIndexOptions = Options::Search::GetIndex
221
+
222
+ # @api private
223
+ # @deprecated use {Options::Search::GetAllIndexes} instead
224
+ GetAllIndexesOptions = Options::Search::GetAllIndexes
225
+
226
+ # @api private
227
+ # @deprecated use {Options::Search::UpsertIndex} instead
228
+ UpsertIndexOptions = Options::Search::UpsertIndex
229
+
230
+ # @api private
231
+ # @deprecated use {Options::Search::DropIndex} instead
232
+ DropIndexOptions = Options::Search::DropIndex
233
+
234
+ # @api private
235
+ # @deprecated use {Options::Search::GetIndexedDocumentsCount} instead
236
+ GetIndexedDocumentsCountOptions = Options::Search::GetIndexedDocumentsCount
237
+
238
+ # @api private
239
+ # @deprecated use {Options::Search::PauseIngest} instead
240
+ PauseIngestOptions = Options::Search::PauseIngest
241
+
242
+ # @api private
243
+ # @deprecated use {Options::Search::ResumeIngest} instead
244
+ ResumeIngestOptions = Options::Search::ResumeIngest
245
+
246
+ # @api private
247
+ # @deprecated use {Options::Search::AllowQuerying} instead
248
+ AllowQueryingOptions = Options::Search::AllowQuerying
249
+
250
+ # @api private
251
+ # @deprecated use {Options::Search::DisallowQuerying} instead
252
+ DisallowQueryingOptions = Options::Search::DisallowQuerying
253
+
254
+ # @api private
255
+ # @deprecated use {Options::Search::FreezePlan} instead
256
+ FreezePlanOptions = Options::Search::FreezePlan
257
+
258
+ # @api private
259
+ # @deprecated use {Options::Search::UnfreezePlan} instead
260
+ UnfreezePlanOptions = Options::Search::UnfreezePlan
261
+
262
+ # @api private
263
+ # @deprecated use {Options::Search::AnalyzeDocument} instead
264
+ AnalyzeDocumentOptions = Options::Search::AnalyzeDocument
198
265
  end
199
266
  end
200
267
  end