Пример #1
0
	"strings"
	"sync"
	"time"

	"gopnik"

	"github.com/op/go-logging"
	"github.com/orofarne/hmetrics2"
)

var log = logging.MustGetLogger("global")

var hReqT = hmetrics2.MustRegisterPackageMetric("request_time", hmetrics2.NewHistogram()).(*hmetrics2.Histogram)
var hCacheT = hmetrics2.MustRegisterPackageMetric("cache_time", hmetrics2.NewHistogram()).(*hmetrics2.Histogram)
var hRenderT = hmetrics2.MustRegisterPackageMetric("render_time", hmetrics2.NewHistogram()).(*hmetrics2.Histogram)
var hReq200 = hmetrics2.MustRegisterPackageMetric("code_200", hmetrics2.NewCounter()).(*hmetrics2.Counter)
var hReq400 = hmetrics2.MustRegisterPackageMetric("code_400", hmetrics2.NewCounter()).(*hmetrics2.Counter)
var hReq500 = hmetrics2.MustRegisterPackageMetric("code_500", hmetrics2.NewCounter()).(*hmetrics2.Counter)

type renderResponse struct {
	Error error
	Tile  []byte
}

type renderTask struct {
	gopnik.TileCoord
	ResultCh []chan renderResponse
}

type RouterServer struct {
	router  *TileRouter
Пример #2
0
	"time"

	"github.com/op/go-logging"
	"github.com/orofarne/hmetrics2"

	"app"
	"gopnik"
	"gopnikrpc"
	"perflog"
	"tilerender"
)

var log = logging.MustGetLogger("global")

var hReqT = hmetrics2.MustRegisterPackageMetric("request_time", hmetrics2.NewHistogram()).(*hmetrics2.Histogram)
var hReqOk = hmetrics2.MustRegisterPackageMetric("request_ok", hmetrics2.NewCounter()).(*hmetrics2.Counter)
var hReqErr = hmetrics2.MustRegisterPackageMetric("request_err", hmetrics2.NewCounter()).(*hmetrics2.Counter)

type TileServer struct {
	renders     *tilerender.MultiRenderPool
	cache       gopnik.CachePluginInterface
	saveList    *list.List
	saveListMu  sync.RWMutex
	removeDelay time.Duration
}

type saveQueueElem struct {
	gopnik.TileCoord
	Data []gopnik.Tile
}