Skip to content

Commit

Permalink
Add correlated_invocations_id rewrapper flag
Browse files Browse the repository at this point in the history
Add the correlated_invocations_id as an rewrapper flag (SDK support already merged).

GitOrigin-RevId: 5eaeaf8764193878aec59d6571ea974e1db6765f
  • Loading branch information
ywmei-brt1 authored and copybara-github committed Jul 30, 2024
1 parent fe45758 commit b5a1e03
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions cmd/rewrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func initFlags() {
flag.StringVar(&serverAddr, "server_address", "", "The server address in the format of host:port for network, or unix:///file for unix domain sockets.")
flag.StringVar(&cOpts.CommandID, "command_id", "", "An identifier for the command for use in future debugging")
flag.StringVar(&cOpts.InvocationID, "invocation_id", "", "An identifier for a group of commands for use in future debugging")
flag.StringVar(&cOpts.CorrelatedInvocationsID, "correlated_invocations_id", "", "An optional id to use to tie multiple invocations together.")
flag.StringVar(&cOpts.ToolName, "tool_name", "", "The name of the tool to associate with executed commands")
flag.Var((*moreflag.StringMapValue)(&cOpts.Labels), "labels", "Comma-separated key value pairs in the form key=value. This is used to identify the type of command to help the proxy make decisions regarding remote execution. Defaults to type=tool.")
flag.StringVar(&cOpts.ExecRoot, "exec_root", "", "The exec root of the command. The path from which all inputs and outputs are defined relatively. Defaults to current working directory.")
Expand Down
4 changes: 4 additions & 0 deletions docs/cmd-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ An identifier to place in the command to aid in debugging.

An identifier for a group of commands to aid in debugging.

**`-correlated_invocations_id (string)`**

An identifier to tie multiple invocations together.

**`-tool_name (string)`**

The name of the tool to associate with executed commands.
Expand Down
11 changes: 6 additions & 5 deletions internal/pkg/bigquerytranslator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ func TestItemSave(t *testing.T) {
LogRecord: &lpb.LogRecord{
Command: &cpb.Command{
Identifiers: &cpb.Identifiers{
CommandId: "a",
InvocationId: "b",
ToolName: "c",
ExecutionId: "d",
CommandId: "a",
InvocationId: "b",
CorrelatedInvocationsId: "build-bucket-id",
ToolName: "c",
ExecutionId: "d",
},
Args: []string{"a", "b", "c"},
ExecRoot: "/exec/root",
Expand Down Expand Up @@ -94,7 +95,7 @@ func TestItemSave(t *testing.T) {
"identifiers": map[string]bigquery.Value{
"command_id": "a",
"invocation_id": "b",
"correlated_invocations_id": "",
"correlated_invocations_id": "build-bucket-id",
"tool_name": "c",
"tool_version": "",
"execution_id": "d",
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/rewrapper/rewrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"time"

"github.com/bazelbuild/reclient/internal/pkg/rsp"

"github.com/bazelbuild/remote-apis-sdks/go/pkg/command"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/retry"

Expand Down Expand Up @@ -71,6 +70,7 @@ type Proxy interface {
type CommandOptions struct {
CommandID string
InvocationID string
CorrelatedInvocationsID string
ToolName string
Labels map[string]string
ExecRoot string
Expand Down Expand Up @@ -148,9 +148,10 @@ func createRequest(cmd []string, opts *CommandOptions) (*ppb.RunRequest, error)
}
c := &cpb.Command{
Identifiers: &cpb.Identifiers{
CommandId: opts.CommandID,
InvocationId: opts.InvocationID,
ToolName: opts.ToolName,
CommandId: opts.CommandID,
InvocationId: opts.InvocationID,
CorrelatedInvocationsId: opts.CorrelatedInvocationsID,
ToolName: opts.ToolName,
},
ExecRoot: opts.ExecRoot,
Input: &cpb.InputSpec{
Expand Down

0 comments on commit b5a1e03

Please sign in to comment.