Skip to content

Commit

Permalink
CXXCBC-611 & CXXCBC-612: Follow RFC naming for metric operation names (
Browse files Browse the repository at this point in the history
  • Loading branch information
DemetrisChr authored Nov 14, 2024
1 parent 8bf1445 commit a797847
Show file tree
Hide file tree
Showing 104 changed files with 238 additions and 33 deletions.
2 changes: 2 additions & 0 deletions core/impl/get_replica.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ struct get_replica_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::get_replica_response_body>;

static const inline std::string observability_identifier = "get_replica";

core::document_id id;
std::optional<std::chrono::milliseconds> timeout{};
std::uint16_t partition{};
Expand Down
2 changes: 2 additions & 0 deletions core/impl/lookup_in_replica.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct lookup_in_replica_request {
using encoded_response_type =
protocol::client_response<protocol::lookup_in_replica_response_body>;

static const inline std::string observability_identifier = "lookup_in_replica";

document_id id;
std::vector<couchbase::core::impl::subdoc::command> specs{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
2 changes: 2 additions & 0 deletions core/impl/observe_seqno.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct observe_seqno_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::observe_seqno_response_body>;

static const inline std::string observability_identifier = "observe_seqno";

core::document_id id;
bool active{};
std::uint64_t partition_uuid{};
Expand Down
4 changes: 2 additions & 2 deletions core/io/http_command.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ private:
}
if (self->meter_) {
metrics::metric_attributes attrs{
service_type::key_value,
fmt::format("{}", self->encoded.path),
self->request.type,
self->request.observability_identifier,
ec,
};
self->meter_->record_value(std::move(attrs), start);
Expand Down
2 changes: 1 addition & 1 deletion core/io/mcbp_command.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
std::optional<key_value_error_map_info> /* error_info */) mutable {
metrics::metric_attributes attrs{
service_type::key_value,
fmt::format("{}", encoded_request_type::body_type::opcode),
self->request.observability_identifier,
ec,
self->request.id.bucket(),
self->request.id.scope(),
Expand Down
1 change: 1 addition & 0 deletions core/operations/document_analytics.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct analytics_request {
using error_context_type = error_context::analytics;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "analytics";

std::string statement;

Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_append.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct append_request {
using encoded_request_type = protocol::client_request<protocol::append_request_body>;
using encoded_response_type = protocol::client_response<protocol::append_response_body>;

static const inline std::string observability_identifier = "append";

document_id id;
std::vector<std::byte> value;
std::uint16_t partition{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_decrement.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct decrement_request {
using encoded_request_type = protocol::client_request<protocol::decrement_request_body>;
using encoded_response_type = protocol::client_response<protocol::decrement_response_body>;

static const inline std::string observability_identifier = "decrement";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_exists.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct exists_request {
using encoded_request_type = protocol::client_request<protocol::get_meta_request_body>;
using encoded_response_type = protocol::client_response<protocol::get_meta_response_body>;

static const inline std::string observability_identifier = "exists";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ struct get_request {
using encoded_request_type = protocol::client_request<protocol::get_request_body>;
using encoded_response_type = protocol::client_response<protocol::get_response_body>;

static const inline std::string observability_identifier = "get";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get_all_replicas.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct get_all_replicas_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::get_replica_response_body>;

static const inline std::string observability_identifier = "get_all_replicas";

core::document_id id;
std::optional<std::chrono::milliseconds> timeout{};
couchbase::read_preference read_preference{ couchbase::read_preference::no_preference };
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get_and_lock.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ struct get_and_lock_request {
using encoded_request_type = protocol::client_request<protocol::get_and_lock_request_body>;
using encoded_response_type = protocol::client_response<protocol::get_and_lock_response_body>;

static const inline std::string observability_identifier = "get_and_lock";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get_and_touch.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct get_and_touch_request {
using encoded_request_type = protocol::client_request<protocol::get_and_touch_request_body>;
using encoded_response_type = protocol::client_response<protocol::get_and_touch_response_body>;

static const inline std::string observability_identifier = "get_and_touch";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get_any_replica.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ struct get_any_replica_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::get_replica_response_body>;

static const inline std::string observability_identifier = "get_any_replica";

core::document_id id;
std::optional<std::chrono::milliseconds> timeout{};
couchbase::read_preference read_preference{ couchbase::read_preference::no_preference };
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_get_projected.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct get_projected_request {
using encoded_request_type = protocol::client_request<protocol::lookup_in_request_body>;
using encoded_response_type = protocol::client_response<protocol::lookup_in_response_body>;

static const inline std::string observability_identifier = "get";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_increment.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct increment_request {
using encoded_request_type = protocol::client_request<protocol::increment_request_body>;
using encoded_response_type = protocol::client_response<protocol::increment_response_body>;

static const inline std::string observability_identifier = "increment";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_insert.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct insert_request {
using encoded_request_type = protocol::client_request<protocol::insert_request_body>;
using encoded_response_type = protocol::client_response<protocol::insert_response_body>;

static const inline std::string observability_identifier = "insert";

document_id id;
std::vector<std::byte> value;
std::uint16_t partition{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_lookup_in.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ struct lookup_in_request {
using encoded_request_type = protocol::client_request<protocol::lookup_in_request_body>;
using encoded_response_type = protocol::client_response<protocol::lookup_in_response_body>;

static const inline std::string observability_identifier = "lookup_in";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_lookup_in_all_replicas.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct lookup_in_all_replicas_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::lookup_in_replica_response_body>;

static const inline std::string observability_identifier = "lookup_in_all_replicas";

core::document_id id;
std::vector<couchbase::core::impl::subdoc::command> specs{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_lookup_in_any_replica.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ struct lookup_in_any_replica_request {
using encoded_response_type =
core::protocol::client_response<core::protocol::lookup_in_replica_response_body>;

static const inline std::string observability_identifier = "lookup_in_any_replica";

core::document_id id;
std::vector<couchbase::core::impl::subdoc::command> specs{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_mutate_in.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ struct mutate_in_request {
using encoded_request_type = protocol::client_request<protocol::mutate_in_request_body>;
using encoded_response_type = protocol::client_response<protocol::mutate_in_response_body>;

static const inline std::string observability_identifier = "mutate_in";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_prepend.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct prepend_request {
using encoded_request_type = protocol::client_request<protocol::prepend_request_body>;
using encoded_response_type = protocol::client_response<protocol::prepend_response_body>;

static const inline std::string observability_identifier = "prepend";

document_id id;
std::vector<std::byte> value;
std::uint16_t partition{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/document_query.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct query_request {
using error_context_type = error_context::query;

static const inline service_type type = service_type::query;
static const inline std::string observability_identifier = "query";

std::string statement;

Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_remove.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct remove_request {
using encoded_request_type = protocol::client_request<protocol::remove_request_body>;
using encoded_response_type = protocol::client_response<protocol::remove_response_body>;

static const inline std::string observability_identifier = "remove";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_replace.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct replace_request {
using encoded_request_type = protocol::client_request<protocol::replace_request_body>;
using encoded_response_type = protocol::client_response<protocol::replace_response_body>;

static const inline std::string observability_identifier = "replace";

document_id id;
std::vector<std::byte> value;
std::uint16_t partition{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/document_search.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct search_request {
using error_context_type = error_context::search;

static const inline service_type type = service_type::search;
static const inline std::string observability_identifier = "search";

std::string index_name;
couchbase::core::json_string query;
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_touch.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ struct touch_request {
using encoded_request_type = protocol::client_request<protocol::touch_request_body>;
using encoded_response_type = protocol::client_response<protocol::touch_response_body>;

static const inline std::string observability_identifier = "touch";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_unlock.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ struct unlock_request {
using encoded_request_type = protocol::client_request<protocol::unlock_request_body>;
using encoded_response_type = protocol::client_response<protocol::unlock_response_body>;

static const inline std::string observability_identifier = "unlock";

document_id id;
std::uint16_t partition{};
std::uint32_t opaque{};
Expand Down
2 changes: 2 additions & 0 deletions core/operations/document_upsert.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct upsert_request {
using encoded_request_type = protocol::client_request<protocol::upsert_request_body>;
using encoded_response_type = protocol::client_response<protocol::upsert_response_body>;

static const inline std::string observability_identifier = "upsert";

document_id id;
std::vector<std::byte> value;
std::uint16_t partition{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/document_view.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct document_view_request {
using error_context_type = error_context::view;

static const inline service_type type = service_type::view;
static const inline std::string observability_identifier = "views";

std::string bucket_name;
std::string document_name;
Expand Down
2 changes: 2 additions & 0 deletions core/operations/http_noop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ struct http_noop_request {
using encoded_response_type = io::http_response;
using error_context_type = error_context::http;

static const inline std::string observability_identifier = "noop";

service_type type{};

std::optional<std::string> client_context_id{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_dataset_create.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_dataset_create_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_create_dataset";

std::string dataverse_name{ "Default" };
std::string dataset_name;
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_dataset_drop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_dataset_drop_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_drop_dataset";

std::string dataverse_name{ "Default" };
std::string dataset_name;
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_dataset_get_all.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct analytics_dataset_get_all_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_get_all_datasets";

std::optional<std::string> client_context_id{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_dataverse_create.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_dataverse_create_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_create_dataverse";

std::string dataverse_name;

Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_dataverse_drop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_dataverse_drop_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_drop_dataverse";

std::string dataverse_name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct analytics_get_pending_mutations_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier =
"manager_analytics_get_pending_mutations";

std::optional<std::string> client_context_id{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_index_create.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_index_create_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_create_index";

std::string dataverse_name{ "Default" };
std::string dataset_name;
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_index_drop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct analytics_index_drop_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_drop_index";

std::string dataverse_name{ "Default" };
std::string dataset_name;
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_index_get_all.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct analytics_index_get_all_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_get_all_indexes";

std::optional<std::string> client_context_id{};
std::optional<std::chrono::milliseconds> timeout{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_connect.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct analytics_link_connect_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_connect_link";

std::string dataverse_name{ "Default" };
std::string link_name{ "Local" };
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_create.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct analytics_link_create_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_create_link";

analytics_link_type link{};
std::optional<std::string> client_context_id{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_disconnect.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct analytics_link_disconnect_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_disconnect_link";

std::string dataverse_name{ "Default" };
std::string link_name{ "Local" };
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_drop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct analytics_link_drop_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_drop_link";

std::string link_name{};
std::string dataverse_name{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_get_all.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct analytics_link_get_all_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_get_links";

std::optional<std::string> link_type{};
std::optional<std::string> link_name{};
Expand Down
1 change: 1 addition & 0 deletions core/operations/management/analytics_link_replace.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct analytics_link_replace_request {
using error_context_type = error_context::http;

static const inline service_type type = service_type::analytics;
static const inline std::string observability_identifier = "manager_analytics_replace_link";

analytics_link_type link{};

Expand Down
Loading

0 comments on commit a797847

Please sign in to comment.