elastic / apm-agent-go

https://www.elastic.co/guide/en/apm/agent/go/current/index.html
Apache License 2.0
420 stars 193 forks source link

apmgormv2 2Calls mysql in kibana #1647

Open gananggww opened 1 month ago

gananggww commented 1 month ago

Bug: using apmgormv2 double query in kibana

my config in go init db:

import (
    "gorm.io/gorm"
    mysql "go.elastic.co/apm/module/apmgormv2/v2/driver/mysql"
)

//.....

o.Db, err = gorm.Open(mysql.Open(host), &gorm.Config{
        Logger: newLogger,
})

using gorm with context:

...
        err = o.db.WithContext(ctx).Table(tableNameActivation).Where(map[string]interface{}{"username": trueUname}).First(&act).Error
    if err != nil {
        return
    }

and the result in my kibana:

Image

any 2 cell in one query

Image

2 call in one sample query detail

expactation shold produce 1 query in 1 cell and 1 calls

ramasuryananda commented 6 days ago

helo sorry , can i see on how you setup the gorm.io/gorm db connection with apmmysql driver, my query span didn't even show on my apm