observability

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 33

Documentation

Overview

Package observability sets up and configures observability tools.

Package observability sets up and configures observability tools.

Package observability sets up and configures observability tools.

Package observability sets up and configures observability tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStackdriverMonitoredResoruce

func NewStackdriverMonitoredResoruce(c *StackdriverConfig) monitoredresource.Interface

Types

type Config

type Config struct {
	ExporterType ExporterType `env:"OBSERVABILITY_EXPORTER, default=STACKDRIVER"`

	OpenCensus  *OpenCensusConfig
	Stackdriver *StackdriverConfig
}

Config holds all of the configuration options for the observability exporter

type Exporter

type Exporter interface {
	io.Closer
	StartExporter() error
}

Exporter defines the minimum shared functionality for an observability exporter used by this application.

func NewFromEnv

func NewFromEnv(ctx context.Context, config *Config) (Exporter, error)

NewFromEnv returns the observability exporter given the provided configuration, or an error if it failed to be created.

func NewNoop

func NewNoop(_ context.Context) (Exporter, error)

func NewOpenCensus

func NewOpenCensus(ctx context.Context, config *OpenCensusConfig) (Exporter, error)

NewOpenCensus creates a new metrics and trace exporter for OpenCensus.

func NewStackdriver

func NewStackdriver(ctx context.Context, config *StackdriverConfig) (Exporter, error)

NewStackdriver creates a new metrics and trace exporter for Stackdriver.

type ExporterType

type ExporterType string

ExporterType represents a type of observability exporter.

const (
	ExporterStackdriver ExporterType = "STACKDRIVER"
	ExporterPrometheus  ExporterType = "PROMETHEUS"
	ExporterOCAgent     ExporterType = "OCAGENT"
	ExporterNoop        ExporterType = "NOOP"
)

type OpenCensusConfig

type OpenCensusConfig struct {
	SampleRate float64 `env:"TRACE_PROBABILITY, default=0.40"`

	Insecure bool   `env:"OCAGENT_INSECURE"`
	Endpoint string `env:"OCAGENT_TRACE_EXPORTER_ENDPOINT"`
}

OpenCensusConfig holds the configuration options for the open census exporter

type StackdriverConfig

type StackdriverConfig struct {
	SampleRate float64 `env:"TRACE_PROBABILITY, default=0.40"`

	ProjectID string `env:"PROJECT_ID, default=$GOOGLE_CLOUD_PROJECT"`

	// Knative+Cloud Run container contract envvars:
	//
	// https://cloud.google.com/run/docs/reference/container-contract#env-vars
	//
	// If present, can be used to configured the Stackdriver MonitoredResource
	// correctly.
	Service   string `env:"K_SERVICE"`
	Revision  string `env:"K_REVISION"`
	Namespace string `env:"K_CONFIGURATION, default=en"`
}

StackdriverConfig holds the configuration options for the stackdriver exporter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL