Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: rpc latency (#16744)

Danny Xu87250c464aa2
diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.go
index 2b60d48623..f7a0e48902 100644
--- a/backend/api/v1/audit.go
+++ b/backend/api/v1/audit.go
@@ -5,12 +5,14 @@ import (
"log/slog"
"net/http"
"reflect"
+ "time"
"connectrpc.com/connect"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/types/known/anypb"
+ "google.golang.org/protobuf/types/known/durationpb"
"github.com/pkg/errors"
"google.golang.org/grpc/status"
@@ -47,14 +49,16 @@ func (in *AuditInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc
serviceData = a
})
+ startTime := time.Now()
response, rerr := next(ctx, req)
+ latency := time.Since(startTime)
if needAudit(ctx) {
var respMsg any
if !common.IsNil(response) {
respMsg = response.Any()
}
- if err := createAuditLogConnect(ctx, req.Any(), respMsg, req.Spec().Procedure, in.store, serviceData, rerr, req.Header()); err != nil {
+ if err := createAuditLogConnect(ctx, req.Any(), respMsg, req.Spec().Procedure, in.store, serviceData, rerr, req.Header(), latency); err != nil {
slog.Warn("audit interceptor: failed to create audit log", log.BBError(err), slog.String("method", req.Spec().Procedure))
}
}
@@ -93,6 +97,7 @@ type auditConnectStreamingConn struct {
ctx context.Context
method string
curRequest any
+ startTime time.Time
}
func (c *auditConnectStreamingConn) Receive(msg any) error {
@@ -100,8 +105,9 @@ func (c *auditConnectStreamingConn) Receive(msg any) error {
if err != nil {
return err
}
- // Store current request for audit log
+ // Store current request for audit log and start time
c.curRequest = msg
+ c.startTime = time.Now()
return nil
}
@@ -112,14 +118,15 @@ func (c *auditConnectStreamingConn) Send(resp any) error {
}
// Create audit log for each message pair
if c.curRequest != nil {
- if auditErr := createAuditLogConnect(c.ctx, c.curRequest, resp, c.method, c.interceptor.store, nil, nil, c.RequestHeader()); auditErr != nil {
+ latency := time.Since(c.startTime)
+ if auditErr := createAuditLogConnect(c.ctx, c.curRequest, resp, c.method, c.interceptor.store, nil, nil, c.RequestHeader(), latency); auditErr != nil {
return auditErr
}
}
return nil
}
-func createAuditLogConnect(ctx context.Context, request, response any, method string, storage *store.Store, serviceData *anypb.Any, rerr error, headers http.Header) error {
+func createAuditLogConnect(ctx context.Context, request, response any, method string, storage *store.Store, serviceData *anypb.Any, rerr error, headers http.Header, latency time.Duration) error {
requestString, err := getRequestString(request)
if err != nil {
return errors.Wrapf(err, "failed to get request string")
@@ -172,6 +179,7 @@ func createAuditLogConnect(ctx context.Context, request, response any, method st
Request: requestString,
Response: responseString,
Status: st.Proto(),
+ Latency: durationpb.New(latency),
ServiceData: serviceData,
RequestMetadata: requestMetadata,
}
diff --git a/frontend/src/types/proto-es/v1/audit_log_service_pb.d.ts b/frontend/src/types/proto-es/v1/audit_log_service_pb.d.ts
index d351a91580..52a81f8439 100644
--- a/frontend/src/types/proto-es/v1/audit_log_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/audit_log_service_pb.d.ts
@@ -5,7 +5,7 @@
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
import type { ExportFormat } from "./common_pb";
-import type { Any, Timestamp } from "@bufbuild/protobuf/wkt";
+import type { Any, Duration, Timestamp } from "@bufbuild/protobuf/wkt";
import type { Status } from "../google/rpc/status_pb";
import type { PolicyDelta } from "./iam_policy_pb";
@@ -254,17 +254,24 @@ export declare type AuditLog = Message<"bytebase.v1.AuditLog"> & {
*/
status?: Status;
+ /**
+ * The latency of the RPC.
+ *
+ * @generated from field: google.protobuf.Duration latency = 10;
+ */
+ latency?: Duration;
+
/**
* service-specific data about the request, response, and other activities.
*
- * @generated from field: google.protobuf.Any service_data = 10;
+ * @generated from field: google.protobuf.Any service_data = 11;
*/
serviceData?: Any;
/**
* Metadata about the operation.
*
- * @generated from field: bytebase.v1.RequestMetadata request_metadata = 11;
+ * @generated from field: bytebase.v1.RequestMetadata request_metadata = 12;
*/
requestMetadata?: RequestMetadata;
};
diff --git a/frontend/src/types/proto-es/v1/audit_log_service_pb.js b/frontend/src/types/proto-es/v1/audit_log_service_pb.js
index e24d1d8375..b0f34478b2 100644
--- a/frontend/src/types/proto-es/v1/audit_log_service_pb.js
+++ b/frontend/src/types/proto-es/v1/audit_log_service_pb.js
@@ -6,7 +6,7 @@ import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/
import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
import { file_google_api_resource } from "../google/api/resource_pb";
-import { file_google_protobuf_any, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
+import { file_google_protobuf_any, file_google_protobuf_duration, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
import { file_google_rpc_status } from "../google/rpc/status_pb";
import { file_v1_annotation } from "./annotation_pb";
import { file_v1_common } from "./common_pb";
@@ -16,7 +16,7 @@ import { file_v1_iam_policy } from "./iam_policy_pb";
* Describes the file v1/audit_log_service.proto.
*/
export const file_v1_audit_log_service = /*@__PURE__*/
- fileDesc("Chp2MS9hdWRpdF9sb2dfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEikQEKFlNlYXJjaEF1ZGl0TG9nc1JlcXVlc3QSLgoGcGFyZW50GAUgASgJQh7iQQEC+kEXEhVieXRlYmFzZS5jb20vQXVkaXRMb2cSDgoGZmlsdGVyGAEgASgJEhAKCG9yZGVyX2J5GAIgASgJEhEKCXBhZ2Vfc2l6ZRgDIAEoBRISCgpwYWdlX3Rva2VuGAQgASgJIl0KF1NlYXJjaEF1ZGl0TG9nc1Jlc3BvbnNlEikKCmF1ZGl0X2xvZ3MYASADKAsyFS5ieXRlYmFzZS52MS5BdWRpdExvZxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkivAEKFkV4cG9ydEF1ZGl0TG9nc1JlcXVl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GVyX2lwGAEgASgJEiIKGmNhbGxlcl9zdXBwbGllZF91c2VyX2FnZW50GAIgASgJMqUDCg9BdWRpdExvZ1NlcnZpY2USxwEKD1NlYXJjaEF1ZGl0TG9ncxIjLmJ5dGViYXNlLnYxLlNlYXJjaEF1ZGl0TG9nc1JlcXVlc3QaJC5ieXRlYmFzZS52MS5TZWFyY2hBdWRpdExvZ3NSZXNwb25zZSJpiuowE2JiLmF1ZGl0TG9ncy5zZWFyY2iQ6jABgtPkkwJIOgEqWhk6ASoiFC92MS9hdWRpdExvZ3M6c2VhcmNoIigvdjEve3BhcmVudD1wcm9qZWN0cy8qfS9hdWRpdExvZ3M6c2VhcmNoEscBCg9FeHBvcnRBdWRpdExvZ3MSIy5ieXRlYmFzZS52MS5FeHBvcnRBdWRpdExvZ3NSZXF1ZXN0GiQuYnl0ZWJhc2UudjEuRXhwb3J0QXVkaXRMb2dzUmVzcG9uc2UiaYrqMBNiYi5hdWRpdExvZ3MuZXhwb3J0kOowAYLT5JMCSDoBKloZOgEqIhQvdjEvYXVkaXRMb2dzOmV4cG9ydCIoL3YxL3twYXJlbnQ9cHJvamVjdHMvKn0vYXVkaXRMb2dzOmV4cG9ydEI0WjJnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL3Byb3RvL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_any, file_google_protobuf_timestamp, file_google_rpc_status, file_v1_annotation, file_v1_common, file_v1_iam_policy]);
+ fileDesc("Chp2MS9hdWRpdF9sb2dfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEikQEKFlNlYXJjaEF1ZGl0TG9nc1JlcXVlc3QSLgoGcGFyZW50GAUgASgJQh7iQQEC+kEXEhVieXRlYmFzZS5jb20vQXVkaXRMb2cSDgoGZmlsdGVyGAEgASgJEhAKCG9yZGVyX2J5GAIgASgJEhEKCXBhZ2Vfc2l6ZRgDIAEoBRISCgpwYWdl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ggKBElORk8QAhIKCgZOT1RJQ0UQAxILCgdXQVJOSU5HEAQSCQoFRVJST1IQBRIMCghDUklUSUNBTBAGEgkKBUFMRVJUEAcSDQoJRU1FUkdFTkNZEAgiOwoJQXVkaXREYXRhEi4KDHBvbGljeV9kZWx0YRgBIAEoCzIYLmJ5dGViYXNlLnYxLlBvbGljeURlbHRhIkgKD1JlcXVlc3RNZXRhZGF0YRIRCgljYWxsZXJfaXAYASABKAkSIgoaY2FsbGVyX3N1cHBsaWVkX3VzZXJfYWdlbnQYAiABKAkypQMKD0F1ZGl0TG9nU2VydmljZRLHAQoPU2VhcmNoQXVkaXRMb2dzEiMuYnl0ZWJhc2UudjEuU2VhcmNoQXVkaXRMb2dzUmVxdWVzdBokLmJ5dGViYXNlLnYxLlNlYXJjaEF1ZGl0TG9nc1Jlc3BvbnNlImmK6jATYmIuYXVkaXRMb2dzLnNlYXJjaJDqMAGC0+STAkg6ASpaGToBKiIUL3YxL2F1ZGl0TG9nczpzZWFyY2giKC92MS97cGFyZW50PXByb2plY3RzLyp9L2F1ZGl0TG9nczpzZWFyY2gSxwEKD0V4cG9ydEF1ZGl0TG9ncxIjLmJ5dGViYXNlLnYxLkV4cG9ydEF1ZGl0TG9nc1JlcXVlc3QaJC5ieXRlYmFzZS52MS5FeHBvcnRBdWRpdExvZ3NSZXNwb25zZSJpiuowE2JiLmF1ZGl0TG9ncy5leHBvcnSQ6jABgtPkkwJIOgEqWhk6ASoiFC92MS9hdWRpdExvZ3M6ZXhwb3J0IigvdjEve3BhcmVudD1wcm9qZWN0cy8qfS9hdWRpdExvZ3M6ZXhwb3J0QjRaMmdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvcHJvdG8vZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_any, file_google_protobuf_duration, file_google_protobuf_timestamp, file_google_rpc_status, file_v1_annotation, file_v1_common, file_v1_iam_policy]);
/**
* Describes the message bytebase.v1.SearchAuditLogsRequest.
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
index 9d8c207966..02e367cdee 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
@@ -1238,8 +1238,8 @@ export declare type SQLQueryRestrictionSetting = Message<"bytebase.v1.SQLQueryRe
maximumResultSize: bigint;
/**
- * The return rows limit.
- * The default value is -1, means no limit.
+ * The return rows limit. If the value <= 0, will be treated as no limit.
+ * The default value is -1.
*
* @generated from field: int32 maximum_result_rows = 2;
*/
diff --git a/frontend/src/types/proto/v1/audit_log_service.ts b/frontend/src/types/proto/v1/audit_log_service.ts
index a75c2065d4..8b174914f7 100644
--- a/frontend/src/types/proto/v1/audit_log_service.ts
+++ b/frontend/src/types/proto/v1/audit_log_service.ts
@@ -8,6 +8,7 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
import { Any } from "../google/protobuf/any";
+import { Duration } from "../google/protobuf/duration";
import { Timestamp } from "../google/protobuf/timestamp";
import { Status } from "../google/rpc/status";
import { ExportFormat, exportFormatFromJSON, exportFormatToJSON, exportFormatToNumber } from "./common";
@@ -135,6 +136,10 @@ export interface AuditLog {
status:
| Status
| undefined;
+ /** The latency of the RPC. */
+ latency:
+ | Duration
+ | undefined;
/** service-specific data about the request, response, and other activities. */
serviceData:
| Any
@@ -688,6 +693,7 @@ function createBaseAuditLog(): AuditLog {
request: "",
response: "",
status: undefined,
+ latency: undefined,
serviceData: undefined,
requestMetadata: undefined,
};
@@ -722,11 +728,14 @@ export const AuditLog: MessageFns<AuditLog> = {
if (message.status !== undefined) {
Status.encode(message.status, writer.uint32(74).fork()).join();
}
+ if (message.latency !== undefined) {
+ Duration.encode(message.latency, writer.uint32(82).fork()).join();
+ }
if (message.serviceData !== undefined) {
- Any.encode(message.serviceData, writer.uint32(82).fork()).join();
+ Any.encode(message.serviceData, writer.uint32(90).fork()).join();
}
if (message.requestMetadata !== undefined) {
- RequestMetadata.encode(message.requestMetadata, writer.uint32(90).fork()).join();
+ RequestMetadata.encode(message.requestMetadata, writer.uint32(98).fork()).join();
}
return writer;
},
@@ -815,7 +824,7 @@ export const AuditLog: MessageFns<AuditLog> = {
break;
}
- message.serviceData = Any.decode(reader, reader.uint32());
+ message.latency = Duration.decode(reader, reader.uint32());
continue;
}
case 11: {
@@ -823,6 +832,14 @@ export const AuditLog: MessageFns<AuditLog> = {
break;
}
+ message.serviceData = Any.decode(reader, reader.uint32());
+ continue;
+ }
+ case 12: {
+ if (tag !== 98) {
+ break;
+ }
+
message.requestMetadata = RequestMetadata.decode(reader, reader.uint32());
continue;
}
@@ -846,6 +863,7 @@ export const AuditLog: MessageFns<AuditLog> = {
request: isSet(object.request) ? globalThis.String(object.request) : "",
response: isSet(object.response) ? globalThis.String(object.response) : "",
status: isSet(object.status) ? Status.fromJSON(object.status) : undefined,
+ latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined,
serviceData: isSet(object.serviceData) ? Any.fromJSON(object.serviceData) : undefined,
requestMetadata: isSet(object.requestMetadata) ? RequestMetadata.fromJSON(object.requestMetadata) : undefined,
};
@@ -880,6 +898,9 @@ export const AuditLog: MessageFns<AuditLog> = {
if (message.status !== undefined) {
obj.status = Status.toJSON(message.status);
}
+ if (message.latency !== undefined) {
+ obj.latency = Duration.toJSON(message.latency);
+ }
if (message.serviceData !== undefined) {
obj.serviceData = Any.toJSON(message.serviceData);
}
@@ -907,6 +928,9 @@ export const AuditLog: MessageFns<AuditLog> = {
message.status = (object.status !== undefined && object.status !== null)
? Status.fromPartial(object.status)
: undefined;
+ message.latency = (object.latency !== undefined && object.latency !== null)
+ ? Duration.fromPartial(object.latency)
+ : undefined;
message.serviceData = (object.serviceData !== undefined && object.serviceData !== null)
? Any.fromPartial(object.serviceData)
: undefined;
diff --git a/frontend/src/types/proto/v1/setting_service.ts b/frontend/src/types/proto/v1/setting_service.ts
index c2b88629e3..311fd41f8d 100644
--- a/frontend/src/types/proto/v1/setting_service.ts
+++ b/frontend/src/types/proto/v1/setting_service.ts
@@ -689,8 +689,8 @@ export interface SQLQueryRestrictionSetting {
*/
maximumResultSize: Long;
/**
- * The return rows limit.
- * The default value is -1, means no limit.
+ * The return rows limit. If the value <= 0, will be treated as no limit.
+ * The default value is -1.
*/
maximumResultRows: number;
}
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 453b190c9f..ecef344115 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -8482,6 +8482,10 @@ components:
Some fields are omitted because they are too large or contain sensitive information.
status:
$ref: '#/components/schemas/Status'
+ latency:
+ pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
+ type: string
+ description: The latency of the RPC.
serviceData:
allOf:
- $ref: '#/components/schemas/GoogleProtobufAny'
@@ -12693,8 +12697,8 @@ components:
maximumResultRows:
type: integer
description: |-
- The return rows limit.
- The default value is -1, means no limit.
+ The return rows limit. If the value <= 0, will be treated as no limit.
+ The default value is -1.
format: int32
SQLReviewRule:
type: object
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 7ece0e328e..5b4f0566cf 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -734,6 +734,7 @@ ANY means approving any node will proceed.
| request | [string](#string) | | Marshalled request. |
| response | [string](#string) | | Marshalled response. Some fields are omitted because they are too large or contain sensitive information. |
| status | [google.rpc.Status](#google-rpc-Status) | | |
+| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The latency of the RPC. |
| service_data | [google.protobuf.Any](#google-protobuf-Any) | | service-specific data about the request, response, and other activities. |
| request_metadata | [RequestMetadata](#bytebase-store-RequestMetadata) | | Metadata about the operation. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index d29553b51e..149753f023 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -2466,6 +2466,13 @@ Some fields are omitted because they are too large or contain sensitive informat
<td><p> </p></td>
</tr>
+ <tr>
+ <td>latency</td>
+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
+ <td></td>
+ <td><p>The latency of the RPC. </p></td>
+ </tr>
+
<tr>
<td>service_data</td>
<td><a href="#google.protobuf.Any">google.protobuf.Any</a></td>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 36b0ba215e..116bec2bf8 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -4452,7 +4452,7 @@ When paginating, all other parameters provided to `ListSettings` must match the
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| maximum_result_size | [int64](#int64) | | The size limit in bytes. The default value is 100MB, we will use the default value if the setting not exists, or the limit &lt;= 0. |
-| maximum_result_rows | [int32](#int32) | | The return rows limit. The default value is -1, means no limit. |
+| maximum_result_rows | [int32](#int32) | | The return rows limit. If the value &lt;= 0, will be treated as no limit. The default value is -1. |
@@ -5357,6 +5357,7 @@ The type of action performed on a Binding in a policy.
| request | [string](#string) | | JSON-encoded request. |
| response | [string](#string) | | JSON-encoded response. Some fields are omitted because they are too large or contain sensitive information. |
| status | [google.rpc.Status](#google-rpc-Status) | | |
+| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The latency of the RPC. |
| service_data | [google.protobuf.Any](#google-protobuf-Any) | | service-specific data about the request, response, and other activities. |
| request_metadata | [RequestMetadata](#bytebase-v1-RequestMetadata) | | Metadata about the operation. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index aa00030b88..f692d0e5f5 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -13018,8 +13018,8 @@ The default value is 100MB, we will use the default value if the setting not exi
<td>maximum_result_rows</td>
<td><a href="#int32">int32</a></td>
<td></td>
- <td><p>The return rows limit.
-The default value is -1, means no limit. </p></td>
+ <td><p>The return rows limit. If the value &lt;= 0, will be treated as no limit.
+The default value is -1. </p></td>
</tr>
</tbody>
@@ -15436,6 +15436,13 @@ Some fields are omitted because they are too large or contain sensitive informat
<td><p> </p></td>
</tr>
+ <tr>
+ <td>latency</td>
+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
+ <td></td>
+ <td><p>The latency of the RPC. </p></td>
+ </tr>
+
<tr>
<td>service_data</td>
<td><a href="#google.protobuf.Any">google.protobuf.Any</a></td>
diff --git a/proto/generated-go/store/audit_log.pb.go b/proto/generated-go/store/audit_log.pb.go
index e089b2153f..1d55bffbe6 100644
--- a/proto/generated-go/store/audit_log.pb.go
+++ b/proto/generated-go/store/audit_log.pb.go
@@ -11,6 +11,7 @@ import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
@@ -111,6 +112,8 @@ type AuditLog struct {
// Some fields are omitted because they are too large or contain sensitive information.
Response string `protobuf:"bytes,7,opt,name=response,proto3" json:"response,omitempty"`
Status *status.Status `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"`
+ // The latency of the RPC.
+ Latency *durationpb.Duration `protobuf:"bytes,9,opt,name=latency,proto3" json:"latency,omitempty"`
// service-specific data about the request, response, and other activities.
ServiceData *anypb.Any `protobuf:"bytes,10,opt,name=service_data,json=serviceData,proto3" json:"service_data,omitempty"`
// Metadata about the operation.
@@ -205,6 +208,13 @@ func (x *AuditLog) GetStatus() *status.Status {
return nil
}
+func (x *AuditLog) GetLatency() *durationpb.Duration {
+ if x != nil {
+ return x.Latency
+ }
+ return nil
+}
+
func (x *AuditLog) GetServiceData() *anypb.Any {
if x != nil {
return x.ServiceData
@@ -279,7 +289,7 @@ var File_store_audit_log_proto protoreflect.FileDescriptor
const file_store_audit_log_proto_rawDesc = "" +
"\n" +
- "\x15store/audit_log.proto\x12\x0ebytebase.store\x1a\x19google/protobuf/any.proto\x1a\x17google/rpc/status.proto\"\x8a\x04\n" +
+ "\x15store/audit_log.proto\x12\x0ebytebase.store\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x17google/rpc/status.proto\"\xbf\x04\n" +
"\bAuditLog\x12\x16\n" +
"\x06parent\x18\x01 \x01(\tR\x06parent\x12\x16\n" +
"\x06method\x18\x02 \x01(\tR\x06method\x12\x1a\n" +
@@ -288,7 +298,8 @@ const file_store_audit_log_proto_rawDesc = "" +
"\bseverity\x18\x05 \x01(\x0e2!.bytebase.store.AuditLog.SeverityR\bseverity\x12\x18\n" +
"\arequest\x18\x06 \x01(\tR\arequest\x12\x1a\n" +
"\bresponse\x18\a \x01(\tR\bresponse\x12*\n" +
- "\x06status\x18\b \x01(\v2\x12.google.rpc.StatusR\x06status\x127\n" +
+ "\x06status\x18\b \x01(\v2\x12.google.rpc.StatusR\x06status\x123\n" +
+ "\alatency\x18\t \x01(\v2\x19.google.protobuf.DurationR\alatency\x127\n" +
"\fservice_data\x18\n" +
" \x01(\v2\x14.google.protobuf.AnyR\vserviceData\x12J\n" +
"\x10request_metadata\x18\v \x01(\v2\x1f.bytebase.store.RequestMetadataR\x0frequestMetadata\"x\n" +
@@ -322,22 +333,24 @@ func file_store_audit_log_proto_rawDescGZIP() []byte {
var file_store_audit_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_store_audit_log_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_store_audit_log_proto_goTypes = []any{
- (AuditLog_Severity)(0), // 0: bytebase.store.AuditLog.Severity
- (*AuditLog)(nil), // 1: bytebase.store.AuditLog
- (*RequestMetadata)(nil), // 2: bytebase.store.RequestMetadata
- (*status.Status)(nil), // 3: google.rpc.Status
- (*anypb.Any)(nil), // 4: google.protobuf.Any
+ (AuditLog_Severity)(0), // 0: bytebase.store.AuditLog.Severity
+ (*AuditLog)(nil), // 1: bytebase.store.AuditLog
+ (*RequestMetadata)(nil), // 2: bytebase.store.RequestMetadata
+ (*status.Status)(nil), // 3: google.rpc.Status
+ (*durationpb.Duration)(nil), // 4: google.protobuf.Duration
+ (*anypb.Any)(nil), // 5: google.protobuf.Any
}
var file_store_audit_log_proto_depIdxs = []int32{
0, // 0: bytebase.store.AuditLog.severity:type_name -> bytebase.store.AuditLog.Severity
3, // 1: bytebase.store.AuditLog.status:type_name -> google.rpc.Status
- 4, // 2: bytebase.store.AuditLog.service_data:type_name -> google.protobuf.Any
- 2, // 3: bytebase.store.AuditLog.request_metadata:type_name -> bytebase.store.RequestMetadata
- 4, // [4:4] is the sub-list for method output_type
- 4, // [4:4] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
+ 4, // 2: bytebase.store.AuditLog.latency:type_name -> google.protobuf.Duration
+ 5, // 3: bytebase.store.AuditLog.service_data:type_name -> google.protobuf.Any
+ 2, // 4: bytebase.store.AuditLog.request_metadata:type_name -> bytebase.store.RequestMetadata
+ 5, // [5:5] is the sub-list for method output_type
+ 5, // [5:5] is the sub-list for method input_type
+ 5, // [5:5] is the sub-list for extension type_name
+ 5, // [5:5] is the sub-list for extension extendee
+ 0, // [0:5] is the sub-list for field type_name
}
func init() { file_store_audit_log_proto_init() }
diff --git a/proto/generated-go/v1/audit_log_service.pb.go b/proto/generated-go/v1/audit_log_service.pb.go
index a16e63d577..0d1721060b 100644
--- a/proto/generated-go/v1/audit_log_service.pb.go
+++ b/proto/generated-go/v1/audit_log_service.pb.go
@@ -12,6 +12,7 @@ import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
@@ -422,10 +423,12 @@ type AuditLog struct {
// Some fields are omitted because they are too large or contain sensitive information.
Response string `protobuf:"bytes,8,opt,name=response,proto3" json:"response,omitempty"`
Status *status.Status `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"`
+ // The latency of the RPC.
+ Latency *durationpb.Duration `protobuf:"bytes,10,opt,name=latency,proto3" json:"latency,omitempty"`
// service-specific data about the request, response, and other activities.
- ServiceData *anypb.Any `protobuf:"bytes,10,opt,name=service_data,json=serviceData,proto3" json:"service_data,omitempty"`
+ ServiceData *anypb.Any `protobuf:"bytes,11,opt,name=service_data,json=serviceData,proto3" json:"service_data,omitempty"`
// Metadata about the operation.
- RequestMetadata *RequestMetadata `protobuf:"bytes,11,opt,name=request_metadata,json=requestMetadata,proto3" json:"request_metadata,omitempty"`
+ RequestMetadata *RequestMetadata `protobuf:"bytes,12,opt,name=request_metadata,json=requestMetadata,proto3" json:"request_metadata,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -523,6 +526,13 @@ func (x *AuditLog) GetStatus() *status.Status {
return nil
}
+func (x *AuditLog) GetLatency() *durationpb.Duration {
+ if x != nil {
+ return x.Latency
+ }
+ return nil
+}
+
func (x *AuditLog) GetServiceData() *anypb.Any {
if x != nil {
return x.ServiceData
@@ -641,7 +651,7 @@ var File_v1_audit_log_service_proto protoreflect.FileDescriptor
const file_v1_audit_log_service_proto_rawDesc = "" +
"\n" +
- "\x1av1/audit_log_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x13v1/iam_policy.proto\"\xbf\x01\n" +
+ "\x1av1/audit_log_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x13v1/iam_policy.proto\"\xbf\x01\n" +
"\x16SearchAuditLogsRequest\x126\n" +
"\x06parent\x18\x05 \x01(\tB\x1e\xe2A\x01\x02\xfaA\x17\x12\x15bytebase.com/AuditLogR\x06parent\x12\x16\n" +
"\x06filter\x18\x01 \x01(\tR\x06filter\x12\x19\n" +
@@ -663,7 +673,7 @@ const file_v1_audit_log_service_proto_rawDesc = "" +
"page_token\x18\x06 \x01(\tR\tpageToken\"[\n" +
"\x17ExportAuditLogsResponse\x12\x18\n" +
"\acontent\x18\x01 \x01(\fR\acontent\x12&\n" +
- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xc9\x04\n" +
+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xfe\x04\n" +
"\bAuditLog\x12\x18\n" +
"\x04name\x18\x01 \x01(\tB\x04\xe2A\x01\x03R\x04name\x12A\n" +
"\vcreate_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" +
@@ -674,10 +684,11 @@ const file_v1_audit_log_service_proto_rawDesc = "" +
"\bresource\x18\x06 \x01(\tR\bresource\x12\x18\n" +
"\arequest\x18\a \x01(\tR\arequest\x12\x1a\n" +
"\bresponse\x18\b \x01(\tR\bresponse\x12*\n" +
- "\x06status\x18\t \x01(\v2\x12.google.rpc.StatusR\x06status\x127\n" +
- "\fservice_data\x18\n" +
- " \x01(\v2\x14.google.protobuf.AnyR\vserviceData\x12G\n" +
- "\x10request_metadata\x18\v \x01(\v2\x1c.bytebase.v1.RequestMetadataR\x0frequestMetadata\"x\n" +
+ "\x06status\x18\t \x01(\v2\x12.google.rpc.StatusR\x06status\x123\n" +
+ "\alatency\x18\n" +
+ " \x01(\v2\x19.google.protobuf.DurationR\alatency\x127\n" +
+ "\fservice_data\x18\v \x01(\v2\x14.google.protobuf.AnyR\vserviceData\x12G\n" +
+ "\x10request_metadata\x18\f \x01(\v2\x1c.bytebase.v1.RequestMetadataR\x0frequestMetadata\"x\n" +
"\bSeverity\x12\v\n" +
"\aDEFAULT\x10\x00\x12\t\n" +
"\x05DEBUG\x10\x01\x12\b\n" +
@@ -724,8 +735,9 @@ var file_v1_audit_log_service_proto_goTypes = []any{
(ExportFormat)(0), // 8: bytebase.v1.ExportFormat
(*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
(*status.Status)(nil), // 10: google.rpc.Status
- (*anypb.Any)(nil), // 11: google.protobuf.Any
- (*PolicyDelta)(nil), // 12: bytebase.v1.PolicyDelta
+ (*durationpb.Duration)(nil), // 11: google.protobuf.Duration
+ (*anypb.Any)(nil), // 12: google.protobuf.Any
+ (*PolicyDelta)(nil), // 13: bytebase.v1.PolicyDelta
}
var file_v1_audit_log_service_proto_depIdxs = []int32{
5, // 0: bytebase.v1.SearchAuditLogsResponse.audit_logs:type_name -> bytebase.v1.AuditLog
@@ -733,18 +745,19 @@ var file_v1_audit_log_service_proto_depIdxs = []int32{
9, // 2: bytebase.v1.AuditLog.create_time:type_name -> google.protobuf.Timestamp
0, // 3: bytebase.v1.AuditLog.severity:type_name -> bytebase.v1.AuditLog.Severity
10, // 4: bytebase.v1.AuditLog.status:type_name -> google.rpc.Status
- 11, // 5: bytebase.v1.AuditLog.service_data:type_name -> google.protobuf.Any
- 7, // 6: bytebase.v1.AuditLog.request_metadata:type_name -> bytebase.v1.RequestMetadata
- 12, // 7: bytebase.v1.AuditData.policy_delta:type_name -> bytebase.v1.PolicyDelta
- 1, // 8: bytebase.v1.AuditLogService.SearchAuditLogs:input_type -> bytebase.v1.SearchAuditLogsRequest
- 3, // 9: bytebase.v1.AuditLogService.ExportAuditLogs:input_type -> bytebase.v1.ExportAuditLogsRequest
- 2, // 10: bytebase.v1.AuditLogService.SearchAuditLogs:output_type -> bytebase.v1.SearchAuditLogsResponse
- 4, // 11: bytebase.v1.AuditLogService.ExportAuditLogs:output_type -> bytebase.v1.ExportAuditLogsResponse
- 10, // [10:12] is the sub-list for method output_type
- 8, // [8:10] is the sub-list for method input_type
- 8, // [8:8] is the sub-list for extension type_name
- 8, // [8:8] is the sub-list for extension extendee
- 0, // [0:8] is the sub-list for field type_name
+ 11, // 5: bytebase.v1.AuditLog.latency:type_name -> google.protobuf.Duration
+ 12, // 6: bytebase.v1.AuditLog.service_data:type_name -> google.protobuf.Any
+ 7, // 7: bytebase.v1.AuditLog.request_metadata:type_name -> bytebase.v1.RequestMetadata
+ 13, // 8: bytebase.v1.AuditData.policy_delta:type_name -> bytebase.v1.PolicyDelta
+ 1, // 9: bytebase.v1.AuditLogService.SearchAuditLogs:input_type -> bytebase.v1.SearchAuditLogsRequest
+ 3, // 10: bytebase.v1.AuditLogService.ExportAuditLogs:input_type -> bytebase.v1.ExportAuditLogsRequest
+ 2, // 11: bytebase.v1.AuditLogService.SearchAuditLogs:output_type -> bytebase.v1.SearchAuditLogsResponse
+ 4, // 12: bytebase.v1.AuditLogService.ExportAuditLogs:output_type -> bytebase.v1.ExportAuditLogsResponse
+ 11, // [11:13] is the sub-list for method output_type
+ 9, // [9:11] is the sub-list for method input_type
+ 9, // [9:9] is the sub-list for extension type_name
+ 9, // [9:9] is the sub-list for extension extendee
+ 0, // [0:9] is the sub-list for field type_name
}
func init() { file_v1_audit_log_service_proto_init() }
diff --git a/proto/generated-go/v1/setting_service.pb.go b/proto/generated-go/v1/setting_service.pb.go
index 0b435b59dd..b892d47a37 100644
--- a/proto/generated-go/v1/setting_service.pb.go
+++ b/proto/generated-go/v1/setting_service.pb.go
@@ -1490,8 +1490,8 @@ type SQLQueryRestrictionSetting struct {
// The size limit in bytes.
// The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.
MaximumResultSize int64 `protobuf:"varint,1,opt,name=maximum_result_size,json=maximumResultSize,proto3" json:"maximum_result_size,omitempty"`
- // The return rows limit.
- // The default value is -1, means no limit.
+ // The return rows limit. If the value <= 0, will be treated as no limit.
+ // The default value is -1.
MaximumResultRows int32 `protobuf:"varint,2,opt,name=maximum_result_rows,json=maximumResultRows,proto3" json:"maximum_result_rows,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
diff --git a/proto/store/store/audit_log.proto b/proto/store/store/audit_log.proto
index 5ef6b8bdb3..92c50a1a7f 100644
--- a/proto/store/store/audit_log.proto
+++ b/proto/store/store/audit_log.proto
@@ -3,6 +3,7 @@ syntax = "proto3";
package bytebase.store;
import "google/protobuf/any.proto";
+import "google/protobuf/duration.proto";
import "google/rpc/status.proto";
option go_package = "generated-go/store";
@@ -35,6 +36,9 @@ message AuditLog {
google.rpc.Status status = 8;
+ // The latency of the RPC.
+ google.protobuf.Duration latency = 9;
+
// service-specific data about the request, response, and other activities.
google.protobuf.Any service_data = 10;
diff --git a/proto/v1/v1/audit_log_service.proto b/proto/v1/v1/audit_log_service.proto
index abe5645b81..c4c6714605 100644
--- a/proto/v1/v1/audit_log_service.proto
+++ b/proto/v1/v1/audit_log_service.proto
@@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/any.proto";
+import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
import "v1/annotation.proto";
@@ -162,11 +163,14 @@ message AuditLog {
google.rpc.Status status = 9;
+ // The latency of the RPC.
+ google.protobuf.Duration latency = 10;
+
// service-specific data about the request, response, and other activities.
- google.protobuf.Any service_data = 10;
+ google.protobuf.Any service_data = 11;
// Metadata about the operation.
- RequestMetadata request_metadata = 11;
+ RequestMetadata request_metadata = 12;
enum Severity {
DEFAULT = 0;