diff --git a/prometheus-to-sd/main.go b/prometheus-to-sd/main.go index c54a7ceb2..306b46356 100644 --- a/prometheus-to-sd/main.go +++ b/prometheus-to-sd/main.go @@ -133,6 +133,7 @@ func readAndPushDataToStackdriver(stackdriverService *v3.Service, gceConf *confi metricDescriptorCache.Refresh() if useWhitelistedMetricsAutodiscovery { sourceConfig.UpdateWhitelistedMetrics(metricDescriptorCache.GetMetricNames()) + glog.V(2).Infof("Autodiscovered whitelisted metrics for component %v: %v", commonConfig.ComponentName, sourceConfig.Whitelisted) } signal = time.After(*metricDescriptorsResolution) default: @@ -143,7 +144,7 @@ func readAndPushDataToStackdriver(stackdriverService *v3.Service, gceConf *confi } metrics, err := translator.GetPrometheusMetrics(sourceConfig.Host, sourceConfig.Port) if err != nil { - glog.Warningf("Error while getting Prometheus metrics %v", err) + glog.V(2).Infof("Error while getting Prometheus metrics %v for component %v", err, sourceConfig.Component) continue } if *omitComponentName { @@ -153,6 +154,6 @@ func readAndPushDataToStackdriver(stackdriverService *v3.Service, gceConf *confi metricDescriptorCache.UpdateMetricDescriptors(metrics, sourceConfig.Whitelisted) } ts := translator.TranslatePrometheusToStackdriver(commonConfig, sourceConfig.Whitelisted, metrics, metricDescriptorCache) - translator.SendToStackdriver(stackdriverService, gceConf, ts) + translator.SendToStackdriver(stackdriverService, commonConfig, ts) } } diff --git a/prometheus-to-sd/translator/metric_descriptor_cache.go b/prometheus-to-sd/translator/metric_descriptor_cache.go index 271b18dbb..376d18dcf 100644 --- a/prometheus-to-sd/translator/metric_descriptor_cache.go +++ b/prometheus-to-sd/translator/metric_descriptor_cache.go @@ -110,7 +110,7 @@ func (cache *MetricDescriptorCache) updateMetricDescriptorIfStale(metricFamily * func (cache *MetricDescriptorCache) getMetricDescriptor(metric string) *v3.MetricDescriptor { value, ok := cache.descriptors[metric] if !ok { - glog.Warningf("Metric %s was not found in the cache.", metric) + glog.V(4).Infof("Metric %s was not found in the cache for component %v", metric, cache.component) } return value } diff --git a/prometheus-to-sd/translator/stackdriver.go b/prometheus-to-sd/translator/stackdriver.go index 3aa422989..4116e5fe0 100644 --- a/prometheus-to-sd/translator/stackdriver.go +++ b/prometheus-to-sd/translator/stackdriver.go @@ -33,13 +33,13 @@ const ( ) // SendToStackdriver sends http request to Stackdriver to create the given timeserieses. -func SendToStackdriver(service *v3.Service, config *config.GceConfig, ts []*v3.TimeSeries) { +func SendToStackdriver(service *v3.Service, config *config.CommonConfig, ts []*v3.TimeSeries) { if len(ts) == 0 { - glog.Warningf("No metrics to send to Stackdriver") + glog.V(3).Infof("No metrics to send to Stackdriver for component %v", config.ComponentName) return } - proj := createProjectName(config) + proj := createProjectName(config.GceConfig) var wg sync.WaitGroup var failedTs uint32 @@ -60,7 +60,7 @@ func SendToStackdriver(service *v3.Service, config *config.GceConfig, ts []*v3.T }(i, end) } wg.Wait() - glog.V(4).Infof("Successfully sent %v timeserieses to Stackdriver", uint32(len(ts))-failedTs) + glog.V(4).Infof("Successfully sent %v timeserieses to Stackdriver for component %v", uint32(len(ts))-failedTs, config.ComponentName) } func getMetricDescriptors(service *v3.Service, config *config.GceConfig, component string) (map[string]*v3.MetricDescriptor, error) { diff --git a/prometheus-to-sd/translator/translator.go b/prometheus-to-sd/translator/translator.go index 44e39d555..482868290 100644 --- a/prometheus-to-sd/translator/translator.go +++ b/prometheus-to-sd/translator/translator.go @@ -103,7 +103,7 @@ func filterWhitelisted(allMetrics map[string]*dto.MetricFamily, whitelisted []st if family, found := allMetrics[w]; found { res[w] = family } else { - glog.V(4).Infof("Whitelisted metric %s not present in Prometheus endpoint.", w) + glog.V(3).Infof("Whitelisted metric %s not present in Prometheus endpoint.", w) } } return res @@ -114,7 +114,7 @@ func translateFamily(config *config.CommonConfig, startTime time.Time, cache *MetricDescriptorCache) ([]*v3.TimeSeries, error) { - glog.V(4).Infof("Translating metric family %v", family.GetName()) + glog.V(3).Infof("Translating metric family %v from component", family.GetName(), config.ComponentName) var ts []*v3.TimeSeries if _, found := supportedMetricTypes[family.GetType()]; !found { return ts, fmt.Errorf("Metric type %v of family %s not supported", family.GetType(), family.GetName())