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

@@ -1,6 +1,9 @@
package pwd
import "log"
import (
"log"
"time"
)
type Client struct {
Id string
@@ -14,12 +17,14 @@ type ViewPort struct {
}
func (p *pwd) ClientNew(id string, session *Session) *Client {
defer observeAction("ClientNew", time.Now())
c := &Client{Id: id, session: session}
session.clients = append(session.clients, c)
return c
}
func (p *pwd) ClientResizeViewPort(c *Client, cols, rows uint) {
defer observeAction("ClientResizeViewPort", time.Now())
c.viewPort.Rows = rows
c.viewPort.Cols = cols
@@ -27,6 +32,7 @@ func (p *pwd) ClientResizeViewPort(c *Client, cols, rows uint) {
}
func (p *pwd) ClientClose(client *Client) {
defer observeAction("ClientClose", time.Now())
// Client has disconnected. Remove from session and recheck terminal sizes.
session := client.session
for i, cl := range session.clients {