luci: go.chromium.org/luci/appengine/tsmon Index | Files

package tsmon

import "go.chromium.org/luci/appengine/tsmon"

Package tsmon adapts common/tsmon library to GAE environment.

It configures tsmon state with a monitor and store suitable for GAE environment and controls when metric flushes happen.

Timeseries metrics are gathered automatically by the tsmon middleware and staged in memory for export. Periodically, an unlucky single handler will be chosen to perform this export at the end of its operation.

A cron task MUST also be installed if metrics are enabled. The task assigns and manages the task number assignments for active instances. If this cron task is not installed, instances will not get IDs and will be unable to send metrics. The cron task should be configured to hit: "/internal/cron/ts_mon/housekeeping" every minute.

Index

Package Files

doc.go globalmetrics.go housekeeping.go tasknum.go

Constants

const DatastoreNamespace = "ts_mon_instance_namespace"

DatastoreNamespace is a datastore namespace with all tsmon state.

func AssignTaskNumbers Uses

func AssignTaskNumbers(c context.Context) error

AssignTaskNumbers updates the set of task number requests created with DatastoreTaskNumAllocator.

It assigns unique task numbers to those without ones set, and expires old ones (thus reclaiming task numbers assigned to them).

Must be used from some (global per project) cron if DatastoreTaskNumAllocator is used. Use 'InstallHandlers' to install the corresponding cron handler.

func InstallHandlers Uses

func InstallHandlers(r *router.Router, base router.MiddlewareChain)

InstallHandlers installs HTTP handlers for tsmon routes.

type DatastoreTaskNumAllocator Uses

type DatastoreTaskNumAllocator struct {
}

DatastoreTaskNumAllocator implements TaskNumAllocator on top of datastore.

Its NotifyTaskIsAlive registers a claim for a task number, which is later fulfilled by the housekeeping cron (see AssignTaskNumbers).

func (DatastoreTaskNumAllocator) NotifyTaskIsAlive Uses

func (DatastoreTaskNumAllocator) NotifyTaskIsAlive(c context.Context, task *target.Task, instanceID string) (taskNum int, err error)

NotifyTaskIsAlive is part of TaskNumAllocator interface.

Package tsmon imports 18 packages (graph) and is imported by 4 packages. Updated 2018-08-19. Refresh now. Tools for package owners.