comparison Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 447:5881e4af5799 pg-transactions

measure DB latency
author Alain Mazy <am@osimis.io>
date Mon, 15 Jan 2024 18:27:20 +0100
parents cec6a0cd399f
children f0976163dbe1
comparison
equal deleted inserted replaced
446:9e039e65d68e 447:5881e4af5799
431 response.mutable_get_system_information()->set_supports_flush_to_disk(false); 431 response.mutable_get_system_information()->set_supports_flush_to_disk(false);
432 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport()); 432 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport());
433 response.mutable_get_system_information()->set_supports_labels(accessor.GetBackend().HasLabelsSupport()); 433 response.mutable_get_system_information()->set_supports_labels(accessor.GetBackend().HasLabelsSupport());
434 response.mutable_get_system_information()->set_supports_increment_global_property(accessor.GetBackend().HasAtomicIncrementGlobalProperty()); 434 response.mutable_get_system_information()->set_supports_increment_global_property(accessor.GetBackend().HasAtomicIncrementGlobalProperty());
435 response.mutable_get_system_information()->set_has_update_and_get_statistics(accessor.GetBackend().HasUpdateAndGetStatistics()); 435 response.mutable_get_system_information()->set_has_update_and_get_statistics(accessor.GetBackend().HasUpdateAndGetStatistics());
436 response.mutable_get_system_information()->set_has_measure_latency(accessor.GetBackend().HasMeasureLatency());
436 break; 437 break;
437 } 438 }
438 439
439 case Orthanc::DatabasePluginMessages::OPERATION_OPEN: 440 case Orthanc::DatabasePluginMessages::OPERATION_OPEN:
440 { 441 {
514 delete transaction; 515 delete transaction;
515 } 516 }
516 517
517 break; 518 break;
518 } 519 }
519 520
521 case Orthanc::DatabasePluginMessages::OPERATION_MEASURE_LATENCY:
522 {
523 IndexConnectionsPool::Accessor accessor(pool);
524 response.mutable_measure_latency()->set_latency_us(accessor.GetBackend().MeasureLatency(accessor.GetManager()));
525 break;
526 }
527
520 default: 528 default:
521 LOG(ERROR) << "Not implemented database operation from protobuf: " << request.operation(); 529 LOG(ERROR) << "Not implemented database operation from protobuf: " << request.operation();
522 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 530 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
523 } 531 }
524 } 532 }