package metrics

import "github.com/lightstep/lightstep-tracer-go/internal/metrics"

Index

Constants

const (
	ReporterPlatformKey        = "lightstep.reporter_platform"
	ReporterPlatformVersionKey = "lightstep.reporter_platform_version"
	ReporterVersionKey         = "lightstep.reporter_version"
)

Types

type CPU

type CPU struct {
	User   float64
	System float64
	Usage  float64
	Total  float64
}

type Memory

type Memory struct {
	Available uint64
	Total     uint64
	HeapAlloc uint64
}

type Metrics

type Metrics struct {
	ProcessCPU ProcessCPU
	CPU        map[string]CPU
	NIC        map[string]NIC
	Memory     Memory
	Runtime    Runtime
}

func Measure

func Measure(ctx context.Context) (Metrics, error)

type NIC

type NIC struct {
	BytesReceived uint64
	BytesSent     uint64
}

type ProcessCPU

type ProcessCPU struct {
	User   float64
	System float64
}

type Reporter

type Reporter struct {
	Start        time.Time
	End          time.Time
	MetricsCount int
	// contains filtered or unexported fields
}

func NewReporter

func NewReporter(opts ...ReporterOption) *Reporter

func (*Reporter) Measure

func (r *Reporter) Measure(ctx context.Context, intervals int64) error

Measure takes a snapshot of system metrics and sends them to a LightStep endpoint.

type ReporterOption

type ReporterOption func(*config)

func WithReporterAccessToken

func WithReporterAccessToken(accessToken string) ReporterOption

WithReporterAccessToken sets an access token for communicating with LightStep

func WithReporterAddress

func WithReporterAddress(address string) ReporterOption

WithReporterAddress sets the address of the LightStep endpoint

func WithReporterAttributes

func WithReporterAttributes(attributes map[string]string) ReporterOption

WithReporterAttributes sets attributes reported back to LightStep

func WithReporterMeasurementDuration

func WithReporterMeasurementDuration(measurementDuration time.Duration) ReporterOption

WithReporterMeasurementDuration sets the duration reported back to LightStep

func WithReporterTimeout

func WithReporterTimeout(timeout time.Duration) ReporterOption

WithReporterTimeout sets the timeout when communicating with LightStep

func WithReporterTracerID

func WithReporterTracerID(tracerID uint64) ReporterOption

WithReporterTracerID sets the tracer ID reported back to LightStep

type Runtime

type Runtime struct {
	NumGC        uint64
	NumGoroutine uint64
}

Source Files

metrics.go package.go reporter.go

Version
v0.21.0
Published
Aug 12, 2020
Platform
windows/amd64
Imports
21 packages
Last checked
7 hours ago

Tools for package owners.