Skip to content

Commit 36a2e07

Browse files
authored
Merge pull request #49 from rluisr/missing_gauge_prefix
Missing namespace in `route_connections_*`
2 parents 3bf5656 + 9610e79 commit 36a2e07

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/golangci/golangci-lint
3+
rev: 2b73b3a9dffbcd4258bf79e901130a595520f1ee
4+
hooks:
5+
- id: golangci-lint-full

gauges.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,33 @@ var (
6767
Help: "",
6868
}, []string{"name", "address", "port"})
6969
routeConnectionsByteFromServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
70-
Name: "route_connections_byte_from_server",
71-
Help: "Route connections byte from server",
70+
Namespace: nameSpace,
71+
Name: "route_connections_byte_from_server",
72+
Help: "Route connections byte from server",
7273
}, []string{"name", "router_hostname", "source_address", "destination_address"})
7374
routeConnectionsByteToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
74-
Name: "route_connections_byte_to_server",
75-
Help: "Route connections byte to server",
75+
Namespace: nameSpace,
76+
Name: "route_connections_byte_to_server",
77+
Help: "Route connections byte to server",
7678
}, []string{"name", "router_hostname", "source_address", "destination_address"})
7779
routeConnectionsTimeStartedGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
78-
Name: "route_connections_time_started",
79-
Help: "Route connections time started",
80+
Namespace: nameSpace,
81+
Name: "route_connections_time_started",
82+
Help: "Route connections time started",
8083
}, []string{"name", "router_hostname", "source_address", "destination_address"})
8184
routeConnectionsTimeConnectedToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
82-
Name: "route_connections_time_connected_to_server",
83-
Help: "Route connections time connected to server",
85+
Namespace: nameSpace,
86+
Name: "route_connections_time_connected_to_server",
87+
Help: "Route connections time connected to server",
8488
}, []string{"name", "router_hostname", "source_address", "destination_address"})
8589
routeConnectionsTimeLastSentToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
86-
Name: "route_connections_time_last_sent_to_server",
87-
Help: "Route connections time last sent to server",
90+
Namespace: nameSpace,
91+
Name: "route_connections_time_last_sent_to_server",
92+
Help: "Route connections time last sent to server",
8893
}, []string{"name", "router_hostname", "source_address", "destination_address"})
8994
routeConnectionsTimeLastReceivedFromServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
90-
Name: "route_connections_time_last_received_from_server",
91-
Help: "Route connections time last received from server",
95+
Namespace: nameSpace,
96+
Name: "route_connections_time_last_received_from_server",
97+
Help: "Route connections time last received from server",
9298
}, []string{"name", "router_hostname", "source_address", "destination_address"})
9399
)

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ func collectRouteMetrics(router *mysqlrouter.Router) {
295295
writeError(err)
296296
return
297297
}
298+
298299
for _, routeConnection := range routeConnections {
299300
if args.CollectRouteConnectionsByteFromServer {
300301
routeConnectionsByteFromServerGauge.WithLabelValues(route.Name, router.Hostname, routeConnection.SourceAddress, routeConnection.DestinationAddress).Set(float64(routeConnection.BytesFromServer))

0 commit comments

Comments
 (0)