@@ -11,15 +11,15 @@ import (
1111
1212// The following tags are applied to stats recorded by this package.
1313var (
14- // GoSqlMethod is the SQL method called.
15- GoSqlMethod , _ = tag .NewKey ("go_sql_method" )
16- // GoSqlError is the error received while calling a SQL method.
17- GoSqlError , _ = tag .NewKey ("go_sql_error" )
18- // GoSqlStatus identifies success vs. error from the SQL method response.
19- GoSqlStatus , _ = tag .NewKey ("go_sql_status" )
20-
21- valueOK = tag .Insert (GoSqlStatus , "OK" )
22- valueErr = tag .Insert (GoSqlStatus , "ERROR" )
14+ // GoSQLMethod is the SQL method called.
15+ GoSQLMethod , _ = tag .NewKey ("go_sql_method" )
16+ // GoSQLError is the error received while calling a SQL method.
17+ GoSQLError , _ = tag .NewKey ("go_sql_error" )
18+ // GoSQLStatus identifies success vs. error from the SQL method response.
19+ GoSQLStatus , _ = tag .NewKey ("go_sql_status" )
20+
21+ valueOK = tag .Insert (GoSQLStatus , "OK" )
22+ valueErr = tag .Insert (GoSQLStatus , "ERROR" )
2323)
2424
2525// The following measures are supported for use in custom views.
@@ -74,76 +74,76 @@ var (
7474// You still need to register these views for data to actually be collected.
7575// You can use the RegisterAllViews function for this.
7676var (
77- SqlClientLatencyView = & view.View {
77+ SQLClientLatencyView = & view.View {
7878 Name : "go.sql/client/latency" ,
7979 Description : "The distribution of latencies of various calls in milliseconds" ,
8080 Measure : MeasureLatencyMs ,
8181 Aggregation : DefaultMillisecondsDistribution ,
82- TagKeys : []tag.Key {GoSqlMethod , GoSqlError , GoSqlStatus },
82+ TagKeys : []tag.Key {GoSQLMethod , GoSQLError , GoSQLStatus },
8383 }
8484
85- SqlClientCallsView = & view.View {
85+ SQLClientCallsView = & view.View {
8686 Name : "go.sql/client/calls" ,
8787 Description : "The number of various calls of methods" ,
8888 Measure : MeasureLatencyMs ,
8989 Aggregation : view .Count (),
90- TagKeys : []tag.Key {GoSqlMethod , GoSqlError , GoSqlStatus },
90+ TagKeys : []tag.Key {GoSQLMethod , GoSQLError , GoSQLStatus },
9191 }
9292
93- SqlClientOpenConnectionsView = & view.View {
93+ SQLClientOpenConnectionsView = & view.View {
9494 Name : "go.sql/db/connections/open" ,
9595 Description : "The number of open connections" ,
9696 Measure : MeasureOpenConnections ,
9797 Aggregation : view .LastValue (),
9898 }
9999
100- SqlClientIdleConnectionsView = & view.View {
100+ SQLClientIdleConnectionsView = & view.View {
101101 Name : "go.sql/db/connections/idle" ,
102102 Description : "The number of idle connections" ,
103103 Measure : MeasureIdleConnections ,
104104 Aggregation : view .LastValue (),
105105 }
106106
107- SqlClientActiveConnectionsView = & view.View {
107+ SQLClientActiveConnectionsView = & view.View {
108108 Name : "go.sql/db/connections/active" ,
109109 Description : "The number of active connections" ,
110110 Measure : MeasureActiveConnections ,
111111 Aggregation : view .LastValue (),
112112 }
113113
114- SqlClientWaitCountView = & view.View {
114+ SQLClientWaitCountView = & view.View {
115115 Name : "go.sql/db/connections/wait_count" ,
116116 Description : "The total number of connections waited for" ,
117117 Measure : MeasureWaitCount ,
118118 Aggregation : view .LastValue (),
119119 }
120120
121- SqlClientWaitDurationView = & view.View {
121+ SQLClientWaitDurationView = & view.View {
122122 Name : "go.sql/db/connections/wait_duration" ,
123123 Description : "The total time blocked waiting for a new connection" ,
124124 Measure : MeasureWaitDuration ,
125125 Aggregation : view .LastValue (),
126126 }
127127
128- SqlClientIdleClosedView = & view.View {
128+ SQLClientIdleClosedView = & view.View {
129129 Name : "go.sql/db/connections/idle_closed_count" ,
130130 Description : "The total number of connections closed due to SetMaxIdleConns" ,
131131 Measure : MeasureIdleClosed ,
132132 Aggregation : view .LastValue (),
133133 }
134134
135- SqlClientLifetimeClosedView = & view.View {
135+ SQLClientLifetimeClosedView = & view.View {
136136 Name : "go.sql/db/connections/lifetime_closed_count" ,
137137 Description : "The total number of connections closed due to SetConnMaxLifetime" ,
138138 Measure : MeasureLifetimeClosed ,
139139 Aggregation : view .LastValue (),
140140 }
141141
142142 DefaultViews = []* view.View {
143- SqlClientLatencyView , SqlClientCallsView , SqlClientOpenConnectionsView ,
144- SqlClientIdleConnectionsView , SqlClientActiveConnectionsView ,
145- SqlClientWaitCountView , SqlClientWaitDurationView ,
146- SqlClientIdleClosedView , SqlClientLifetimeClosedView ,
143+ SQLClientLatencyView , SQLClientCallsView , SQLClientOpenConnectionsView ,
144+ SQLClientIdleConnectionsView , SQLClientActiveConnectionsView ,
145+ SQLClientWaitCountView , SQLClientWaitDurationView ,
146+ SQLClientIdleClosedView , SQLClientLifetimeClosedView ,
147147 }
148148)
149149
@@ -163,11 +163,11 @@ func recordCallStats(ctx context.Context, method string) func(err error) {
163163
164164 if err != nil {
165165 tags = []tag.Mutator {
166- tag .Insert (GoSqlMethod , method ), valueErr , tag .Insert (GoSqlError , err .Error ()),
166+ tag .Insert (GoSQLMethod , method ), valueErr , tag .Insert (GoSQLError , err .Error ()),
167167 }
168168 } else {
169169 tags = []tag.Mutator {
170- tag .Insert (GoSqlMethod , method ), valueOK ,
170+ tag .Insert (GoSQLMethod , method ), valueOK ,
171171 }
172172 }
173173
0 commit comments