You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/03/24 06:06:26 UTC
[GitHub] [skywalking] hanahmily commented on a change in pull request #6608: Add function 'k8sTagServiceByPodName' in MAL for k8s to relate pods and services.
hanahmily commented on a change in pull request #6608:
URL: https://github.com/apache/skywalking/pull/6608#discussion_r600196848
##########
File path: docs/en/concepts-and-designs/mal.md
##########
@@ -57,6 +57,25 @@ For example, this filters all instance_trace_count samples for values >= 33:
```
instance_trace_count.valueGreaterEqual(33)
```
+### K8s
+MAL support add specific Labels to the samples that collect from K8s metrics collectors.
+This feature need OAP Server has the authority to access the K8s's `API Server`.
+
+#### k8sTagServiceByPodName
+`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
Review comment:
*svc*.*namespace* is the canonical format for a service, for example, `nginx-service.default`
--
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:
users@infra.apache.org