dd-trace-go
dd-trace-go copied to clipboard
contrib/k8s.io/client-go/kubernetes: Resource names are not set properly
Kubernetes wrapper uses RequestToResource function to generate resource name. And RequestToResource function assumes URL path starts with /api/v1. This assumption seems to be incorrect. Reference: https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-uris
Good catch, it seems like for the most popular endpoints this approach works but I do see for example the events endpoints don't match this formatting and will end up with a resource name that is just the HTTP Method.
e.g. /apis/events.k8s.io/v1/namespaces/default/events. Do you have your own code example that isn't working alongside the resource name that you are expecting?
I've created a bug ticket for us internally to track this as well.
According to the Kubernetes reference (https://kubernetes.io/docs/reference/using-api/#api-groups), only the core group APIs start with /api/v1/, and the named group APIs start with /apis/{group}/{version}/. So every Kubernetes API except the core group will not work.