Documentation

Overview

    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

    Constants

    View Source
    const DatastoreNamespace = "ts_mon_instance_namespace"

      DatastoreNamespace is a datastore namespace with all tsmon state.

      Variables

      This section is empty.

      Functions

      func AssignTaskNumbers

      func AssignTaskNumbers(ctx 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

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

          InstallHandlers installs HTTP handlers for tsmon routes.

          Types

          type DatastoreTaskNumAllocator

          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

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

              NotifyTaskIsAlive is part of TaskNumAllocator interface.