Documentation

Overview

    Package metrics provides common metrics code for Lucifer.

    Monitoring configuration is global to the program. This package sets up Stackdriver Trace, BigQuery, and tsmon.

    The GOOGLE_APPLICATION_CREDENTIALS environment variable specifies the GCP service account credentials for metrics.

    A top level trace is set up with the program name, taken from the first command argument.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	// StartCounter is a tsmon counter for lucifer start events.
    	StartCounter = metric.NewCounter(
    		"chromeos/lucifer/run_job/start",
    		"lucifer start events",
    		nil)
    )

    Functions

    This section is empty.

    Types

    type BQClient

    type BQClient struct {
    	// contains filtered or unexported fields
    }

      A BQClient emits BigQuery events.

      func (BQClient) HostStatusEvent

      func (c BQClient) HostStatusEvent(ctx context.Context, hostname string, e event.Event)

        HostStatusEvent inserts a host status event in BigQuery.

        type Client

        type Client struct {
        	// contains filtered or unexported fields
        }

          Client represents all of the monitoring component clients. The client should be closed after use.

          func Setup

          func Setup(ctx context.Context, logger logdog.Logger, c Config) (context.Context, *Client)

            Setup configures monitoring based on the given Config. Make sure to close the client after use. Errors in setting up monitoring components will be logged and ignored so the caller does not need to worry about stopping the entire program (better to have no metrics and think there is an outage than to actually have an outage).

            func (*Client) BigQuery

            func (c *Client) BigQuery() BQClient

              BigQuery returns a dispatcher for BigQuery actions.

              func (*Client) Close

              func (c *Client) Close() error

                Close closes the monitoring client components.

                type Config

                type Config struct {
                	GCPProject string
                }

                  Config describes configuration for Setup.