add parseEndpoint

This commit is contained in:
xiandong
2023-02-17 13:46:45 +08:00
committed by Kevin Wan
parent af19addf47
commit 4e6d800877
3 changed files with 14 additions and 16 deletions

View File

@@ -15,18 +15,13 @@ type Config struct {
Batcher string `json:",default=jaeger,options=jaeger|jaegerudp|zipkin|otlpgrpc|otlphttp"`
}
func (c *Config) getEndpointHost() string {
func (c *Config) parseEndpoint() (host string, port string) {
EndpointSlice := strings.Split(c.Endpoint, ":")
if len(EndpointSlice) > 0 {
return strings.TrimSpace(EndpointSlice[0])
host = strings.TrimSpace(EndpointSlice[0])
}
return ""
}
func (c *Config) getEndpointPort() string {
EndpointSlice := strings.Split(c.Endpoint, ":")
if len(EndpointSlice) > 1 {
return strings.TrimSpace(EndpointSlice[1])
if len(EndpointSlice) > 0 {
port = strings.TrimSpace(EndpointSlice[1])
}
return ""
return host, port
}