diff --git a/receiver/receivercreator/discovery.go b/receiver/receivercreator/discovery.go index 69441aeef751..f8a694912751 100644 --- a/receiver/receivercreator/discovery.go +++ b/receiver/receivercreator/discovery.go @@ -28,19 +28,12 @@ const ( configHint = "config" ) -// hintsTemplatesBuilder creates configuration templates from provided hints. -type hintsTemplatesBuilder interface { - createReceiverTemplateFromHints(env observer.EndpointEnv) (*receiverTemplate, error) -} - // k8sHintsBuilder creates configurations from hints provided as Pod's annotations. type k8sHintsBuilder struct { logger *zap.Logger ignoreReceivers map[string]bool } -var _ hintsTemplatesBuilder = (*k8sHintsBuilder)(nil) - func createK8sHintsBuilder(config DiscoveryConfig, logger *zap.Logger) k8sHintsBuilder { ignoreReceivers := make(map[string]bool, len(config.IgnoreReceivers)) for _, r := range config.IgnoreReceivers { @@ -202,15 +195,6 @@ func validateEndpoint(endpoint, defaultEndpoint string) error { } uri = u } - // target endpoint can come in form ip:port. In that case we fix the uri - // temporarily with adding http scheme - if uri.Scheme == "" { - u, err := url.Parse("http://" + endpoint) - if err != nil { - return fmt.Errorf("could not parse enpoint") - } - uri = u - } // configured endpoint should include the target Pod's endpoint if uri.Host != defaultEndpoint { diff --git a/receiver/receivercreator/discovery_test.go b/receiver/receivercreator/discovery_test.go index a0c254be4a0f..982f78de8396 100644 --- a/receiver/receivercreator/discovery_test.go +++ b/receiver/receivercreator/discovery_test.go @@ -369,6 +369,11 @@ func TestValidateEndpoint(t *testing.T) { defaultEndpoint: "1.2.3.4:8080", expectError: false, }, + "test_valid_no_scheme_no_path": { + endpoint: "1.2.3.4:8080", + defaultEndpoint: "1.2.3.4:8080", + expectError: false, + }, "test_valid_no_scheme_dynamic": { endpoint: "`endpoint`/stats", defaultEndpoint: "1.2.3.4:8080",