File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,33 @@ func GetConn(...) driver.Conn {
8484}
8585```
8686
87+ ## metrics
88+
89+ Next to tracing, ocsql also supports OpenCensus stats. To record call stats,
90+ register the available views or create your own using the provided Measures.
91+
92+ ``` go
93+ // register default views
94+ ocsql.RegisterAllViews ()
95+
96+ ```
97+
98+ From Go 1.11 and up, ocsql also has the ability to record database connection
99+ pool details. Use the ` RecordStats ` function and provide a ` *sql.DB ` to record
100+ details on, as well as the required record interval.
101+
102+ ``` go
103+ // register default views
104+ ocsql.RegisterAllViews ()
105+
106+ // Connect to a SQLite3 database using the ocsql driver wrapper
107+ db, err = sql.Open (" ocsql-sqlite3" , " resource.db" )
108+
109+ // Record DB stats every 5 seconds
110+ ocsql.RecordStats (db, 5 * time.Second )
111+
112+ ```
113+
87114## jmoiron/sqlx
88115
89116If using the ` sqlx ` library with named queries you will need to use the
You can’t perform that action at this time.
0 commit comments