Skip to content

Commit e2d7c0c

Browse files
committed
CXXCBC-756: Move metric instrumentation points to Public API
1 parent 3c3deeb commit e2d7c0c

26 files changed

+1287
-1155
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ set(couchbase_cxx_client_FILES
213213
core/impl/view_error_category.cxx
214214
core/impl/wildcard_query.cxx
215215
core/impl/crypto.cxx
216+
core/impl/observability_recorder.cxx
216217
core/io/config_tracker.cxx
217218
core/io/dns_client.cxx
218219
core/io/dns_config.cxx

core/bucket.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ class bucket_impl
119119
std::optional<key_value_error_map_info> error_info)
120120
{
121121
// TODO(SA): copy from mcbp_command, subject to refactor later
122+
#ifdef COUCHBASE_CXX_CLIENT_CREATE_OPERATION_SPAN_IN_CORE
122123
metrics::metric_attributes attrs{
123124
service_type::key_value, fmt::format("{}", req->command_), ec, name_, req->scope_name_,
124125
req->collection_name_,
125126
};
126127
meter_->record_value(std::move(attrs), req->dispatched_time_);
128+
#endif
127129

128130
if (ec == asio::error::operation_aborted) {
129131
// TODO(SA): fix tracing

core/cluster.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,11 @@ class cluster_impl : public std::enable_shared_from_this<cluster_impl>
12661266
return tracer_;
12671267
}
12681268

1269+
auto meter() const -> const std::shared_ptr<metrics::meter_wrapper>&
1270+
{
1271+
return meter_;
1272+
}
1273+
12691274
private:
12701275
void setup_observability()
12711276
{
@@ -2474,4 +2479,10 @@ cluster::tracer() const -> const std::shared_ptr<tracing::tracer_wrapper>&
24742479
return impl_->tracer();
24752480
}
24762481

2482+
auto
2483+
cluster::meter() const -> const std::shared_ptr<metrics::meter_wrapper>&
2484+
{
2485+
return impl_->meter();
2486+
}
2487+
24772488
} // namespace couchbase::core

core/cluster.hxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ namespace tracing
4444
class tracer_wrapper;
4545
} // namespace tracing
4646

47+
namespace metrics
48+
{
49+
class meter_wrapper;
50+
} // namespace metrics
51+
4752
namespace mcbp
4853
{
4954
class queue_request;
@@ -331,6 +336,7 @@ public:
331336
[[nodiscard]] auto to_string() const -> std::string;
332337

333338
[[nodiscard]] auto tracer() const -> const std::shared_ptr<tracing::tracer_wrapper>&;
339+
[[nodiscard]] auto meter() const -> const std::shared_ptr<metrics::meter_wrapper>&;
334340

335341
private:
336342
std::shared_ptr<cluster_impl> impl_;

0 commit comments

Comments
 (0)