Qualified influx metric names

This commit is contained in:
Geoff Bourne 2020-01-04 14:52:07 -06:00
parent 8d63f76a66
commit 3ea1149681
2 changed files with 6 additions and 6 deletions

View File

@ -105,9 +105,9 @@ func (b *influxMetricsBuilder) BuildConnectorMetrics() *server.ConnectorMetrics
b.metrics = metrics b.metrics = metrics
return &server.ConnectorMetrics{ return &server.ConnectorMetrics{
Errors: metrics.NewCounter("errors"), Errors: metrics.NewCounter("mc_router_errors"),
BytesTransmitted: metrics.NewCounter("transmitted_bytes"), BytesTransmitted: metrics.NewCounter("mc_router_transmitted_bytes"),
Connections: metrics.NewCounter("connections"), Connections: metrics.NewCounter("mc_router_connections"),
ActiveConnections: metrics.NewGauge("connections_active"), ActiveConnections: metrics.NewGauge("mc_router_connections_active"),
} }
} }

View File

@ -78,7 +78,7 @@ func (c *connectorImpl) acceptConnections(ctx context.Context, ln net.Listener,
} }
func (c *connectorImpl) HandleConnection(ctx context.Context, frontendConn net.Conn) { func (c *connectorImpl) HandleConnection(ctx context.Context, frontendConn net.Conn) {
c.metrics.Connections.With("direction", "frontend").Add(1) c.metrics.Connections.With("side", "frontend").Add(1)
//noinspection GoUnhandledErrorResult //noinspection GoUnhandledErrorResult
defer frontendConn.Close() defer frontendConn.Close()
@ -185,7 +185,7 @@ func (c *connectorImpl) findAndConnectBackend(ctx context.Context, frontendConn
return return
} }
c.metrics.Connections.With("direction", "backend", "host", resolvedHost).Add(1) c.metrics.Connections.With("side", "backend", "host", resolvedHost).Add(1)
c.metrics.ActiveConnections.Add(1) c.metrics.ActiveConnections.Add(1)
defer c.metrics.ActiveConnections.Add(-1) defer c.metrics.ActiveConnections.Add(-1)