in pkg/metricgen/otlp.go [119:139]
func otlpEndpoint(s string) (*url.URL, error) {
u, err := url.Parse(s)
if err != nil {
return &url.URL{}, fmt.Errorf("failed to parse endpoint: %w", err)
}
switch u.Scheme {
case "http":
if u.Port() == "" {
u.Host = net.JoinHostPort(u.Host, "80")
}
case "https":
if u.Port() == "" {
u.Host = net.JoinHostPort(u.Host, "443")
}
default:
return &url.URL{}, fmt.Errorf("endpoint must be prefixed with http:// or https://")
}
return u, nil
}