in prometheus-to-sd/config/source_config.go [95:123]
func parseSourceConfig(uri flags.Uri, podId, namespaceId string) (*SourceConfig, error) {
host, port, err := net.SplitHostPort(uri.Val.Host)
if err != nil {
return nil, err
}
component := uri.Key
values := uri.Val.Query()
protocol := uri.Val.Scheme
path := uri.Val.Path
whitelisted := values.Get("whitelisted")
podIdLabel := values.Get("podIdLabel")
namespaceIdLabel := values.Get("namespaceIdLabel")
containerNameLabel := values.Get("containerNameLabel")
metricsPrefix := values.Get("metricsPrefix")
customResource := values.Get("customResourceType")
customLabels := getMap(values, "customLabels")
auth, err := parseAuthConfig(uri.Val)
if err != nil {
return nil, err
}
podConfig := NewPodConfig(podId, namespaceId, podIdLabel, namespaceIdLabel, containerNameLabel)
whitelistedLabelsMap, err := parseWhitelistedLabels(values.Get("whitelistedLabels"))
if err != nil {
return nil, err
}
return newSourceConfig(component, protocol, host, port, path, *auth, whitelisted, metricsPrefix, podConfig, whitelistedLabelsMap, customResource, customLabels)
}