Documentation ¶
Overview ¶
Package kubernetes provides functions to trace k8s.io/client-go (https://github.com/kubernetes/client-go).
Example ¶
package main import ( "fmt" kubernetestrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/k8s.io/client-go/kubernetes" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" ) func main() { cfg, err := rest.InClusterConfig() if err != nil { panic(err.Error()) } // Use this to trace all calls made to the Kubernetes API cfg.WrapTransport = kubernetestrace.WrapRoundTripper client, err := kubernetes.NewForConfig(cfg) if err != nil { panic(err.Error()) } pods, err := client.CoreV1().Pods("default").List(meta_v1.ListOptions{}) if err != nil { panic(err) } fmt.Println(pods.Items) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapRoundTripper ¶
func WrapRoundTripper(rt http.RoundTripper) http.RoundTripper
WrapRoundTripper wraps a RoundTripper intended for interfacing with Kubernetes and traces all requests.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.