Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark committed Nov 26, 2024
1 parent a38c8a1 commit e26cba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
16 changes: 0 additions & 16 deletions receiver/receivercreator/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions receiver/receivercreator/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e26cba5

Please sign in to comment.