aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2023-03-24 16:47:07 +0300
committerhcpp <hcpp@ydb.tech>2023-03-24 16:47:07 +0300
commit0f069e47d7e56ada4522f5399165b4480807c26f (patch)
tree810a34f57abcf6fe4d5443e8acae335050c8932b
parent387c914d75e04773da90dcf623982a47909c19d2 (diff)
downloadydb-0f069e47d7e56ada4522f5399165b4480807c26f.tar.gz
event_time has been fixed
-rw-r--r--ydb/core/fq/libs/cloud_audit/yq_cloud_audit_service.cpp32
1 files changed, 4 insertions, 28 deletions
diff --git a/ydb/core/fq/libs/cloud_audit/yq_cloud_audit_service.cpp b/ydb/core/fq/libs/cloud_audit/yq_cloud_audit_service.cpp
index 8f1abb96f9..8d951e177b 100644
--- a/ydb/core/fq/libs/cloud_audit/yq_cloud_audit_service.cpp
+++ b/ydb/core/fq/libs/cloud_audit/yq_cloud_audit_service.cpp
@@ -24,6 +24,7 @@
#include <contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h>
#include <google/protobuf/util/json_util.h>
+#include <google/protobuf/util/time_util.h>
namespace {
@@ -238,7 +239,7 @@ public:
FillRequestMetadata(*CloudEvent.mutable_request_metadata(), ExtraInfo, Request);
FillRequestParameters(Request);
- FillEventMetadata(Details);
+ FillEventMetadata();
FillDetails(Details);
FillResponse(CloudEvent, Issues);
@@ -300,33 +301,8 @@ private:
*CloudEvent.mutable_request_parameters() = PrepareRequestParameters(request);
}
- template<typename T>
- void FillEventMetadata(TAuditDetails<T>& details) {
- google::protobuf::Timestamp createdAt;
- if (details.Before) {
- createdAt = details.Before->meta().common().created_at();
- } else if (details.After) {
- createdAt = details.After->meta().common().created_at();
- } else {
- auto now = TInstant::Now();
- createdAt.set_seconds(now.Seconds());
- createdAt.set_nanos(now.NanoSeconds() % 1000000000);
- }
- FillEventMetadataImpl(createdAt);
- }
-
- template<typename T> requires requires (T t) { t.meta().created_at(); }
- void FillEventMetadata(TAuditDetails<T>& details) {
- google::protobuf::Timestamp createdAt;
- if (details.Before) {
- createdAt = details.Before->meta().created_at();
- } else if (details.After) {
- createdAt = details.After->meta().created_at();
- } else {
- auto now = TInstant::Now();
- createdAt.set_seconds(now.Seconds());
- createdAt.set_nanos(now.NanoSeconds() % 1000000000);
- }
+ void FillEventMetadata() {
+ const auto createdAt = google::protobuf::util::TimeUtil::MillisecondsToTimestamp(TInstant::Now().MilliSeconds());
FillEventMetadataImpl(createdAt);
}