@@ -98,18 +98,18 @@ func NewServerTailnet(
98
98
agentConnectionTimes :map [uuid.UUID ]time.Time {},
99
99
agentTickets :map [uuid.UUID ]map [uuid.UUID ]struct {}{},
100
100
transport :tailnetTransport .Clone (),
101
- connsPerAgent :prometheus .NewGauge (prometheus.GaugeOpts {
101
+ connsPerAgent :prometheus .NewGaugeVec (prometheus.GaugeOpts {
102
102
Namespace :"coder" ,
103
103
Subsystem :"servertailnet" ,
104
- Name :"open_tcp_connections " ,
104
+ Name :"open_connections " ,
105
105
Help :"Total number of TCP connections currently open to workspace agents." ,
106
- }),
107
- totalConns :prometheus .NewCounter (prometheus.CounterOpts {
106
+ }, [] string { "network" } ),
107
+ totalConns :prometheus .NewCounterVec (prometheus.CounterOpts {
108
108
Namespace :"coder" ,
109
109
Subsystem :"servertailnet" ,
110
- Name :"tcp_connections_total " ,
110
+ Name :"connections_total " ,
111
111
Help :"Total number of TCP connections made to workspace agents." ,
112
- }),
112
+ }, [] string { "network" } ),
113
113
}
114
114
tn .transport .DialContext = tn .dialContext
115
115
// These options are mostly just picked at random, and they can likely be
@@ -328,8 +328,8 @@ type ServerTailnet struct {
328
328
329
329
transport * http.Transport
330
330
331
- connsPerAgent prometheus.Gauge
332
- totalConns prometheus.Counter
331
+ connsPerAgent * prometheus.GaugeVec
332
+ totalConns * prometheus.CounterVec
333
333
}
334
334
335
335
func (s * ServerTailnet )ReverseProxy (targetURL ,dashboardURL * url.URL ,agentID uuid.UUID )* httputil.ReverseProxy {
@@ -380,8 +380,8 @@ func (s *ServerTailnet) dialContext(ctx context.Context, network, addr string) (
380
380
return nil ,err
381
381
}
382
382
383
- s .connsPerAgent .Inc ()
384
- s .totalConns .Inc ()
383
+ s .connsPerAgent .WithLabelValues ( "tcp" ). Inc ()
384
+ s .totalConns .WithLabelValues ( "tcp" ). Inc ()
385
385
return & instrumentedConn {
386
386
Conn :nc ,
387
387
agentID :agentID ,
@@ -498,12 +498,12 @@ type instrumentedConn struct {
498
498
499
499
agentID uuid.UUID
500
500
closeOnce sync.Once
501
- connsPerAgent prometheus.Gauge
501
+ connsPerAgent * prometheus.GaugeVec
502
502
}
503
503
504
504
func (c * instrumentedConn )Close ()error {
505
505
c .closeOnce .Do (func () {
506
- c .connsPerAgent .Dec ()
506
+ c .connsPerAgent .WithLabelValues ( "tcp" ). Dec ()
507
507
})
508
508
return c .Conn .Close ()
509
509
}