-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
agent_nix.go
48 lines (40 loc) · 1.5 KB
/
agent_nix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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.
//go:build linux
package agent
import (
"errors"
"go.uber.org/atomic"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
"github.com/DataDog/datadog-agent/pkg/security/security_profile/dump"
"github.com/DataDog/datadog-go/v5/statsd"
)
// NewRuntimeSecurityAgent instantiates a new RuntimeSecurityAgent
func NewRuntimeSecurityAgent(statsdClient statsd.ClientInterface, hostname string, opts RSAOptions, wmeta workloadmeta.Component) (*RuntimeSecurityAgent, error) {
client, err := NewRuntimeSecurityClient()
if err != nil {
return nil, err
}
// on windows do no telemetry
telemetry, err := newTelemetry(statsdClient, wmeta, opts.LogProfiledWorkloads, opts.IgnoreDDAgentContainers)
if err != nil {
return nil, errors.New("failed to initialize the telemetry reporter")
}
// on windows do no storage manager
storage, err := dump.NewSecurityAgentStorageManager()
if err != nil {
return nil, err
}
return &RuntimeSecurityAgent{
client: client,
hostname: hostname,
telemetry: telemetry,
storage: storage,
running: atomic.NewBool(false),
connected: atomic.NewBool(false),
eventReceived: atomic.NewUint64(0),
activityDumpReceived: atomic.NewUint64(0),
}, nil
}