Skip to main content

Go Agent v0.1.14

December 14, 2022

  • Fixed Fixed the problem where the CPU usage increases while the UDP server is stopped.

    While the UDP server is stopped (whatap-agent service stopped), the CPU load of the application with the Go monitoring applied increases. As the UDP server access and shutdown processes were repeated, multiple UDP connections were maintained, resulting in the increase of CPU usage.

  • New The k8s.io/client-go/kubernetes library has been supported.

    Reference example

    golang
    import (
    "k8s.io/client-go/rest"
    )

    func main() {
    // Init whatap trace
    config := make(map[string]string)
    trace.Init(config)
    defer trace.Shutdown()

    ...

    config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
    if err != nil {
    return nil, err
    }

    // Set the whatap roundTripper function.
    config.WrapTransport = wRT.WrapRoundTripper()

    clientset, err := kubernetes.NewForConfig(config)
    if err != nil {
    return nil, err
    }

    deploymentsClient := clientset.AppsV1().Deployments(conf.Server.Namespace)

    ...
    }
  • New The github.com/gofiber/fiber/v2 library has been supported.

    Reference example

    golang
    import (
    "github.com/whatap/go-api/instrumentation/github.com/gofiber/fiber/v2/whatapfiber"
    )

    func main() {
    // Init whatap trace
    config := make(map[string]string)
    trace.Init(config)
    defer trace.Shutdown()

    ...

    r := fiber.New(fiber.Config{
    StrictRouting: true,
    Views: engine,
    })

    r.Use(recover.New())

    // Register the middleware of whatapfiber.
    r.Use(whatapfiber.Middleware())

    ...
    }
  • New The github.com/valyala/fasthttp library has been supported.

    Reference example

    golang
    import (
    "github.com/whatap/go-api/instrumentation/github.com/valyala/fasthttp/whatapfasthttp"
    )

    func main() {
    // Init whatap trace
    config := make(map[string]string)
    trace.Init(config)
    defer trace.Shutdown()

    ...

    r := fiber.New(fiber.Config{
    StrictRouting: true,
    Views: engine,
    })

    r.Use(recover.New())

    // Use the wrapper function, whatapfasthttp.Func.
    r.GET("/", whatapfasthttp.Func(func(ctx *fasthttp.RequestCtx) {
    ...
    }))
    r.GET("/hello/{name}", whatapfasthttp.Func(func(ctx *fasthttp.RequestCtx) {
    fmt.Fprintf(ctx, "Hello, %s!\n", ctx.UserValue("name"))
    ctx.SetContentType("text/html;charset=utf8")
    }))
    }