@@ -125,18 +125,20 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
125
125
_ = pprof .Handler
126
126
pprofSrvClose := ServeHandler (ctx , logger , nil , pprofAddress , "pprof" )
127
127
defer pprofSrvClose ()
128
- // Do a best effort here. If this fails, it's not a big deal.
129
- if port , err := urlPort (pprofAddress ); err == nil {
128
+ if port , err := extractPort (pprofAddress ); err == nil {
130
129
ignorePorts [port ] = "pprof"
131
130
}
132
131
133
132
prometheusSrvClose := ServeHandler (ctx , logger , prometheusMetricsHandler (), prometheusAddress , "prometheus" )
134
133
defer prometheusSrvClose ()
135
- // Do a best effort here. If this fails, it's not a big deal.
136
- if port , err := urlPort (prometheusAddress ); err == nil {
134
+ if port , err := extractPort (prometheusAddress ); err == nil {
137
135
ignorePorts [port ] = "prometheus"
138
136
}
139
137
138
+ if port , err := extractPort (debugAddress ); err == nil {
139
+ ignorePorts [port ] = "debug"
140
+ }
141
+
140
142
// exchangeToken returns a session token.
141
143
// This is abstracted to allow for the same looping condition
142
144
// regardless of instance identity auth type.
@@ -225,10 +227,6 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
225
227
226
228
debugSrvClose := ServeHandler (ctx , logger , agnt .HTTPDebug (), debugAddress , "debug" )
227
229
defer debugSrvClose ()
228
- // Do a best effort here. If this fails, it's not a big deal.
229
- if port , err := urlPort (debugAddress ); err == nil {
230
- ignorePorts [port ] = "debug"
231
- }
232
230
233
231
<- ctx .Done ()
234
232
return agnt .Close ()
0 commit comments