From b7cf06db9da37093666ae5cc21d280da589b2ec1 Mon Sep 17 00:00:00 2001 From: Vanja Pejovic Date: Thu, 19 Dec 2024 13:02:18 -0500 Subject: [PATCH] Add action mnemonic to clickhouse I expect this to add less than 1% to write throughput. --- .../remote_execution/execution_server/execution_server.go | 1 + .../execution_server/execution_server_test.go | 4 ++++ proto/remote_execution.proto | 3 ++- server/util/clickhouse/clickhouse.go | 1 + server/util/clickhouse/schema/schema.go | 4 +++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/enterprise/server/remote_execution/execution_server/execution_server.go b/enterprise/server/remote_execution/execution_server/execution_server.go index 829c5b5ad9d..d25b9025a3e 100644 --- a/enterprise/server/remote_execution/execution_server/execution_server.go +++ b/enterprise/server/remote_execution/execution_server/execution_server.go @@ -361,6 +361,7 @@ func (s *ExecutionServer) recordExecution(ctx context.Context, executionID strin executionProto := execution.TableExecToProto(&executionPrimaryDB, link) // Set fields that aren't stored in the primary DB executionProto.TargetLabel = rmd.GetTargetId() + executionProto.ActionMnemonic = rmd.GetActionMnemonic() executionProto.DiskBytesRead = md.GetUsageStats().GetCgroupIoStats().GetRbytes() executionProto.DiskBytesWritten = md.GetUsageStats().GetCgroupIoStats().GetWbytes() executionProto.DiskWriteOperations = md.GetUsageStats().GetCgroupIoStats().GetWios() diff --git a/enterprise/server/remote_execution/execution_server/execution_server_test.go b/enterprise/server/remote_execution/execution_server/execution_server_test.go index 4f4cd2d040a..b522d4643d9 100644 --- a/enterprise/server/remote_execution/execution_server/execution_server_test.go +++ b/enterprise/server/remote_execution/execution_server/execution_server_test.go @@ -372,6 +372,8 @@ func testExecuteAndPublishOperation(t *testing.T, test publishTest) { // Schedule execution clientCtx, err := bazel_request.WithRequestMetadata(ctx, &repb.RequestMetadata{ ToolInvocationId: invocationID, + TargetId: "//some:test", + ActionMnemonic: "TestRunner", }) require.NoError(t, err) for k, v := range test.platformOverrides { @@ -534,6 +536,8 @@ func testExecuteAndPublishOperation(t *testing.T, test publishTest) { RequestedMemoryBytes: 2000, RequestedMilliCpu: 1500, RequestedIsolationType: "oci", + TargetLabel: "//some:test", + ActionMnemonic: "TestRunner", } if test.publishMoreMetadata { expectedExecution.ExecutionPriority = 999 diff --git a/proto/remote_execution.proto b/proto/remote_execution.proto index e272d5d9e75..482dabaa93d 100644 --- a/proto/remote_execution.proto +++ b/proto/remote_execution.proto @@ -2460,6 +2460,7 @@ message StoredExecution { string output_path = 31; string status_message = 32; - // TODO(sluongng): add mnemonic and configuration. + // TODO(sluongng): add configuration. string target_label = 33; + string action_mnemonic = 57; } diff --git a/server/util/clickhouse/clickhouse.go b/server/util/clickhouse/clickhouse.go index 867863265ac..cd2d41554d1 100644 --- a/server/util/clickhouse/clickhouse.go +++ b/server/util/clickhouse/clickhouse.go @@ -259,6 +259,7 @@ func buildExecution(in *repb.StoredExecution, inv *sipb.StoredInvocation) *schem InvocationStatus: inv.GetInvocationStatus(), Tags: invocation_format.ConvertDBTagsToOLAP(inv.GetTags()), TargetLabel: in.GetTargetLabel(), + ActionMnemonic: in.GetActionMnemonic(), } } diff --git a/server/util/clickhouse/schema/schema.go b/server/util/clickhouse/schema/schema.go index 43d34e89145..87fd3b99d4a 100644 --- a/server/util/clickhouse/schema/schema.go +++ b/server/util/clickhouse/schema/schema.go @@ -160,7 +160,8 @@ type Execution struct { Stage int64 // RequestMetadata - TargetLabel string + TargetLabel string + ActionMnemonic string // IOStats FileDownloadCount int64 @@ -268,6 +269,7 @@ func (e *Execution) AdditionalFields() []string { "Tags", "OutputPath", "TargetLabel", + "ActionMnemonic", "DiskBytesRead", "DiskBytesWritten", "DiskReadOperations",