Skip to content

Commit

Permalink
update process agent API
Browse files Browse the repository at this point in the history
  • Loading branch information
misteriaud committed Dec 6, 2024
1 parent b6aa3e2 commit 856cefb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/process-agent/subcommands/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
)

var httpClient = apiutil.GetClient(false)

const (
notRunning = `
=============
Expand Down Expand Up @@ -111,6 +109,7 @@ func writeError(log log.Component, w io.Writer, e error) {
}

func fetchStatus(statusURL string) ([]byte, error) {
httpClient := apiutil.GetClient(false)
body, err := apiutil.DoGet(httpClient, statusURL, apiutil.LeaveConnectionOpen)
if err != nil {
return nil, status.NewConnectionError(err)
Expand Down
4 changes: 4 additions & 0 deletions comp/process/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"go.uber.org/fx"

"github.com/DataDog/datadog-agent/cmd/process-agent/api"
"github.com/DataDog/datadog-agent/comp/api/authtoken"
log "github.com/DataDog/datadog-agent/comp/core/log/def"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
)
Expand All @@ -32,6 +33,8 @@ type dependencies struct {

Log log.Component

At authtoken.Component

APIServerDeps api.APIServerDeps
}

Expand All @@ -54,6 +57,7 @@ func newApiServer(deps dependencies) Component {
ReadTimeout: timeout,
WriteTimeout: timeout,
IdleTimeout: timeout,
TLSConfig: deps.At.GetTLSServerConfig(),
},
}

Expand Down
2 changes: 2 additions & 0 deletions comp/process/apiserver/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/fx"

"github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/settings/settingsimpl"
"github.com/DataDog/datadog-agent/comp/core/status"
Expand All @@ -39,6 +40,7 @@ func TestLifecycle(t *testing.T) {
}),
statusimpl.Module(),
settingsimpl.MockModule(),
fetchonlyimpl.MockModule(),
))

assert.Eventually(t, func() bool {
Expand Down
2 changes: 2 additions & 0 deletions comp/process/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/fx"

"github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl"
"github.com/DataDog/datadog-agent/comp/core"
configComp "github.com/DataDog/datadog-agent/comp/core/config"
log "github.com/DataDog/datadog-agent/comp/core/log/def"
Expand Down Expand Up @@ -60,6 +61,7 @@ func TestBundleDependencies(t *testing.T) {
rdnsquerier.MockModule(),
npcollectorimpl.MockModule(),
statsd.MockModule(),
fetchonlyimpl.MockModule(),
)
}

Expand Down

0 comments on commit 856cefb

Please sign in to comment.