epsagon / epsagon-go

Automated tracing library for Go 1.x ⚡️
https://epsagon.com
MIT License
28 stars 11 forks source link

Go Integration + RDS + RabbitMQ #92

Closed EduardoRMello closed 2 years ago

EduardoRMello commented 3 years ago

Hello !

I'm trying to trace my app with mux http sample, but I've found some difficulties...

func Connect() (*gorm.DB, error) {
    rds := environment.GetRDSConfig()
    config := gorm.Config{
        NamingStrategy: schema.NamingStrategy{
            SingularTable: true,
        }}

    dbClient, err := postgresql_client.Connect(rds.ToDSN(), config)
    if err != nil {
        log.Err(err).Msg("Error trying to connect database.")
        return nil, err
    }

    return dbClient.DB, nil
}
...
db, err := postgreSQL.Connect()
post := epsagonhttp.WrapHandleFunc(
        epsagonConfig,
        invoices.PostHandler(db, publisher, consumer, epsagonConfig),
        "create-invoice",
    )

    r := mux.NewRouter()
    r.HandleFunc("/invoices", post).Methods(http.MethodPost)

Inner my post method I've Gorm + RDS implementation to access database and an ampq RPC Rabbit connection (Publish and Consume Message)... My trace on espagon only showing my post and my entry function times, don't appear times to DB connections and RabbitMQ. I've read the docummentation and didn't find samples about this configuration...

Can you explain how I can trace this scenery ?