Skip to content

Commit

Permalink
add node name label for pod metric in kcmas
Browse files Browse the repository at this point in the history
  • Loading branch information
waynepeking348 committed Apr 17, 2023
1 parent 413cc12 commit 7105805
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/agent/sysadvisor/plugin/metric-emitter/syncer/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ import (
"github.com/kubewharf/katalyst-core/pkg/util/native"
)

const (
podMetricLabelSelectorNodeName = "node_name"
)

// podRawMetricNameMapping maps the raw metricName (collected from agent.MetricsFetcher)
// to the standard metricName (used by custom-metric-api-server)
var podRawMetricNameMapping = map[string]string{
Expand Down Expand Up @@ -207,6 +211,10 @@ func (p *MetricSyncerPod) generateMetricTag(pod *v1.Pod) (tags []metrics.MetricT
Key: fmt.Sprintf("%s", data.CustomMetricLabelKeyNamespace),
Val: pod.Namespace,
},
{
Key: fmt.Sprintf("%s%s", data.CustomMetricLabelSelectorPrefixKey, podMetricLabelSelectorNodeName),
Val: pod.Spec.NodeName,
},
}
for key, value := range pod.Labels {
if p.emitterConf.PodMetricLabel.Has(key) {
Expand Down

0 comments on commit 7105805

Please sign in to comment.