metrics

package
v0.0.0-...-ab8d13a Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package metrics provides a service for reporting metrics to Stackdriver, or locally during development.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MonitoredResource

type MonitoredResource mrpb.MonitoredResource

MonitoredResource wraps a *mrpb.MonitoredResource to implement the monitoredresource.MonitoredResource interface.

func GAEResource

func GAEResource(ctx context.Context) (*MonitoredResource, error)

GAEResource returns a *MonitoredResource with fields populated and for StackDriver.

The resource will be in StackDrvier's gae_instance type.

func GCEResource

func GCEResource(jobName string) (*MonitoredResource, error)

GCEResource populates a MonitoredResource with GCE Metadata.

The returned MonitoredResource will have the type set to "generic_task".

func (*MonitoredResource) MonitoredResource

func (r *MonitoredResource) MonitoredResource() (resType string, labels map[string]string)

type Service

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

Service controls metric exporters.

func NewService

func NewService(resource *MonitoredResource, views []*view.View) (*Service, error)

NewService initializes a *Service.

The Service returned is configured to send metric data to StackDriver. When not running on GCE, it will host metrics through a prometheus HTTP handler.

views will be passed to view.Register for export to the metric service.

func (*Service) ServeHTTP

func (m *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) Stop

func (m *Service) Stop()

Stop flushes metrics and stops exporting. Stop should be called before exiting.

Jump to

Keyboard shortcuts

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