"go.fuhry.dev/runtime/constants"
"go.fuhry.dev/runtime/metrics/metricbus"
"go.fuhry.dev/runtime/mtls"
+ "go.fuhry.dev/runtime/sd"
"go.fuhry.dev/runtime/utils/hashset"
"go.fuhry.dev/runtime/utils/hostname"
"go.fuhry.dev/runtime/utils/log"
httpServer *http.Server
httpMux *http.ServeMux
listenOn *net.TCPAddr
+ publisher *sd.SDPublisher
startStopMu sync.Mutex
}
},
listenOn: tcpAddr,
servicer: servicer,
+ publisher: &sd.SDPublisher{
+ Protocol: sd.ProtocolTCP,
+ AdvertisePort: uint16(port),
+ Service: "otel-tls",
+ ShardName: fmt.Sprintf("%s-metric-collector", constants.OrgSlug),
+ },
}
server.log.V(1).Infof("Server configured to listen on %s", tcpAddr.String())
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer s.startStopMu.Unlock()
+ defer s.publisher.Unpublish()
defer cancel()
defer dbusConn.Close()
defer s.httpServer.Shutdown(shutdownCtx)
}
}
})()
+ err = s.publisher.Publish(s.ctx)
+ if err != nil {
+ s.log.Warnf("failed to publish service in sd: %v", err)
+ }
s.log.Notice("Server started")