Skip to content

Commit

Permalink
fix pod aggregation err and fix some bugs about autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
liubog2008 committed Nov 6, 2016
1 parent 7651fdb commit b2a0e2e
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 b2a0e2e

Please # to comment.