8000 network=tcp · coder/coder@02a7089 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02a7089

Browse files
committed
network=tcp
1 parent 66cb907 commit 02a7089

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

coderd/tailnet.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ func NewServerTailnet(
9898
agentConnectionTimes: map[uuid.UUID]time.Time{},
9999
agentTickets: map[uuid.UUID]map[uuid.UUID]struct{}{},
100100
transport: tailnetTransport.Clone(),
101-
connsPerAgent: prometheus.NewGauge(prometheus.GaugeOpts{
101+
connsPerAgent: prometheus.NewGaugeVec(prometheus.GaugeOpts{
102102
Namespace: "coder",
103103
Subsystem: "servertailnet",
104-
Name: "open_tcp_connections",
104+
Name: "open_connections",
105105
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{
108108
Namespace: "coder",
109109
Subsystem: "servertailnet",
110-
Name: "tcp_connections_total",
110+
Name: "connections_total",
111111
Help: "Total number of TCP connections made to workspace agents.",
112-
}),
112+
}, []string{"network"}),
113113
}
114114
tn.transport.DialContext = tn.dialContext
115115
// These options are mostly just picked at random, and they can likely be
@@ -328,8 +328,8 @@ type ServerTailnet struct {
328328

329329
transport *http.Transport
330330

331-
connsPerAgent prometheus.Gauge
332-
totalConns prometheus.Counter
331+
connsPerAgent *prometheus.GaugeVec
332+
totalConns *prometheus.CounterVec
333333
}
334334

335335
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) (
380380
return nil, err
381381
}
382382

383-
s.connsPerAgent.Inc()
384-
s.totalConns.Inc()
383+
s.connsPerAgent.WithLabelValues("tcp").Inc()
384+
s.totalConns.WithLabelValues("tcp").Inc()
385385
return &instrumentedConn{
386386
Conn: nc,
387387
agentID: agentID,
@@ -498,12 +498,12 @@ type instrumentedConn struct {
498498

499499
agentID uuid.UUID
500500
closeOnce sync.Once
501-
connsPerAgent prometheus.Gauge
501+
connsPerAgent *prometheus.GaugeVec
502502
}
503503

504504
func (c *instrumentedConn) Close() error {
505505
c.closeOnce.Do(func() {
506-
c.connsPerAgent.Dec()
506+
c.connsPerAgent.WithLabelValues("tcp").Dec()
507507
})
508508
return c.Conn.Close()
509509
}

0 commit comments

Comments
 (0)
0