feat(observabillity): #153 instrument sqlx
This commit was merged in pull request #160.
This commit is contained in:
7
main.go
7
main.go
@@ -6,9 +6,11 @@ import (
|
||||
"os"
|
||||
"spend-sparrow/internal"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/joho/godotenv"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/uptrace/opentelemetry-go-extra/otelsql"
|
||||
"github.com/uptrace/opentelemetry-go-extra/otelsqlx"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -18,7 +20,8 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
db, err := sqlx.Open("sqlite3", "./data/spend-sparrow.db")
|
||||
db, err := otelsqlx.Open("sqlite3", "./data/spend-sparrow.db",
|
||||
otelsql.WithAttributes(semconv.DBSystemSqlite))
|
||||
if err != nil {
|
||||
slog.Error("Could not open Database data.db", "err", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user