More prometheus metrics

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-06-14 20:59:50 -03:00
parent 8f247794bb
commit 6c8c21618b
6 changed files with 72 additions and 1 deletions

View File

@@ -52,6 +52,8 @@ type Session struct {
}
func (p *pwd) SessionNew(duration time.Duration, stack, stackName string) (*Session, error) {
defer observeAction("SessionNew", time.Now())
sessionsMutex.Lock()
defer sessionsMutex.Unlock()
@@ -151,6 +153,7 @@ func (p *pwd) SessionGetSmallestViewPort(s *Session) ViewPort {
}
func (p *pwd) SessionDeployStack(s *Session) error {
defer observeAction("SessionDeployStack", time.Now())
if s.Ready {
// a stack was already deployed on this session, just ignore
return nil
@@ -190,11 +193,13 @@ func (p *pwd) SessionDeployStack(s *Session) error {
}
func (p *pwd) SessionGet(sessionId string) *Session {
defer observeAction("SessionGet", time.Now())
s := sessions[sessionId]
return s
}
func (p *pwd) SessionLoadAndPrepare() error {
defer observeAction("SessionLoadAndPrepare", time.Now())
err := p.storage.Load()
if err != nil {
return err
@@ -232,6 +237,7 @@ func (p *pwd) SessionLoadAndPrepare() error {
}
func (p *pwd) SessionSetup(session *Session, conf SessionSetupConf) error {
defer observeAction("SessionSetup", time.Now())
var tokens *docker.SwarmTokens = nil
var firstSwarmManager *Instance = nil