@@ -532,8 +532,19 @@ func newConfig(opts ...StartOption) *config {
532
532
if c .debug {
533
533
log .SetLevel (log .LevelDebug )
534
534
}
535
- // if using stdout or traces are disabled, agent is disabled
536
- agentDisabled := c .logToStdout || ! c .enabled .current
535
+
536
+ // Check if CI Visibility mode is enabled
537
+ if internal .BoolEnv (constants .CIVisibilityEnabledEnvironmentVariable , false ) {
538
+ c .ciVisibilityEnabled = true // Enable CI Visibility mode
539
+ c .httpClientTimeout = time .Second * 45 // Increase timeout up to 45 seconds (same as other tracers in CIVis mode)
540
+ 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
541
+ ciTransport := newCiVisibilityTransport (c ) // Create a default CI Visibility Transport
542
+ c .transport = ciTransport // Replace the default transport with the CI Visibility transport
543
+ c .ciVisibilityAgentless = ciTransport .agentless
544
+ }
545
+
546
+ // if using stdout or traces are disabled or we are in ci visibility agentless mode, agent is disabled
547
+ agentDisabled := c .logToStdout || ! c .enabled .current || c .ciVisibilityAgentless
537
548
c .agent = loadAgentFeatures (agentDisabled , c .agentURL , c .httpClient )
538
549
info , ok := debug .ReadBuildInfo ()
539
550
if ! ok {
@@ -551,17 +562,6 @@ func newConfig(opts ...StartOption) *config {
551
562
// This allows persisting the initial value of globalTags for future resets and updates.
552
563
globalTagsOrigin := c .globalTags .cfgOrigin
553
564
c .initGlobalTags (c .globalTags .get (), globalTagsOrigin )
554
-
555
- // Check if CI Visibility mode is enabled
556
- if internal .BoolEnv (constants .CIVisibilityEnabledEnvironmentVariable , false ) {
557
- c .ciVisibilityEnabled = true // Enable CI Visibility mode
558
- c .httpClientTimeout = time .Second * 45 // Increase timeout up to 45 seconds (same as other tracers in CIVis mode)
559
- 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
560
- ciTransport := newCiVisibilityTransport (c ) // Create a default CI Visibility Transport
561
- c .transport = ciTransport // Replace the default transport with the CI Visibility transport
562
- c .ciVisibilityAgentless = ciTransport .agentless
563
- }
564
-
565
565
return c
566
566
}
567
567
0 commit comments