Skip to content

Commit

Permalink
Merge pull request #49 from rluisr/missing_gauge_prefix
Browse files Browse the repository at this point in the history
Missing namespace in `route_connections_*`
  • Loading branch information
rluisr authored Oct 23, 2023
2 parents 3bf5656 + 9610e79 commit 36a2e07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/golangci/golangci-lint
rev: 2b73b3a9dffbcd4258bf79e901130a595520f1ee
hooks:
- id: golangci-lint-full
30 changes: 18 additions & 12 deletions gauges.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,33 @@ var (
Help: "",
}, []string{"name", "address", "port"})
routeConnectionsByteFromServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_byte_from_server",
Help: "Route connections byte from server",
Namespace: nameSpace,
Name: "route_connections_byte_from_server",
Help: "Route connections byte from server",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
routeConnectionsByteToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_byte_to_server",
Help: "Route connections byte to server",
Namespace: nameSpace,
Name: "route_connections_byte_to_server",
Help: "Route connections byte to server",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
routeConnectionsTimeStartedGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_time_started",
Help: "Route connections time started",
Namespace: nameSpace,
Name: "route_connections_time_started",
Help: "Route connections time started",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
routeConnectionsTimeConnectedToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_time_connected_to_server",
Help: "Route connections time connected to server",
Namespace: nameSpace,
Name: "route_connections_time_connected_to_server",
Help: "Route connections time connected to server",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
routeConnectionsTimeLastSentToServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_time_last_sent_to_server",
Help: "Route connections time last sent to server",
Namespace: nameSpace,
Name: "route_connections_time_last_sent_to_server",
Help: "Route connections time last sent to server",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
routeConnectionsTimeLastReceivedFromServerGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "route_connections_time_last_received_from_server",
Help: "Route connections time last received from server",
Namespace: nameSpace,
Name: "route_connections_time_last_received_from_server",
Help: "Route connections time last received from server",
}, []string{"name", "router_hostname", "source_address", "destination_address"})
)
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ func collectRouteMetrics(router *mysqlrouter.Router) {
writeError(err)
return
}

for _, routeConnection := range routeConnections {
if args.CollectRouteConnectionsByteFromServer {
routeConnectionsByteFromServerGauge.WithLabelValues(route.Name, router.Hostname, routeConnection.SourceAddress, routeConnection.DestinationAddress).Set(float64(routeConnection.BytesFromServer))
Expand Down

0 comments on commit 36a2e07

Please sign in to comment.