wankai123 opened a new pull request #6608: URL: https://github.com/apache/skywalking/pull/6608
### Add function 'k8sTagServiceByPodName' in MAL for k8s to relate pods and services. - [ ] If this is non-trivial feature, paste the links/URLs to the design doc. - [X] Update the documentation to include this new feature. - [X] Tests(including UT, IT, E2E) are added to verify the new feature. - [ ] If it's UI related, attach the screenshots below. - [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>. - [X] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/CHANGES.md). Since K8s metrics collector can't provide the relationship between pods and services. I collector these info from `K8s API Server`, then we can add specific labels to the samples to build the relationship. `k8sTagServiceByPodName(podName,serviceName)`.Add a sevice Label to the sample that already has a pod name. For example: ``` container_cpu_usage_seconds_total{container=my-nginx, cpu=total, pod=my-nginx-5dc4865748-mbczh} 2 ``` Expression: ``` container_cpu_usage_seconds_total.k8sTagServiceByPodName('pod' , 'service') ``` Output: ``` container_cpu_usage_seconds_total{container=my-nginx, cpu=total, pod=my-nginx-5dc4865748-mbczh, service='default:nginx-service'} 2 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
