diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 52867502d7a02..d250618aeda69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -214,7 +214,7 @@ variables: GITLAB_SCHEDULER_TOKEN_SSM_NAME: ci.datadog-agent.gitlab_pipelines_scheduler_token # ci-cd GITLAB_READ_API_TOKEN_SSM_NAME: ci.datadog-agent.gitlab_read_api_token # ci-cd GITLAB_FULL_API_TOKEN_SSM_NAME: ci.datadog-agent.gitlab_full_api_token # ci-cd - INSTALL_SCRIPT_API_KEY_SSM_NAME: ci.agent-linux-install-script.datadog_api_key # agent-delivery + INSTALL_SCRIPT_API_KEY_SSM_NAME: ci.agent-linux-install-script.datadog_api_key_2 # agent-delivery JIRA_READ_API_TOKEN_SSM_NAME: ci.datadog-agent.jira_read_api_token # agent-devx-infra MACOS_GITHUB_APP_ID_SSM_NAME: ci.datadog-agent.macos_github_app_id # agent-devx-infra MACOS_GITHUB_INSTALLATION_ID_SSM_NAME: ci.datadog-agent.macos_github_installation_id # agent-devx-infra diff --git a/.gitlab/kitchen_testing/new-e2e_testing.yml b/.gitlab/kitchen_testing/new-e2e_testing.yml index a56c2a2b275b5..86f68bc695e4f 100644 --- a/.gitlab/kitchen_testing/new-e2e_testing.yml +++ b/.gitlab/kitchen_testing/new-e2e_testing.yml @@ -60,5 +60,5 @@ TEAM: agent-delivery EXTRA_PARAMS: --osversion $E2E_OSVERS --platform $E2E_PLATFORM --arch $E2E_ARCH script: - - export DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/aws_ssm_get_wrapper.sh ci.agent-linux-install-script.datadog_api_key) + - export DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/aws_ssm_get_wrapper.sh $INSTALL_SCRIPT_API_KEY_SSM_NAME) - inv -e new-e2e-tests.run --targets $TARGETS --junit-tar "junit-${CI_JOB_ID}.tgz" ${EXTRA_PARAMS} diff --git a/cmd/serverless-init/main.go b/cmd/serverless-init/main.go index eff66114e9662..dec64407c09ec 100644 --- a/cmd/serverless-init/main.go +++ b/cmd/serverless-init/main.go @@ -9,7 +9,9 @@ package main import ( "context" + "errors" "os" + "os/exec" "sync" "time" @@ -87,18 +89,22 @@ func main() { if err != nil { log.Error(err) - os.Exit(-1) + exitCode := errorExitCode(err) + log.Flush() + os.Exit(exitCode) } } // removing these unused dependencies will cause silent crash due to fx framework -func run(_ secrets.Component, _ autodiscovery.Component, _ healthprobeDef.Component) { +func run(_ secrets.Component, _ autodiscovery.Component, _ healthprobeDef.Component) error { cloudService, logConfig, traceAgent, metricAgent, logsAgent := setup(modeConf) - modeConf.Runner(logConfig) + err := modeConf.Runner(logConfig) metric.AddShutdownMetric(cloudService.GetPrefix(), metricAgent.GetExtraTags(), time.Now(), metricAgent.Demux) lastFlush(logConfig.FlushTimeout, metricAgent, traceAgent, logsAgent) + + return err } func setup(mode.Conf) (cloudservice.CloudService, *serverlessInitLog.Config, trace.ServerlessTraceAgent, *metrics.ServerlessMetricAgent, logsAgent.ServerlessLogsAgent) { @@ -235,3 +241,17 @@ func setEnvWithoutOverride(envToSet map[string]string) { } } } + +func errorExitCode(err error) int { + // if error is of type exec.ExitError then propagate the exit code + var exitError *exec.ExitError + if errors.As(err, &exitError) { + exitCode := exitError.ExitCode() + log.Debugf("propagating exit code %v", exitCode) + return exitCode + } + + // use exit code 1 if there is no exit code in the error to propagate + log.Debug("using default exit code 1") + return 1 +} diff --git a/cmd/serverless-init/main_test.go b/cmd/serverless-init/main_test.go index 0b80ed089a60e..d95c54c7a185b 100644 --- a/cmd/serverless-init/main_test.go +++ b/cmd/serverless-init/main_test.go @@ -8,6 +8,8 @@ package main import ( + "errors" + "os/exec" "testing" "time" @@ -83,3 +85,29 @@ func TestFlushTimeout(t *testing.T) { assert.Equal(t, false, metricAgent.hasBeenCalled) assert.Equal(t, false, mockLogsAgent.DidFlush()) } +func TestExitCodePropagationGenericError(t *testing.T) { + err := errors.New("test error") + + exitCode := errorExitCode(err) + assert.Equal(t, 1, exitCode) +} + +func TestExitCodePropagationExitError(t *testing.T) { + cmd := exec.Command("bash", "-c", "exit 2") + err := cmd.Run() + + exitCode := errorExitCode(err) + assert.Equal(t, 2, exitCode) +} + +func TestExitCodePropagationJoinedExitError(t *testing.T) { + genericError := errors.New("test error") + + cmd := exec.Command("bash", "-c", "exit 3") + exitCodeError := cmd.Run() + + errs := errors.Join(genericError, exitCodeError) + + exitCode := errorExitCode(errs) + assert.Equal(t, 3, exitCode) +} diff --git a/cmd/serverless-init/mode/initcontainer_mode.go b/cmd/serverless-init/mode/initcontainer_mode.go index bb3c9437c0c97..9d45da246cf8d 100644 --- a/cmd/serverless-init/mode/initcontainer_mode.go +++ b/cmd/serverless-init/mode/initcontainer_mode.go @@ -9,19 +9,20 @@ package mode import ( - serverlessLog "github.com/DataDog/datadog-agent/cmd/serverless-init/log" - "github.com/DataDog/datadog-agent/pkg/util/log" - "github.com/spf13/afero" "io" "os" "os/exec" "os/signal" "strings" "syscall" + + serverlessLog "github.com/DataDog/datadog-agent/cmd/serverless-init/log" + "github.com/DataDog/datadog-agent/pkg/util/log" + "github.com/spf13/afero" ) // Run is the entrypoint of the init process. It will spawn the customer process -func RunInit(logConfig *serverlessLog.Config) { +func RunInit(logConfig *serverlessLog.Config) error { if len(os.Args) < 2 { panic("[datadog init process] invalid argument count, did you forget to set CMD ?") } @@ -32,7 +33,9 @@ func RunInit(logConfig *serverlessLog.Config) { err := execute(logConfig, args) if err != nil { log.Debugf("Error exiting: %v\n", err) + return err } + return nil } func execute(logConfig *serverlessLog.Config, args []string) error { diff --git a/cmd/serverless-init/mode/mode.go b/cmd/serverless-init/mode/mode.go index 31c664d21db4c..f3656e521159e 100644 --- a/cmd/serverless-init/mode/mode.go +++ b/cmd/serverless-init/mode/mode.go @@ -17,7 +17,7 @@ import ( // Conf contains the configuration for the mode in which the serverless-init agent should run type Conf struct { LoggerName string - Runner func(logConfig *serverlessLog.Config) + Runner func(logConfig *serverlessLog.Config) error TagVersionMode string EnvDefaults map[string]string } diff --git a/cmd/serverless-init/mode/sidecarcontainer_mode.go b/cmd/serverless-init/mode/sidecarcontainer_mode.go index fdf3ce9521164..f76ccd649c53e 100644 --- a/cmd/serverless-init/mode/sidecarcontainer_mode.go +++ b/cmd/serverless-init/mode/sidecarcontainer_mode.go @@ -9,19 +9,20 @@ package mode import ( - serverlessLog "github.com/DataDog/datadog-agent/cmd/serverless-init/log" - "github.com/DataDog/datadog-agent/pkg/util/log" "os" "os/signal" "syscall" + + serverlessLog "github.com/DataDog/datadog-agent/cmd/serverless-init/log" + "github.com/DataDog/datadog-agent/pkg/util/log" ) // Run is the entrypoint of the init process. It will spawn the customer process -func RunSidecar(logConfig *serverlessLog.Config) { +func RunSidecar(logConfig *serverlessLog.Config) error { stopCh := make(chan struct{}) go handleTerminationSignals(stopCh, signal.Notify) <-stopCh - + return nil } func handleTerminationSignals(stopCh chan struct{}, notify func(c chan<- os.Signal, sig ...os.Signal)) { diff --git a/comp/core/workloadmeta/collectors/internal/ecs/v4parser.go b/comp/core/workloadmeta/collectors/internal/ecs/v4parser.go index 5534ea83cd77f..6764d0821d26a 100644 --- a/comp/core/workloadmeta/collectors/internal/ecs/v4parser.go +++ b/comp/core/workloadmeta/collectors/internal/ecs/v4parser.go @@ -56,7 +56,7 @@ func (c *collector) parseTasksFromV4Endpoint(ctx context.Context) ([]workloadmet return c.setLastSeenEntitiesAndUnsetEvents(events, seen), nil } -// getTaskWithTagsFromV4Endpoint fetches task and tasks from the metadata v4 API +// getTaskWithTagsFromV4Endpoint fetches task and tags from the metadata v4 API func (c *collector) getTaskWithTagsFromV4Endpoint(ctx context.Context, task v1.Task) (v3or4.Task, error) { var metaURI string for _, taskContainer := range task.Containers { diff --git a/comp/process/agent/agent_linux.go b/comp/process/agent/agent_linux.go index 793b34198a03c..afdc4193e31df 100644 --- a/comp/process/agent/agent_linux.go +++ b/comp/process/agent/agent_linux.go @@ -8,6 +8,8 @@ package agent import ( + "slices" + "github.com/DataDog/datadog-agent/comp/core/config" logComponent "github.com/DataDog/datadog-agent/comp/core/log" "github.com/DataDog/datadog-agent/comp/process/types" @@ -15,6 +17,13 @@ import ( "github.com/DataDog/datadog-agent/pkg/util/flavor" ) +// List of check names for process checks +var processCheckNames = []string{ + checks.ProcessCheckName, + checks.ContainerCheckName, + checks.DiscoveryCheckName, +} + // Enabled determines whether the process agent is enabled based on the configuration. // The process-agent component on linux can be run in the core agent or as a standalone process-agent // depending on the configuration. @@ -26,10 +35,13 @@ func Enabled(config config.Component, checkComponents []types.CheckComponent, lo runInCoreAgent := config.GetBool("process_config.run_in_core_agent.enabled") var npmEnabled bool + var processEnabled bool for _, check := range checkComponents { if check.Object().Name() == checks.ConnectionsCheckName && check.Object().IsEnabled() { npmEnabled = true - break + } + if slices.Contains(processCheckNames, check.Object().Name()) && check.Object().IsEnabled() { + processEnabled = true } } @@ -40,14 +52,17 @@ func Enabled(config config.Component, checkComponents []types.CheckComponent, lo log.Info("Network Performance Monitoring is not supported in the core agent. " + "The process-agent will be enabled as a standalone agent") } - return true } if runInCoreAgent { log.Info("The process checks will run in the core agent") + } else if processEnabled { + log.Info("Process/Container Collection in the Process Agent will be deprecated in a future release " + + "and will instead be run in the Core Agent. " + + "Set process_config.run_in_core_agent.enabled to true to switch now.") } - return !runInCoreAgent + return !runInCoreAgent || npmEnabled case flavor.DefaultAgent: if npmEnabled && runInCoreAgent { log.Info("Network Performance Monitoring is not supported in the core agent. " + diff --git a/comp/process/agent/agentimpl/agent_linux_test.go b/comp/process/agent/agentimpl/agent_linux_test.go index c927128b2e19a..07082a380ad92 100644 --- a/comp/process/agent/agentimpl/agent_linux_test.go +++ b/comp/process/agent/agentimpl/agent_linux_test.go @@ -71,6 +71,14 @@ func TestProcessAgentComponentOnLinux(t *testing.T) { runInCoreAgentConfig: true, expected: true, }, + { + name: "process-agent with connections check enabled and run in core-agent mode disabled", + agentFlavor: flavor.ProcessAgent, + checksEnabled: true, + checkName: checks.ConnectionsCheckName, + runInCoreAgentConfig: false, + expected: true, + }, { name: "core agent with process check enabled and run in core-agent mode enabled", agentFlavor: flavor.DefaultAgent, diff --git a/pkg/proto/patches/0003-pkg-trace-traceutil-credit-card-obfuscation-9213.patch b/pkg/proto/patches/0003-pkg-trace-traceutil-credit-card-obfuscation-9213.patch deleted file mode 100644 index 55d7ddf2c836f..0000000000000 --- a/pkg/proto/patches/0003-pkg-trace-traceutil-credit-card-obfuscation-9213.patch +++ /dev/null @@ -1,50 +0,0 @@ -From e8ce85ce0ee230aac96594b11ffea6cabd2d89c7 Mon Sep 17 00:00:00 2001 -From: Gabriel Aszalos -Date: Tue, 2 Nov 2021 14:34:03 +0200 -Subject: [PATCH] pkg/trace/traceutil: credit card obfuscation (#9213) - -The PR adds support for credit card number obfuscation in span tags by means of configuration: -```yaml -apm_config: - obfuscation: - credit_cards: - enabled: true # enables obfuscation in span tags - luhn: true # enables Luhn check -``` -It is also possible to apply these settings via `DD_APM_OBFUSCATION_CREDIT_CARDS_ENABLED` and `DD_APM_OBFUSCATION_CREDIT_CARDS_LUHN`. - -The feature is off by default. Applying the Luhn algorithm has a performance impact but eliminates any potential false positives. Without it, the algorithm simply checks for valid IIN credit card prefixes (and lengths) in numeric tags, which should be sufficient for most use cases. - -The check and obfuscation is applied at decode time to avoid iterating and reading the map again. This is possible only for Msgpack. For JSON, the iteration happens since we don't own the decoding code. ---- - pkg/trace/pb/span_gen.go | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/pkg/trace/pb/span_gen.go b/pkg/trace/pb/span_gen.go -index 7a06e04853..589abbfee8 100644 ---- a/pkg/trace/pb/span_gen.go -+++ b/pkg/trace/pb/span_gen.go -@@ -74,6 +74,7 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { - err = msgp.WrapError(err) - return - } -+ hook, hookok := MetaHook() - for zb0001 > 0 { - zb0001-- - field, bts, err = msgp.ReadMapKeyZC(bts) -@@ -169,7 +170,11 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { - err = msgp.WrapError(err, "Meta", za0001) - return - } -- z.Meta[za0001] = za0002 -+ if hookok { -+ z.Meta[za0001] = hook(za0001, za0002) -+ } else { -+ z.Meta[za0001] = za0002 -+ } - } - case "metrics": - if msgp.IsNil(bts) { --- -2.41.0 - diff --git a/pkg/proto/pbgo/trace/decoder_v05.go b/pkg/proto/pbgo/trace/decoder_v05.go index c16f75c60b6ae..f88e6cc877e00 100644 --- a/pkg/proto/pbgo/trace/decoder_v05.go +++ b/pkg/proto/pbgo/trace/decoder_v05.go @@ -159,7 +159,6 @@ func (z *Span) UnmarshalMsgDictionary(bts []byte, dict []string) ([]byte, error) delete(z.Meta, key) } } - hook, hookok := MetaHook() for sz > 0 { sz-- var key, val string @@ -171,11 +170,7 @@ func (z *Span) UnmarshalMsgDictionary(bts []byte, dict []string) ([]byte, error) if err != nil { return bts, err } - if hookok { - z.Meta[key] = hook(key, val) - } else { - z.Meta[key] = val - } + z.Meta[key] = val } // Metrics (10) sz, bts, err = safeReadHeaderBytes(bts, msgp.ReadMapHeaderBytes) diff --git a/pkg/proto/pbgo/trace/hook.go b/pkg/proto/pbgo/trace/hook.go deleted file mode 100644 index 969f3daa9b8db..0000000000000 --- a/pkg/proto/pbgo/trace/hook.go +++ /dev/null @@ -1,33 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -package trace - -import ( - "sync" -) - -var ( - mu sync.RWMutex // guards metahook - metahook func(_, v string) string -) - -// SetMetaHook registers a callback which will run upon decoding each map -// entry in the span's Meta field. The hook has the opportunity to alter the -// value that is assigned to span.Meta[k] at decode time. By default, if no -// hook is defined, the behaviour is span.Meta[k] = v. -func SetMetaHook(hook func(k, v string) string) { - mu.Lock() - defer mu.Unlock() - metahook = hook -} - -// MetaHook returns the active meta hook. A MetaHook is a function which is ran -// for each span.Meta[k] = v value and has the opportunity to alter the final v. -func MetaHook() (hook func(k, v string) string, ok bool) { - mu.RLock() - defer mu.RUnlock() - return metahook, metahook != nil -} diff --git a/pkg/proto/pbgo/trace/hook_test.go b/pkg/proto/pbgo/trace/hook_test.go deleted file mode 100644 index 904bd188093fe..0000000000000 --- a/pkg/proto/pbgo/trace/hook_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -package trace - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/tinylib/msgp/msgp" -) - -func TestMetaHook(t *testing.T) { - t.Run("off", func(t *testing.T) { - b := newEmptyMessage() - b = msgp.AppendString(b, "meta") - b = msgp.AppendMapHeader(b, 1) - b = msgp.AppendString(b, "card.number") - b = msgp.AppendString(b, "4166 6766 6766 6746") - s, err := decodeBytes(b) - - assert := assert.New(t) - assert.Nil(err) - assert.Equal(map[string]string{"card.number": "4166 6766 6766 6746"}, s.Meta) - }) - - t.Run("on", func(t *testing.T) { - SetMetaHook(func(k, v string) string { return "test" }) - defer SetMetaHook(nil) - - b := newEmptyMessage() - b = msgp.AppendString(b, "meta") - b = msgp.AppendMapHeader(b, 1) - b = msgp.AppendString(b, "card.number") - b = msgp.AppendString(b, "4166 6766 6766 6746") - s, err := decodeBytes(b) - - assert := assert.New(t) - assert.Nil(err) - assert.Equal(map[string]string{"card.number": "test"}, s.Meta, "Warning! pkg/proto/pbgo/trace: MetaHook was not applied. One possible cause is regenerating the code in this folder without porting custom modifications of it.") - }) -} diff --git a/pkg/proto/pbgo/trace/span_gen.go b/pkg/proto/pbgo/trace/span_gen.go index a1591c955dd00..f08192b31b01b 100644 --- a/pkg/proto/pbgo/trace/span_gen.go +++ b/pkg/proto/pbgo/trace/span_gen.go @@ -119,7 +119,6 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err) return } - hook, hookok := MetaHook() for zb0001 > 0 { zb0001-- field, bts, err = msgp.ReadMapKeyZC(bts) @@ -260,11 +259,7 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err, "Meta", za0001) return } - if hookok { - z.Meta[za0001] = hook(za0001, za0002) - } else { - z.Meta[za0001] = za0002 - } + z.Meta[za0001] = za0002 } case "metrics": if msgp.IsNil(bts) { @@ -278,7 +273,7 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err, "Metrics") return } - if z.Metrics == nil && zb0003 > 0 { + if z.Metrics == nil && zb0003 > 0{ z.Metrics = make(map[string]float64, zb0003) } else if len(z.Metrics) > 0 { for key := range z.Metrics { diff --git a/pkg/security/proto/api/api.pb.go b/pkg/security/proto/api/api.pb.go index 7ad5b24e2a25e..c560ddb83920b 100644 --- a/pkg/security/proto/api/api.pb.go +++ b/pkg/security/proto/api/api.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 +// protoc-gen-go v1.34.2 // protoc // source: pkg/security/proto/api/api.proto @@ -3543,7 +3543,7 @@ func file_pkg_security_proto_api_api_proto_rawDescGZIP() []byte { } var file_pkg_security_proto_api_api_proto_msgTypes = make([]protoimpl.MessageInfo, 53) -var file_pkg_security_proto_api_api_proto_goTypes = []interface{}{ +var file_pkg_security_proto_api_api_proto_goTypes = []any{ (*GetEventParams)(nil), // 0: api.GetEventParams (*SecurityEventMessage)(nil), // 1: api.SecurityEventMessage (*DumpProcessCacheParams)(nil), // 2: api.DumpProcessCacheParams @@ -3670,7 +3670,7 @@ func file_pkg_security_proto_api_api_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_pkg_security_proto_api_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*GetEventParams); i { case 0: return &v.state @@ -3682,7 +3682,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*SecurityEventMessage); i { case 0: return &v.state @@ -3694,7 +3694,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*DumpProcessCacheParams); i { case 0: return &v.state @@ -3706,7 +3706,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SecurityDumpProcessCacheMessage); i { case 0: return &v.state @@ -3718,7 +3718,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*DumpNetworkNamespaceParams); i { case 0: return &v.state @@ -3730,7 +3730,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*DumpNetworkNamespaceMessage); i { case 0: return &v.state @@ -3742,7 +3742,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*GetConfigParams); i { case 0: return &v.state @@ -3754,7 +3754,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*SecurityConfigMessage); i { case 0: return &v.state @@ -3766,7 +3766,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*RuleSetReportMessage); i { case 0: return &v.state @@ -3778,7 +3778,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*EventTypePolicy); i { case 0: return &v.state @@ -3790,7 +3790,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*Approvers); i { case 0: return &v.state @@ -3802,7 +3802,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ApproverDetails); i { case 0: return &v.state @@ -3814,7 +3814,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*GetRuleSetReportParams); i { case 0: return &v.state @@ -3826,7 +3826,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*GetRuleSetReportResultMessage); i { case 0: return &v.state @@ -3838,7 +3838,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*ReloadPoliciesParams); i { case 0: return &v.state @@ -3850,7 +3850,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*ReloadPoliciesResultMessage); i { case 0: return &v.state @@ -3862,7 +3862,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*RunSelfTestParams); i { case 0: return &v.state @@ -3874,7 +3874,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*SecuritySelfTestResultMessage); i { case 0: return &v.state @@ -3886,7 +3886,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*GetStatusParams); i { case 0: return &v.state @@ -3898,7 +3898,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*ConstantValueAndSource); i { case 0: return &v.state @@ -3910,7 +3910,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*SelfTestsStatus); i { case 0: return &v.state @@ -3922,7 +3922,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*RuleStatus); i { case 0: return &v.state @@ -3934,7 +3934,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*PolicyStatus); i { case 0: return &v.state @@ -3946,7 +3946,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*Status); i { case 0: return &v.state @@ -3958,7 +3958,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*ConstantFetcherStatus); i { case 0: return &v.state @@ -3970,7 +3970,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*EnvironmentStatus); i { case 0: return &v.state @@ -3982,7 +3982,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*DumpDiscardersParams); i { case 0: return &v.state @@ -3994,7 +3994,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*DumpDiscardersMessage); i { case 0: return &v.state @@ -4006,7 +4006,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*StorageRequestParams); i { case 0: return &v.state @@ -4018,7 +4018,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[29].Exporter = func(v any, i int) any { switch v := v.(*MetadataMessage); i { case 0: return &v.state @@ -4030,7 +4030,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[30].Exporter = func(v any, i int) any { switch v := v.(*StorageRequestMessage); i { case 0: return &v.state @@ -4042,7 +4042,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[31].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpMessage); i { case 0: return &v.state @@ -4054,7 +4054,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[32].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpListParams); i { case 0: return &v.state @@ -4066,7 +4066,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[33].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpListMessage); i { case 0: return &v.state @@ -4078,7 +4078,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[34].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpStopParams); i { case 0: return &v.state @@ -4090,7 +4090,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[35].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpStopMessage); i { case 0: return &v.state @@ -4102,7 +4102,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[36].Exporter = func(v any, i int) any { switch v := v.(*TranscodingRequestParams); i { case 0: return &v.state @@ -4114,7 +4114,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[37].Exporter = func(v any, i int) any { switch v := v.(*TranscodingRequestMessage); i { case 0: return &v.state @@ -4126,7 +4126,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[38].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpStreamParams); i { case 0: return &v.state @@ -4138,7 +4138,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[39].Exporter = func(v any, i int) any { switch v := v.(*ActivityDumpStreamMessage); i { case 0: return &v.state @@ -4150,7 +4150,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[40].Exporter = func(v any, i int) any { switch v := v.(*WorkloadSelectorMessage); i { case 0: return &v.state @@ -4162,7 +4162,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[41].Exporter = func(v any, i int) any { switch v := v.(*LastAnomalyTimestampMessage); i { case 0: return &v.state @@ -4174,7 +4174,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[42].Exporter = func(v any, i int) any { switch v := v.(*InstanceMessage); i { case 0: return &v.state @@ -4186,7 +4186,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[43].Exporter = func(v any, i int) any { switch v := v.(*ActivityTreeStatsMessage); i { case 0: return &v.state @@ -4198,7 +4198,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[44].Exporter = func(v any, i int) any { switch v := v.(*EventTypeState); i { case 0: return &v.state @@ -4210,7 +4210,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[45].Exporter = func(v any, i int) any { switch v := v.(*ProfileContextMessage); i { case 0: return &v.state @@ -4222,7 +4222,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[46].Exporter = func(v any, i int) any { switch v := v.(*SecurityProfileMessage); i { case 0: return &v.state @@ -4234,7 +4234,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[47].Exporter = func(v any, i int) any { switch v := v.(*SecurityProfileListParams); i { case 0: return &v.state @@ -4246,7 +4246,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[48].Exporter = func(v any, i int) any { switch v := v.(*SecurityProfileListMessage); i { case 0: return &v.state @@ -4258,7 +4258,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[49].Exporter = func(v any, i int) any { switch v := v.(*SecurityProfileSaveParams); i { case 0: return &v.state @@ -4270,7 +4270,7 @@ func file_pkg_security_proto_api_api_proto_init() { return nil } } - file_pkg_security_proto_api_api_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + file_pkg_security_proto_api_api_proto_msgTypes[50].Exporter = func(v any, i int) any { switch v := v.(*SecurityProfileSaveMessage); i { case 0: return &v.state diff --git a/pkg/security/proto/api/api_grpc.pb.go b/pkg/security/proto/api/api_grpc.pb.go index 4883e02d66c15..ddd6caeaa0e5c 100644 --- a/pkg/security/proto/api/api_grpc.pb.go +++ b/pkg/security/proto/api/api_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.4.0 // - protoc // source: pkg/security/proto/api/api.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( SecurityModule_GetEvents_FullMethodName = "/api.SecurityModule/GetEvents" @@ -68,11 +68,12 @@ func NewSecurityModuleClient(cc grpc.ClientConnInterface) SecurityModuleClient { } func (c *securityModuleClient) GetEvents(ctx context.Context, in *GetEventParams, opts ...grpc.CallOption) (SecurityModule_GetEventsClient, error) { - stream, err := c.cc.NewStream(ctx, &SecurityModule_ServiceDesc.Streams[0], SecurityModule_GetEvents_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &SecurityModule_ServiceDesc.Streams[0], SecurityModule_GetEvents_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &securityModuleGetEventsClient{stream} + x := &securityModuleGetEventsClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -100,8 +101,9 @@ func (x *securityModuleGetEventsClient) Recv() (*SecurityEventMessage, error) { } func (c *securityModuleClient) DumpProcessCache(ctx context.Context, in *DumpProcessCacheParams, opts ...grpc.CallOption) (*SecurityDumpProcessCacheMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SecurityDumpProcessCacheMessage) - err := c.cc.Invoke(ctx, SecurityModule_DumpProcessCache_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_DumpProcessCache_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -109,8 +111,9 @@ func (c *securityModuleClient) DumpProcessCache(ctx context.Context, in *DumpPro } func (c *securityModuleClient) GetConfig(ctx context.Context, in *GetConfigParams, opts ...grpc.CallOption) (*SecurityConfigMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SecurityConfigMessage) - err := c.cc.Invoke(ctx, SecurityModule_GetConfig_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_GetConfig_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -118,8 +121,9 @@ func (c *securityModuleClient) GetConfig(ctx context.Context, in *GetConfigParam } func (c *securityModuleClient) GetStatus(ctx context.Context, in *GetStatusParams, opts ...grpc.CallOption) (*Status, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Status) - err := c.cc.Invoke(ctx, SecurityModule_GetStatus_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_GetStatus_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -127,8 +131,9 @@ func (c *securityModuleClient) GetStatus(ctx context.Context, in *GetStatusParam } func (c *securityModuleClient) RunSelfTest(ctx context.Context, in *RunSelfTestParams, opts ...grpc.CallOption) (*SecuritySelfTestResultMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SecuritySelfTestResultMessage) - err := c.cc.Invoke(ctx, SecurityModule_RunSelfTest_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_RunSelfTest_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -136,8 +141,9 @@ func (c *securityModuleClient) RunSelfTest(ctx context.Context, in *RunSelfTestP } func (c *securityModuleClient) GetRuleSetReport(ctx context.Context, in *GetRuleSetReportParams, opts ...grpc.CallOption) (*GetRuleSetReportResultMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetRuleSetReportResultMessage) - err := c.cc.Invoke(ctx, SecurityModule_GetRuleSetReport_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_GetRuleSetReport_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -145,8 +151,9 @@ func (c *securityModuleClient) GetRuleSetReport(ctx context.Context, in *GetRule } func (c *securityModuleClient) ReloadPolicies(ctx context.Context, in *ReloadPoliciesParams, opts ...grpc.CallOption) (*ReloadPoliciesResultMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReloadPoliciesResultMessage) - err := c.cc.Invoke(ctx, SecurityModule_ReloadPolicies_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_ReloadPolicies_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -154,8 +161,9 @@ func (c *securityModuleClient) ReloadPolicies(ctx context.Context, in *ReloadPol } func (c *securityModuleClient) DumpNetworkNamespace(ctx context.Context, in *DumpNetworkNamespaceParams, opts ...grpc.CallOption) (*DumpNetworkNamespaceMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DumpNetworkNamespaceMessage) - err := c.cc.Invoke(ctx, SecurityModule_DumpNetworkNamespace_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_DumpNetworkNamespace_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -163,8 +171,9 @@ func (c *securityModuleClient) DumpNetworkNamespace(ctx context.Context, in *Dum } func (c *securityModuleClient) DumpDiscarders(ctx context.Context, in *DumpDiscardersParams, opts ...grpc.CallOption) (*DumpDiscardersMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DumpDiscardersMessage) - err := c.cc.Invoke(ctx, SecurityModule_DumpDiscarders_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_DumpDiscarders_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -172,8 +181,9 @@ func (c *securityModuleClient) DumpDiscarders(ctx context.Context, in *DumpDisca } func (c *securityModuleClient) ListActivityDumps(ctx context.Context, in *ActivityDumpListParams, opts ...grpc.CallOption) (*ActivityDumpListMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ActivityDumpListMessage) - err := c.cc.Invoke(ctx, SecurityModule_ListActivityDumps_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_ListActivityDumps_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -181,8 +191,9 @@ func (c *securityModuleClient) ListActivityDumps(ctx context.Context, in *Activi } func (c *securityModuleClient) StopActivityDump(ctx context.Context, in *ActivityDumpStopParams, opts ...grpc.CallOption) (*ActivityDumpStopMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ActivityDumpStopMessage) - err := c.cc.Invoke(ctx, SecurityModule_StopActivityDump_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_StopActivityDump_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -190,8 +201,9 @@ func (c *securityModuleClient) StopActivityDump(ctx context.Context, in *Activit } func (c *securityModuleClient) TranscodingRequest(ctx context.Context, in *TranscodingRequestParams, opts ...grpc.CallOption) (*TranscodingRequestMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TranscodingRequestMessage) - err := c.cc.Invoke(ctx, SecurityModule_TranscodingRequest_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_TranscodingRequest_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -199,11 +211,12 @@ func (c *securityModuleClient) TranscodingRequest(ctx context.Context, in *Trans } func (c *securityModuleClient) GetActivityDumpStream(ctx context.Context, in *ActivityDumpStreamParams, opts ...grpc.CallOption) (SecurityModule_GetActivityDumpStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &SecurityModule_ServiceDesc.Streams[1], SecurityModule_GetActivityDumpStream_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &SecurityModule_ServiceDesc.Streams[1], SecurityModule_GetActivityDumpStream_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &securityModuleGetActivityDumpStreamClient{stream} + x := &securityModuleGetActivityDumpStreamClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -231,8 +244,9 @@ func (x *securityModuleGetActivityDumpStreamClient) Recv() (*ActivityDumpStreamM } func (c *securityModuleClient) ListSecurityProfiles(ctx context.Context, in *SecurityProfileListParams, opts ...grpc.CallOption) (*SecurityProfileListMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SecurityProfileListMessage) - err := c.cc.Invoke(ctx, SecurityModule_ListSecurityProfiles_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_ListSecurityProfiles_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -240,8 +254,9 @@ func (c *securityModuleClient) ListSecurityProfiles(ctx context.Context, in *Sec } func (c *securityModuleClient) SaveSecurityProfile(ctx context.Context, in *SecurityProfileSaveParams, opts ...grpc.CallOption) (*SecurityProfileSaveMessage, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SecurityProfileSaveMessage) - err := c.cc.Invoke(ctx, SecurityModule_SaveSecurityProfile_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, SecurityModule_SaveSecurityProfile_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -339,7 +354,7 @@ func _SecurityModule_GetEvents_Handler(srv interface{}, stream grpc.ServerStream if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SecurityModuleServer).GetEvents(m, &securityModuleGetEventsServer{stream}) + return srv.(SecurityModuleServer).GetEvents(m, &securityModuleGetEventsServer{ServerStream: stream}) } type SecurityModule_GetEventsServer interface { @@ -558,7 +573,7 @@ func _SecurityModule_GetActivityDumpStream_Handler(srv interface{}, stream grpc. if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SecurityModuleServer).GetActivityDumpStream(m, &securityModuleGetActivityDumpStreamServer{stream}) + return srv.(SecurityModuleServer).GetActivityDumpStream(m, &securityModuleGetActivityDumpStreamServer{ServerStream: stream}) } type SecurityModule_GetActivityDumpStreamServer interface { diff --git a/pkg/trace/agent/obfuscate_test.go b/pkg/trace/agent/obfuscate_test.go index b18fe9dc222af..268f55630f4d9 100644 --- a/pkg/trace/agent/obfuscate_test.go +++ b/pkg/trace/agent/obfuscate_test.go @@ -21,8 +21,6 @@ import ( ) func TestNewCreditCardsObfuscator(t *testing.T) { - _, ok := pb.MetaHook() - assert.False(t, ok) ctx, cancel := context.WithCancel(context.Background()) defer cancel() cfg := config.New() diff --git a/pkg/trace/api/api.go b/pkg/trace/api/api.go index 974eaeb517a77..4a1273f6df9ea 100644 --- a/pkg/trace/api/api.go +++ b/pkg/trace/api/api.go @@ -441,12 +441,12 @@ func (r *HTTPReceiver) tagStats(v Version, httpHeader http.Header, service strin // - tp is the decoded payload // - ranHook reports whether the decoder was able to run the pb.MetaHook // - err is the first error encountered -func decodeTracerPayload(v Version, req *http.Request, cIDProvider IDProvider, lang, langVersion, tracerVersion string) (tp *pb.TracerPayload, ranHook bool, err error) { +func decodeTracerPayload(v Version, req *http.Request, cIDProvider IDProvider, lang, langVersion, tracerVersion string) (tp *pb.TracerPayload, err error) { switch v { case v01: var spans []*pb.Span if err = json.NewDecoder(req.Body).Decode(&spans); err != nil { - return nil, false, err + return nil, err } return &pb.TracerPayload{ LanguageName: lang, @@ -454,12 +454,12 @@ func decodeTracerPayload(v Version, req *http.Request, cIDProvider IDProvider, l ContainerID: cIDProvider.GetContainerID(req.Context(), req.Header), Chunks: traceChunksFromSpans(spans), TracerVersion: tracerVersion, - }, false, nil + }, nil case v05: buf := getBuffer() defer putBuffer(buf) if _, err = copyRequestBody(buf, req); err != nil { - return nil, false, err + return nil, err } var traces pb.Traces err = traces.UnmarshalMsgDictionary(buf.Bytes()) @@ -469,20 +469,20 @@ func decodeTracerPayload(v Version, req *http.Request, cIDProvider IDProvider, l ContainerID: cIDProvider.GetContainerID(req.Context(), req.Header), Chunks: traceChunksFromTraces(traces), TracerVersion: tracerVersion, - }, true, err + }, err case V07: buf := getBuffer() defer putBuffer(buf) if _, err = copyRequestBody(buf, req); err != nil { - return nil, false, err + return nil, err } var tracerPayload pb.TracerPayload _, err = tracerPayload.UnmarshalMsg(buf.Bytes()) - return &tracerPayload, true, err + return &tracerPayload, err default: var traces pb.Traces - if ranHook, err = decodeRequest(req, &traces); err != nil { - return nil, false, err + if err = decodeRequest(req, &traces); err != nil { + return nil, err } return &pb.TracerPayload{ LanguageName: lang, @@ -490,7 +490,7 @@ func decodeTracerPayload(v Version, req *http.Request, cIDProvider IDProvider, l ContainerID: cIDProvider.GetContainerID(req.Context(), req.Header), Chunks: traceChunksFromTraces(traces), TracerVersion: tracerVersion, - }, ranHook, nil + }, nil } } @@ -582,7 +582,7 @@ func (r *HTTPReceiver) handleTraces(v Version, w http.ResponseWriter, req *http. } start := time.Now() - tp, ranHook, err := decodeTracerPayload(v, req, r.containerIDProvider, req.Header.Get(header.Lang), req.Header.Get(header.LangVersion), req.Header.Get(header.TracerVersion)) + tp, err := decodeTracerPayload(v, req, r.containerIDProvider, req.Header.Get(header.Lang), req.Header.Get(header.LangVersion), req.Header.Get(header.TracerVersion)) ts := r.tagStats(v, req.Header, firstService(tp)) defer func(err error) { tags := append(ts.AsTags(), fmt.Sprintf("success:%v", err == nil)) @@ -607,16 +607,6 @@ func (r *HTTPReceiver) handleTraces(v Version, w http.ResponseWriter, req *http. log.Errorf("Cannot decode %s traces payload: %v", v, err) return } - if !ranHook { - // The decoder of this request did not run the pb.MetaHook. The user is either using - // a deprecated endpoint or Content-Type, or, a new decoder was implemented and the - // the hook was not added. - log.Debug("Decoded the request without running pb.MetaHook. If this is a newly implemented endpoint, please make sure to run it!") - if _, ok := pb.MetaHook(); ok { - log.Warn("Received request on deprecated API endpoint or Content-Type. Performance is degraded. If you think this is an error, please contact support with this message.") - runMetaHook(tp.Chunks) - } - } if n, ok := r.replyOK(req, v, w); ok { tags := append(ts.AsTags(), "endpoint:traces_"+string(v)) _ = r.statsd.Histogram("datadog.trace_agent.receiver.rate_response_bytes", float64(n), tags, 1) @@ -643,23 +633,6 @@ func (r *HTTPReceiver) handleTraces(v Version, w http.ResponseWriter, req *http. r.out <- payload } -// runMetaHook runs the pb.MetaHook on all spans from traces. -func runMetaHook(chunks []*pb.TraceChunk) { - hook, ok := pb.MetaHook() - if !ok { - return - } - for _, chunk := range chunks { - for _, span := range chunk.Spans { - for k, v := range span.Meta { - if newv := hook(k, v); newv != v { - span.Meta[k] = newv - } - } - } - } -} - func droppedTracesFromHeader(h http.Header, ts *info.TagStats) int64 { var dropped int64 if v := h.Get(header.DroppedP0Traces); v != "" { @@ -789,24 +762,23 @@ func (r *HTTPReceiver) Languages() string { // It handles only v02, v03, v04 requests. // - ranHook reports whether the decoder was able to run the pb.MetaHook // - err is the first error encountered -func decodeRequest(req *http.Request, dest *pb.Traces) (ranHook bool, err error) { +func decodeRequest(req *http.Request, dest *pb.Traces) error { switch mediaType := getMediaType(req); mediaType { case "application/msgpack": buf := getBuffer() defer putBuffer(buf) - _, err = copyRequestBody(buf, req) + _, err := copyRequestBody(buf, req) if err != nil { - return false, err + return err } _, err = dest.UnmarshalMsg(buf.Bytes()) - return true, err + return err case "application/json": fallthrough case "text/json": fallthrough case "": - err = json.NewDecoder(req.Body).Decode(&dest) - return false, err + return json.NewDecoder(req.Body).Decode(&dest) default: // do our best if err1 := json.NewDecoder(req.Body).Decode(&dest); err1 != nil { @@ -814,12 +786,12 @@ func decodeRequest(req *http.Request, dest *pb.Traces) (ranHook bool, err error) defer putBuffer(buf) _, err2 := copyRequestBody(buf, req) if err2 != nil { - return false, err2 + return err2 } _, err2 = dest.UnmarshalMsg(buf.Bytes()) - return true, err2 + return err2 } - return false, nil + return nil } } diff --git a/pkg/trace/api/api_test.go b/pkg/trace/api/api_test.go index aa1253aac60ed..09faf6e7a023f 100644 --- a/pkg/trace/api/api_test.go +++ b/pkg/trace/api/api_test.go @@ -576,7 +576,7 @@ func TestDecodeV05(t *testing.T) { req, err := http.NewRequest("POST", "/v0.5/traces", bytes.NewReader(b)) assert.NoError(err) req.Header.Set(header.ContainerID, "abcdef123789456") - tp, _, err := decodeTracerPayload(v05, req, NewIDProvider(""), "python", "3.8.1", "1.2.3") + tp, err := decodeTracerPayload(v05, req, NewIDProvider(""), "python", "3.8.1", "1.2.3") assert.NoError(err) assert.EqualValues(tp, &pb.TracerPayload{ ContainerID: "abcdef123789456", diff --git a/pkg/trace/config/config.go b/pkg/trace/config/config.go index 538c117eb8c1d..a8e8ddedf5a24 100644 --- a/pkg/trace/config/config.go +++ b/pkg/trace/config/config.go @@ -340,6 +340,8 @@ type AgentConfig struct { // case, the sender will drop failed payloads when it is unable to enqueue // them for another retry. MaxSenderRetries int + // HTTP client used in writer connections. If nil, default client values will be used. + HTTPClientFunc func() *http.Client `json:"-"` // internal telemetry StatsdEnabled bool @@ -556,6 +558,10 @@ func (c *AgentConfig) APIKey() string { // NewHTTPClient returns a new http.Client to be used for outgoing connections to the // Datadog API. func (c *AgentConfig) NewHTTPClient() *ResetClient { + // If a custom HTTPClientFunc been set, use it. Otherwise use default client values + if c.HTTPClientFunc != nil { + return NewResetClient(c.ConnectionResetInterval, c.HTTPClientFunc) + } return NewResetClient(c.ConnectionResetInterval, func() *http.Client { return &http.Client{ Timeout: 10 * time.Second, diff --git a/releasenotes/notes/[agent]-Add-deprecation-warnings-9a3eb8622e86e39e.yaml b/releasenotes/notes/[agent]-Add-deprecation-warnings-9a3eb8622e86e39e.yaml new file mode 100644 index 0000000000000..26b880600c998 --- /dev/null +++ b/releasenotes/notes/[agent]-Add-deprecation-warnings-9a3eb8622e86e39e.yaml @@ -0,0 +1,5 @@ +--- +other: + - | + Add deprecation warnings when running process checks on the Process Agent in Linux. + This change prepares for the deprecation of processes and container collection in the Process Agent, occurring in a future release. diff --git a/releasenotes/notes/apm-add-custom-http-client-e30ef743cfcba589.yaml b/releasenotes/notes/apm-add-custom-http-client-e30ef743cfcba589.yaml new file mode 100644 index 0000000000000..c276517ea5e6f --- /dev/null +++ b/releasenotes/notes/apm-add-custom-http-client-e30ef743cfcba589.yaml @@ -0,0 +1,13 @@ +# Each section from every release note are combined when the +# CHANGELOG.rst is rendered. So the text needs to be worded so that +# it does not depend on any information only available in another +# section. This may mean repeating some details, but each section +# must be readable independently of the other. +# +# Each section note must be formatted as reStructuredText. +--- +enhancements: + - | + APM: Allow custom HTTP client to be provided when instantiating the + trace-agent configuration. This feature is primarily intended for the + OpenTelemetry exporter. diff --git a/tasks/go.py b/tasks/go.py index 17d0108f63134..bfe24a7f64a01 100644 --- a/tasks/go.py +++ b/tasks/go.py @@ -256,7 +256,6 @@ def generate_protobuf(ctx): 'trace': [ ('0001-Customize-msgpack-parsing.patch', '-p4'), ('0002-Make-nil-map-deserialization-retrocompatible.patch', '-p4'), - ('0003-pkg-trace-traceutil-credit-card-obfuscation-9213.patch', '-p4'), ], } diff --git a/tasks/linter.py b/tasks/linter.py index cfb017e4d507d..90652d12fe1fa 100644 --- a/tasks/linter.py +++ b/tasks/linter.py @@ -405,7 +405,7 @@ def releasenote(ctx): if not github.contains_release_note(pr_id): print( f"{color_message('Error', 'red')}: No releasenote was found for this PR. Please add one using 'reno'" - ", see https://github.com/DataDog/datadog-agent/blob/main/docs/dev/contributing.md#reno" + ", see https://datadoghq.dev/datadog-agent/guidelines/contributing/#reno" ", or apply the label 'changelog/no-changelog' to the PR.", file=sys.stderr, ) diff --git a/tasks/security_agent.py b/tasks/security_agent.py index 0b070d866640d..bf43380a0b471 100644 --- a/tasks/security_agent.py +++ b/tasks/security_agent.py @@ -724,9 +724,9 @@ def combine_btfhub_constants(ctx, archive_path, output_path=DEFAULT_BTFHUB_CONST def generate_cws_proto(ctx): with tempfile.TemporaryDirectory() as temp_gobin: with environ({"GOBIN": temp_gobin}): - ctx.run("go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.33.0") + ctx.run("go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2") ctx.run("go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.6.0") - ctx.run("go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0") + ctx.run("go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4.0") plugin_opts = " ".join( [ diff --git a/test/integration/serverless_perf/compute.sh b/test/integration/serverless_perf/compute.sh index 22fd428a123a7..eaf6f91971043 100755 --- a/test/integration/serverless_perf/compute.sh +++ b/test/integration/serverless_perf/compute.sh @@ -2,7 +2,7 @@ set -o pipefail -STARTUP_TIME_THRESHOLD=40 +STARTUP_TIME_THRESHOLD=20 calculate_median() { local sorted=($(printf "%s\n" "${@}" | sort -n)) diff --git a/test/new-e2e/pkg/runner/parameters/store_aws.go b/test/new-e2e/pkg/runner/parameters/store_aws.go index 233efdd537557..9479bb4f2bfec 100644 --- a/test/new-e2e/pkg/runner/parameters/store_aws.go +++ b/test/new-e2e/pkg/runner/parameters/store_aws.go @@ -11,9 +11,10 @@ import ( "fmt" "strings" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/clients" "github.com/aws/aws-sdk-go-v2/service/ssm" ssmTypes "github.com/aws/aws-sdk-go-v2/service/ssm/types" + + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/clients" ) var _ valueStore = &awsStore{} @@ -36,6 +37,9 @@ func (s awsStore) get(key StoreKey) (string, error) { if err != nil { return "", err } + if newKey, ok := awsOverrides[key]; ok { + key = newKey + } awsKey := strings.ToLower(s.prefix + string(key)) withDecription := true @@ -51,3 +55,9 @@ func (s awsStore) get(key StoreKey) (string, error) { return *output.Parameter.Value, nil } + +// AWSoverrides is a map of StoreKey to StoreKey used to override key only in AWS store +var awsOverrides = map[StoreKey]StoreKey{ + APIKey: "api_key_2", + APPKey: "app_key_2", +} diff --git a/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev b/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev index 6dfd4edb8eb08..3cef80b912fb4 100644 --- a/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev +++ b/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev @@ -6,7 +6,7 @@ ARG CORE_AGENT_DEST RUN apt-get update -y && apt-get install -y jq conntrack netcat-openbsd dnsutils iproute2 net-tools # the core agent has the library path hardcoded, this allows the agent included below to find libs -ENV LD_LIBRARY_PATH /opt/datadog-agent/embedded/lib +ENV LD_LIBRARY_PATH=/opt/datadog-agent/embedded/lib # inv -e process-agent.build-dev-image will set up a temporary # build directory where this Dockerfile and the necessary binaries diff --git a/tools/ebpf/Dockerfiles/Dockerfile-security-agent-dev b/tools/ebpf/Dockerfiles/Dockerfile-security-agent-dev index 271b190e00b6f..bbf24a3f4f4af 100644 --- a/tools/ebpf/Dockerfiles/Dockerfile-security-agent-dev +++ b/tools/ebpf/Dockerfiles/Dockerfile-security-agent-dev @@ -6,7 +6,7 @@ ARG CORE_AGENT_DEST RUN apt-get update -y && apt-get install -y jq netcat-openbsd # the core agent has the library path hardcoded, this allows the agent included below to find libs -ENV LD_LIBRARY_PATH /opt/datadog-agent/embedded/lib +ENV LD_LIBRARY_PATH=/opt/datadog-agent/embedded/lib # inv -e security-agent.build-dev-image will set up a temporary # build directory where this Dockerfile and the necessary binaries