Skip to content

Commit

Permalink
Fix constants
Browse files Browse the repository at this point in the history
  • Loading branch information
liashenko committed Jul 1, 2024
1 parent a1f55ad commit 7d361e3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ddtrace/tracer/civisibility_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func newCiVisibilityTransport(config *config) *ciVisibilityTransport {
}

// Determine if agentless mode is enabled through an environment variable.
agentlessEnabled := internal.BoolEnv(constants.CiVisibilityAgentlessEnabledEnvironmentVariable, false)
agentlessEnabled := internal.BoolEnv(constants.CIVisibilityAgentlessEnabledEnvironmentVariable, false)

testCycleURL := ""
if agentlessEnabled {
Expand All @@ -84,7 +84,7 @@ func newCiVisibilityTransport(config *config) *ciVisibilityTransport {

// Check for a custom agentless URL.
agentlessURL := ""
if v := os.Getenv(constants.CiVisibilityAgentlessURLEnvironmentVariable); v != "" {
if v := os.Getenv(constants.CIVisibilityAgentlessURLEnvironmentVariable); v != "" {
agentlessURL = v
}

Expand Down
4 changes: 2 additions & 2 deletions ddtrace/tracer/civisibility_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func runTransportTest(t *testing.T, agentless bool) {

// Set CI Visibility environment variables for the test
if agentless {
t.Setenv(constants.CiVisibilityAgentlessEnabledEnvironmentVariable, "1")
t.Setenv(constants.CiVisibilityAgentlessURLEnvironmentVariable, srv.URL)
t.Setenv(constants.CIVisibilityAgentlessEnabledEnvironmentVariable, "1")
t.Setenv(constants.CIVisibilityAgentlessURLEnvironmentVariable, srv.URL)
t.Setenv(constants.APIKeyEnvironmentVariable, "12345")
}

Expand Down
20 changes: 10 additions & 10 deletions ddtrace/tracer/civisibility_tslv.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ func getCiVisibilityEvent(span *span) *ciVisibilityEvent {
// A pointer to the created ciVisibilityEvent.
func createTestEventFromSpan(span *span) *ciVisibilityEvent {
tSpan := createTslvSpan(span)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTagName)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTagName)
tSpan.SuiteID = getAndRemoveMetaToUInt64(span, constants.TestSuiteIDTagName)
tSpan.CorrelationID = getAndRemoveMeta(span, constants.ItrCorrelationIDTagName)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTag)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTag)
tSpan.SuiteID = getAndRemoveMetaToUInt64(span, constants.TestSuiteIDTag)
tSpan.CorrelationID = getAndRemoveMeta(span, constants.ItrCorrelationIDTag)
tSpan.SpanID = span.SpanID
tSpan.TraceID = span.TraceID
return &ciVisibilityEvent{
Expand All @@ -298,9 +298,9 @@ func createTestEventFromSpan(span *span) *ciVisibilityEvent {
// A pointer to the created ciVisibilityEvent.
func createTestSuiteEventFromSpan(span *span) *ciVisibilityEvent {
tSpan := createTslvSpan(span)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTagName)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTagName)
tSpan.SuiteID = getAndRemoveMetaToUInt64(span, constants.TestSuiteIDTagName)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTag)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTag)
tSpan.SuiteID = getAndRemoveMetaToUInt64(span, constants.TestSuiteIDTag)
return &ciVisibilityEvent{
span: span,
Type: constants.SpanTypeTestSuite,
Expand All @@ -320,8 +320,8 @@ func createTestSuiteEventFromSpan(span *span) *ciVisibilityEvent {
// A pointer to the created ciVisibilityEvent.
func createTestModuleEventFromSpan(span *span) *ciVisibilityEvent {
tSpan := createTslvSpan(span)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTagName)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTagName)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTag)
tSpan.ModuleID = getAndRemoveMetaToUInt64(span, constants.TestModuleIDTag)
return &ciVisibilityEvent{
span: span,
Type: constants.SpanTypeTestModule,
Expand All @@ -341,7 +341,7 @@ func createTestModuleEventFromSpan(span *span) *ciVisibilityEvent {
// A pointer to the created ciVisibilityEvent.
func createTestSessionEventFromSpan(span *span) *ciVisibilityEvent {
tSpan := createTslvSpan(span)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTagName)
tSpan.SessionID = getAndRemoveMetaToUInt64(span, constants.TestSessionIDTag)
return &ciVisibilityEvent{
span: span,
Type: constants.SpanTypeTestSession,
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/tracer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func newConfig(opts ...StartOption) *config {
c.initGlobalTags(c.globalTags.get(), globalTagsOrigin)

// Check if CI Visibility mode is enabled
if internal.BoolEnv(constants.CiVisibilityEnabledEnvironmentVariable, false) {
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
Expand Down

0 comments on commit 7d361e3

Please sign in to comment.