Skip to content

Commit

Permalink
Merge pull request #2 from liubog2008/master
Browse files Browse the repository at this point in the history
fix pod aggregation err and fix some bugs about autoscaling
  • Loading branch information
liubog2008 authored Aug 10, 2016
2 parents 83e7cf9 + 2c56df4 commit f04e08e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 0 additions & 8 deletions metrics/core/caicloud/caicloud_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import (
// anytime. It it only guaranteed that it is unique for the unique combination of
// passed parameters.

func PodContainerKey(namespaceName, appName, podName, containerName string) string {
return fmt.Sprintf("namespace:%s/app:%s/pod:%s/container:%s", namespaceName, appName, podName, containerName)
}

func PodKey(namespaceName, appName, podName string) string {
return fmt.Sprintf("namespace:%s/app:%s/pod:%s", namespaceName, appName, podName)
}

func AppKey(namespaceName, appName string) string {
return fmt.Sprintf("namespace:%s/app:%s", namespaceName, appName)
}
Expand Down
4 changes: 2 additions & 2 deletions metrics/processors/caicloud/pod_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func (p *PodAggregator) Process(batch *core.DataBatch) (*core.DataBatch, error)

if metricSetType, found := metricSet.Labels[core.LabelMetricSetType.Key]; found && metricSetType == core.MetricSetTypePodContainer {
podName, found := metricSet.Labels[core.LabelPodName.Key]
appName, found2 := metricSet.Labels[caicloudcore.LabelAppName.Key]
_, found2 := metricSet.Labels[caicloudcore.LabelAppName.Key]
namespaceName, found3 := metricSet.Labels[core.LabelNamespaceName.Key]
if found && found2 && found3 {
podKey := caicloudcore.PodKey(namespaceName, appName, podName)
podKey := core.PodKey(namespaceName, podName)
pod, found := pods[podKey]
if !found {
if podFromBatch, found := batch.MetricSets[podKey]; found {
Expand Down
7 changes: 7 additions & 0 deletions metrics/processors/caicloud/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,12 @@ func GetProcessors(url *url.URL) ([]core.DataProcessor, error) {
},
)

nodeAutoscalingEnricher, err := kubeprocessors.NewNodeAutoscalingEnricher(url)
if err != nil {
glog.Fatalf("Failed to create NodeAutoscalingEnricher: %v", err)
return nil, err
}
dataProcessors = append(dataProcessors, nodeAutoscalingEnricher)

return dataProcessors, nil
}

0 comments on commit f04e08e

Please sign in to comment.