(endpoint string)
| 130 | } |
| 131 | |
| 132 | func sanitizeEndpoint(endpoint string) (string, bool) { |
| 133 | u, err := url.Parse(endpoint) |
| 134 | if err != nil { |
| 135 | otel.Handle(fmt.Errorf("invalid otel endpoint '%s': %s", endpoint, err)) |
| 136 | return "", false |
| 137 | } |
| 138 | |
| 139 | var secure bool |
| 140 | switch u.Scheme { |
| 141 | // TODO: add support for OTEL endpoints through sockets |
| 142 | // case "unix": |
| 143 | // endpoint = unixSocketEndpoint(u) |
| 144 | case "https": |
| 145 | secure = true |
| 146 | fallthrough |
| 147 | case "http": |
| 148 | endpoint = path.Join(u.Host, u.Path) |
| 149 | } |
| 150 | return endpoint, secure |
| 151 | } |
no test coverage detected