From cbb5ccf271a14f20527ca9eb657e1f0885272f56 Mon Sep 17 00:00:00 2001 From: Eliott Bouhana Date: Thu, 13 Feb 2025 14:01:55 +0100 Subject: [PATCH] fix mistake in civis telemetry product start Signed-off-by: Eliott Bouhana --- internal/civisibility/utils/net/client.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/civisibility/utils/net/client.go b/internal/civisibility/utils/net/client.go index e4374f43f3..72ec447733 100644 --- a/internal/civisibility/utils/net/client.go +++ b/internal/civisibility/utils/net/client.go @@ -128,18 +128,18 @@ func NewClientWithServiceNameAndSubdomain(serviceName, subdomain string) Client var baseURL string var requestHandler *RequestHandler var agentURL *url.URL - var APIKeyValue string + var apiKeyValue string agentlessEnabled := internal.BoolEnv(constants.CIVisibilityAgentlessEnabledEnvironmentVariable, false) if agentlessEnabled { // Agentless mode is enabled. - APIKeyValue = os.Getenv(constants.APIKeyEnvironmentVariable) - if APIKeyValue == "" { + apiKeyValue = os.Getenv(constants.APIKeyEnvironmentVariable) + if apiKeyValue == "" { log.Error("An API key is required for agentless mode. Use the DD_API_KEY env variable to set it") return nil } - defaultHeaders["dd-api-key"] = APIKeyValue + defaultHeaders["dd-api-key"] = apiKeyValue // Check for a custom agentless URL. agentlessURL := os.Getenv(constants.CIVisibilityAgentlessURLEnvironmentVariable) @@ -208,13 +208,19 @@ func NewClientWithServiceNameAndSubdomain(serviceName, subdomain string) Client if !telemetry.Disabled() { telemetryInit.Do(func() { - telemetry.ProductStarted(telemetry.NamespaceTracers) + telemetry.ProductStarted(telemetry.NamespaceCIVisibility) + telemetry.RegisterAppConfigs( + telemetry.Configuration{Name: "service", Value: serviceName}, + telemetry.Configuration{Name: "env", Value: environment}, + telemetry.Configuration{Name: "agentless", Value: agentlessEnabled}, + telemetry.Configuration{Name: "test_session_name", Value: ciTags[constants.TestSessionName]}, + ) if telemetry.GlobalClient() != nil { return } cfg := telemetry.ClientConfig{ HTTPClient: requestHandler.Client, - APIKey: APIKeyValue, + APIKey: apiKeyValue, } if agentURL != nil { cfg.AgentURL = agentURL.String()