@@ -85,11 +85,13 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
8585 if (request.durability_level != durability_level::none &&
8686 timeout_ < durability_timeout_floor) {
8787 CB_LOG_DEBUG (
88- R"( Timeout is too low for operation with durability, increasing to sensible value. timeout={}ms, floor={}ms, id="{}")" ,
89- request.id ,
90- timeout_.count (),
91- durability_timeout_floor.count (),
92- id_);
88+ " timeout is too low for operation with durability, increasing to sensible value" ,
89+ opentelemetry::common::MakeAttributes ({
90+ { " document_id" , fmt::format (" {}" , request.id ) },
91+ { " operation_id" , id_ },
92+ { " timeout" , fmt::format (" {}" , timeout_) },
93+ { " floor" , fmt::format (" {}" , durability_timeout_floor) },
94+ }));
9395 timeout_ = durability_timeout_floor;
9496 }
9597 }
@@ -154,13 +156,14 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
154156 if (ec == errc::common::unambiguous_timeout || ec == errc::common::ambiguous_timeout) {
155157 telemetry_recorder->update_counter (app_telemetry_counter::kv_r_timedout);
156158 auto time_left = deadline.expiry () - std::chrono::steady_clock::now ();
157- CB_LOG_TRACE (R"( [{}] timeout operation id="{}", {}, key="{}", partition={}, time_left={})" ,
158- session_ ? session_->log_prefix () : manager_->log_prefix (),
159- id_,
160- encoded_request_type::body_type::opcode,
161- request.id ,
162- request.partition ,
163- time_left);
159+ CB_LOG_TRACE (" timeout operation" ,
160+ opentelemetry::common::MakeAttributes ({
161+ { " log_prefix" , session_ ? session_->log_prefix () : manager_->log_prefix () },
162+ { " operation_id" , id_ },
163+ { " opcode" , fmt::format (" {}" , encoded_request_type::body_type::opcode) },
164+ { " partition" , request.partition },
165+ { " time_left" , fmt::format (" {}" , time_left) },
166+ }));
164167 } else if (ec == errc::common::request_canceled) {
165168 telemetry_recorder->update_counter (app_telemetry_counter::kv_r_canceled);
166169 }
@@ -208,11 +211,13 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
208211 {
209212 auto backoff = std::chrono::milliseconds (500 );
210213 auto time_left = deadline.expiry () - std::chrono::steady_clock::now ();
211- CB_LOG_DEBUG (R"( {} unknown collection response for "{}", time_left={}ms, id="{}")" ,
212- session_->log_prefix (),
213- request.id ,
214- std::chrono::duration_cast<std::chrono::milliseconds>(time_left).count (),
215- id_);
214+ CB_LOG_DEBUG (" unknown collection response" ,
215+ opentelemetry::common::MakeAttributes ({
216+ { " log_prefix" , session_->log_prefix () },
217+ { " document_id" , fmt::format (" {}" , request.id ) },
218+ { " time_left" , fmt::format (" {}" , time_left) },
219+ { " operation_id" , id_ },
220+ }));
216221 request.retries .add_reason (retry_reason::key_value_collection_outdated);
217222 if (time_left < backoff) {
218223 return invoke_handler (make_error_code (request.retries .idempotent ()
@@ -241,12 +246,13 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
241246 if (collection_id) {
242247 request.id .collection_uid (collection_id.value ());
243248 } else {
244- CB_LOG_DEBUG (
245- R"( {} no cache entry for collection, resolve collection id for "{}", timeout={}ms, id="{}")" ,
246- session_->log_prefix (),
247- request.id ,
248- timeout_.count (),
249- id_);
249+ CB_LOG_DEBUG (" no cache entry for collection, resolve collection id" ,
250+ opentelemetry::common::MakeAttributes ({
251+ { " log_prefix" , session_->log_prefix () },
252+ { " document_id" , fmt::format (" {}" , request.id ) },
253+ { " timeout" , fmt::format (" {}" , timeout_) },
254+ { " operation_id" , id_ },
255+ }));
250256 return request_collection_id ();
251257 }
252258 } else {
@@ -347,13 +353,13 @@ struct mcbp_command : public std::enable_shared_from_this<mcbp_command<Manager,
347353 return self->handle_unknown_collection ();
348354 }
349355 if (status == key_value_status_code::config_only) {
350- CB_LOG_DEBUG (" {} server returned status 0x{:02x} ({}) meaning that the node does not "
351- " serve data operations, "
352- " requesting new "
353- " configuration and retrying " ,
354- self-> session_ -> log_prefix () ,
355- msg. header . status () ,
356- status );
356+ CB_LOG_DEBUG (" server returned status {status} meaning that the node does not serve data "
357+ " operations, requesting new configuration and retrying " ,
358+ opentelemetry::common::MakeAttributes ({
359+ { " log_prefix " , self-> session_ -> log_prefix () } ,
360+ { " status " , fmt::format ( " 0x{:02x} " , msg. header . status ()) } ,
361+ { " status_text " , fmt::format ( " {} " , status) } ,
362+ }) );
357363 self->manager_ ->fetch_config ();
358364 return io::retry_orchestrator::maybe_retry (
359365 self->manager_ , self, retry_reason::service_response_code_indicated, ec);
0 commit comments