Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ddtrace/tracer): Disable agent features and remote configuration in CI Visibility agentless mode #3026

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions ddtrace/tracer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,19 @@ func newConfig(opts ...StartOption) *config {
if c.debug {
log.SetLevel(log.LevelDebug)
}
// if using stdout or traces are disabled, agent is disabled
agentDisabled := c.logToStdout || !c.enabled.current

// Check if CI Visibility mode is enabled
if internal.BoolEnv(constants.CIVisibilityEnabledEnvironmentVariable, false) {
c.ciVisibilityEnabled = true // Enable CI Visibility mode
c.httpClientTimeout = time.Second * 45 // Increase timeout up to 45 seconds (same as other tracers in CIVis mode)
c.logStartup = false // If we are in CI Visibility mode we don't want to log the startup to stdout to avoid polluting the output
ciTransport := newCiVisibilityTransport(c) // Create a default CI Visibility Transport
c.transport = ciTransport // Replace the default transport with the CI Visibility transport
c.ciVisibilityAgentless = ciTransport.agentless
}

// if using stdout or traces are disabled or we are in ci visibility agentless mode, agent is disabled
agentDisabled := c.logToStdout || !c.enabled.current || c.ciVisibilityAgentless
c.agent = loadAgentFeatures(agentDisabled, c.agentURL, c.httpClient)
info, ok := debug.ReadBuildInfo()
if !ok {
Expand All @@ -551,17 +562,6 @@ func newConfig(opts ...StartOption) *config {
// This allows persisting the initial value of globalTags for future resets and updates.
globalTagsOrigin := c.globalTags.cfgOrigin
c.initGlobalTags(c.globalTags.get(), globalTagsOrigin)

// Check if CI Visibility mode is enabled
if internal.BoolEnv(constants.CIVisibilityEnabledEnvironmentVariable, false) {
c.ciVisibilityEnabled = true // Enable CI Visibility mode
c.httpClientTimeout = time.Second * 45 // Increase timeout up to 45 seconds (same as other tracers in CIVis mode)
c.logStartup = false // If we are in CI Visibility mode we don't want to log the startup to stdout to avoid polluting the output
ciTransport := newCiVisibilityTransport(c) // Create a default CI Visibility Transport
c.transport = ciTransport // Replace the default transport with the CI Visibility transport
c.ciVisibilityAgentless = ciTransport.agentless
}

return c
}

Expand Down
13 changes: 13 additions & 0 deletions ddtrace/tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ func Start(opts ...StartOption) {
if t.dataStreams != nil {
t.dataStreams.Start()
}
if t.config.ciVisibilityAgentless {
// CI Visibility agentless mode doesn't require remote configuration.

// start instrumentation telemetry unless it is disabled through the
// DD_INSTRUMENTATION_TELEMETRY_ENABLED env var
startTelemetry(t.config)

// start appsec
appsec.Start(t.config.appsecStartOptions...)
_ = t.hostname() // Prime the hostname cache
return
}

// Start AppSec with remote configuration
cfg := remoteconfig.DefaultClientConfig()
cfg.AgentURL = t.config.agentURL.String()
Expand Down
Loading