diff --git a/comp/otelcol/ddflareextension/impl/server.go b/comp/otelcol/ddflareextension/impl/server.go index f4eadd14db495..0772ce4b15d32 100644 --- a/comp/otelcol/ddflareextension/impl/server.go +++ b/comp/otelcol/ddflareextension/impl/server.go @@ -32,10 +32,8 @@ type server struct { // validateToken - validates token for legacy API func validateToken(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if util.GetAuthToken() != "" { - if err := util.Validate(w, r); err != nil { - return - } + if err := util.Validate(w, r); err != nil { + return } next.ServeHTTP(w, r) }) @@ -114,7 +112,9 @@ func newServer(endpoint string, handler http.Handler) (*server, error) { r := mux.NewRouter() r.Handle("/", handler) - r.Use(validateToken) + if util.GetAuthToken() != "" { + r.Use(validateToken) + } s := &http.Server{ Addr: endpoint, diff --git a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go index 79e902ac58719..35d83e5661ba5 100644 --- a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go +++ b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go @@ -27,7 +27,6 @@ var noDDExporterConfig string func (s *noDDExporterTestSuite) SetupSuite() { s.BaseSuite.SetupSuite() - utils.TestCalendarApp(s) } func TestOTelAgentWithNoDDExporter(t *testing.T) {