modulepackage
0.12.0
Repository: https://github.com/hirosuzuki/go-sql-logger.git
Documentation: pkg.go.dev
# README
ISUCON Snippets
Import SQL Logger Module
import (
_ "github.com/go-sql-driver/mysql"
_ "github.com/hirosuzuki/go-sql-logger"
"github.com/hirosuzuki/go-sql-logger/measure"
"github.com/hirosuzuki/go-sql-logger/pprofiler"
)
Initalize Handler with Go Prof
func initializeHandler() {
pprofiler.Start(70)
}
Open MySQL Connection using sqlx
sqlx.Open("mysql"+os.Getenv("MYSQL_DRIVER_POSTFIX"), dsn)
Service Start Script
#!/bin/sh
export MYSQL_DRIVER_POSTFIX=:logger
export SQL_LOGFILE=/tmp/sql.log
export CPU_PROFILE_FILE=/tmp/cpu.pprof
Nginx Config
log_format with_time '$remote_addr $uid_got $cookie_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time';
access_log /var/log/nginx/access.log with_time;
Measure
defer measure.Start("APIPaymentToken").Stop()
# Functions
No description provided by the author