Skip to content

Commit

Permalink
[OTEL-2125] Add configsync to otel-agent without DD exporter config
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 committed Dec 18, 2024
1 parent c29edf5 commit 91d00e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion cmd/otel-agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface"
"github.com/DataDog/datadog-agent/comp/core/hostname/remotehostnameimpl"
log "github.com/DataDog/datadog-agent/comp/core/log/def"
logfx "github.com/DataDog/datadog-agent/comp/core/log/fx"
logtracefx "github.com/DataDog/datadog-agent/comp/core/log/fx-trace"
"github.com/DataDog/datadog-agent/comp/core/secrets"
tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
Expand Down Expand Up @@ -106,8 +107,20 @@ func runOTelAgentCommand(ctx context.Context, params *subcommands.GlobalParams,
fx.Provide(func() coreconfig.Component {
return acfg
}),
fx.Provide(func(_ coreconfig.Component) log.Params {
return log.ForDaemon(params.LoggerName, "log_file", pkgconfigsetup.DefaultOTelAgentLogFile)
}),
logfx.Module(),
fetchonlyimpl.Module(),
// TODO: don't rely on this pattern; remove this `OptionalModuleWithParams` thing
// and instead adapt OptionalModule to allow parameter passing naturally.
// See: https://github.com/DataDog/datadog-agent/pull/28386
configsyncimpl.OptionalModuleWithParams(),
fx.Provide(func() configsyncimpl.Params {
return configsyncimpl.NewParams(params.SyncTimeout, params.SyncDelay, true)
}),
converterfx.Module(),
fx.Provide(func(cp converter.Component) confmap.Converter {
fx.Provide(func(cp converter.Component, _ optional.Option[configsync.Component]) confmap.Converter {
return cp
}),
collectorcontribFx.Module(),
Expand Down
2 changes: 1 addition & 1 deletion comp/otelcol/ddflareextension/impl/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func newServer(endpoint string, handler http.Handler, auth bool) (*server, error
// no easy way currently to pass required bearer auth token to OSS collector;
// skip the validation if running inside a separate collector
// TODO: determine way to allow OSS collector to authenticate with agent, OTEL-2226
if auth {
if auth && util.GetAuthToken() != "" {
r.Use(validateToken)
}

Expand Down

0 comments on commit 91d00e8

Please sign in to comment.