github.com/galamsiva2020/kubernetes-heapster-monitoring@v0.0.0-20210823134957-3c1baa7c1e70/metrics/core/ms_keys.go (about) 1 // Copyright 2015 Google Inc. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package core 16 17 import ( 18 "fmt" 19 ) 20 21 // MetricsSet keys are inside of DataBatch. The structure of the returned string is 22 // an implementation detail and no component should rely on it as it may change 23 // anytime. It only guaranteed that it is unique for the unique combination of 24 // passed parameters. 25 26 func PodContainerKey(namespace, podName, containerName string) string { 27 return fmt.Sprintf("namespace:%s/pod:%s/container:%s", namespace, podName, containerName) 28 } 29 30 func PodKey(namespace, podName string) string { 31 return fmt.Sprintf("namespace:%s/pod:%s", namespace, podName) 32 } 33 34 func NamespaceKey(namespace string) string { 35 return fmt.Sprintf("namespace:%s", namespace) 36 } 37 38 func NodeKey(node string) string { 39 return fmt.Sprintf("node:%s", node) 40 } 41 42 func NodeContainerKey(node, container string) string { 43 return fmt.Sprintf("node:%s/container:%s", node, container) 44 } 45 46 func ClusterKey() string { 47 return "cluster" 48 }