Skip to main content

Go Agent v0.1.9

Release date: 2022-04-27

Beta - bug fixing

Fixed the bug where the web transaction data cannot be collected in a panic situation.

  • net/http
  • github.com/labstack/echo
  • github.com/gorilla/mux
  • github.com/go-gonic/gin
Note

Error data is collected through recover(), but the same panic occurs again.

Go
defer func() {
// panic

x := recover()
var err error = nil
if x != nil {
err = fmt.Errorf("Panic: %v", x)

// Collect the panic data.
trace.Error(ctx, err)
err = nil
}

...

// Panic is generated again.

if x != nil {
panic(x)
}
}()

Beta - update

Collecting the HTTP status code

Status codes over 400 are collected as error messages.

github.com/labstack/echo

Supporting the Echo/V4

Use echo/v4/whatapecho instead of the previous echo/whatapecho package.

Go
import (
"github.com/labstack/echo"

"github.com/whatap/go-api/trace"
"github.com/whatap/go-api/instrumentation/github.com/labstack/echo/v4/whatapecho"
)

Adding the HTTPErrorHandler wrapper of the echo

Additional error data is collected through HTTPErrorHandler.

The error data is collected when the echo.Context.Error() function is called. The panic data processed by the recover middleware is collected.

When the whatapecho middleware finally runs, it can collect as many data as possible from the HTTPErrorHandler. Set the middleware registration at the top, and the register it through the Pre() function.

Go
func main() {
...

e := echo.New()
//echo DefaultHTTPErrorHandler wrapper
e.HTTPErrorHandler = whatapecho.WrapHTTPErrorHandler(e.DefaultHTTPErrorHandler)
e.Pre(whatapecho.Middleware())
e.Use(middleware.Recover())
...
}

Log output

If the debug option is set, the monitoring-related log is output.

debug=true

The logs for transactions, DB connections, SQL executions, and HTTP outbound calls have been added.

Adding the setting to exclude collection by specifying the HTTP method

It excludes the collection of transactions requested by specific HTTP methods for the set URIs. Multiple URIs and methods can be registered using comma (,) as the delimiter. The values are case-insensitive.

  • ignore_http_method_urls

    #Default : ""#

    #Type: string#

  • ignore_http_method

    #Default : ""#

    #Type: string#

    ignore_http_method_urls=/index, /sql/select
    ignore_http_method=options, connect