2929 logger log.Logger
3030 server * TemporalAPIServer
3131 transManager * transport.TransportManager
32+ metricLabels prometheus.Labels
3233 shutDownCh chan struct {}
3334 }
3435
@@ -184,10 +185,11 @@ func (ps *ProxyServer) start() error {
184185
185186 go func () {
186187 for {
188+ metrics .ProxyServiceCreated .With (ps .metricLabels ).Inc ()
187189 // If using mux transport underneath, Open call will be blocked until
188190 // underlying connection is established.
189191 // Also note: GRPC requires the client interceptors (like metrics) to be defined on the transport, not on the client.
190- clientTransport , err := ps .transManager .OpenClient (prometheus. Labels { "direction" : ps . opts . directionLabel ()}, clientConfig )
192+ clientTransport , err := ps .transManager .OpenClient (clientConfig )
191193 if err != nil {
192194 ps .logger .Error ("Open client transport is failed" , tag .Error (err ))
193195 return
@@ -215,10 +217,12 @@ func (ps *ProxyServer) start() error {
215217
216218 select {
217219 case <- ps .shutDownCh :
220+ metrics .ProxyServiceStopped .With (ps .metricLabels ).Inc ()
218221 ps .stopServer ()
219222 return
220223 case <- retryCh :
221224 // If any closable transport is closed, try to restart the proxy server.
225+ metrics .ProxyServiceRestarted .With (ps .metricLabels ).Inc ()
222226 ps .stopServer ()
223227 }
224228 }
@@ -243,6 +247,7 @@ func newProxyServer(
243247 opts : opts ,
244248 transManager : transManager ,
245249 logger : logger ,
250+ metricLabels : prometheus.Labels {"direction" : opts .directionLabel ()},
246251 shutDownCh : make (chan struct {}),
247252 }
248253}
0 commit comments