telemetry

package
v0.0.0-...-fd07d66 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-2-Clause-Patent Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricTypeUnknown    MetricType = 0
	MetricTypeCounter    MetricType = C.D_TM_COUNTER
	MetricTypeDuration   MetricType = C.D_TM_DURATION
	MetricTypeGauge      MetricType = C.D_TM_GAUGE
	MetricTypeStatsGauge MetricType = C.D_TM_STATS_GAUGE
	MetricTypeSnapshot   MetricType = C.D_TM_TIMER_SNAPSHOT
	MetricTypeTimestamp  MetricType = C.D_TM_TIMESTAMP
	MetricTypeDirectory  MetricType = C.D_TM_DIRECTORY
	MetricTypeLink       MetricType = C.D_TM_LINK

	ClientJobRootID         = C.DC_TM_JOB_ROOT_ID
	ClientJobMax            = 1024
	ClientMetricsEnabledEnv = C.DAOS_CLIENT_METRICS_ENABLE
	ClientMetricsRetainEnv  = C.DAOS_CLIENT_METRICS_RETAIN

	BadUintVal  = ^uint64(0)
	BadFloatVal = float64(BadUintVal)
	BadIntVal   = int64(BadUintVal >> 1)
	BadDuration = time.Duration(BadIntVal)

	PathSep = filepath.Separator
)
View Source
const (
	PromexpIDBase = 200
	AgentIDBase   = 300
)

Variables

This section is empty.

Functions

func AddTestMetric

func AddTestMetric(t *testing.T, tm *TestMetric)

func AddTestMetrics

func AddTestMetrics(t *testing.T, testMetrics TestMetricsMap)

func CleanupTestMetricsProducer

func CleanupTestMetricsProducer(t *testing.T)

func CollectMetrics

func CollectMetrics(ctx context.Context, s *Schema, out chan<- Metric) error

func Detach

func Detach(ctx context.Context)

Detach detaches from the telemetry handle

func Fini

func Fini()

Fini releases resources claimed by Init().

func GetAPIVersion

func GetAPIVersion() int

func GetRank

func GetRank(ctx context.Context) (uint32, error)

func Init

func Init(parent context.Context, id uint32) (context.Context, error)

Init initializes the telemetry bindings

func InitClientRoot

func InitClientRoot(ctx context.Context) (context.Context, error)

func InitTestMetricsProducer

func InitTestMetricsProducer(t *testing.T, id int, size uint64)

func NextTestID

func NextTestID(base ...int) int

NextTestID gets the next available ID for a shmem segment. This helps avoid conflicts amongst tests running concurrently. Different packages should use different bases.

func PruneUnusedSegments

func PruneUnusedSegments(ctx context.Context, maxSegAge time.Duration) error

PruneUnusedSegments removes shared memory segments associated with unused ephemeral subdirectories.

func RemoveTestMetrics

func RemoveTestMetrics(t *testing.T, testMetrics TestMetricsMap)

func SetupClientRoot

func SetupClientRoot(ctx context.Context, jobid string, pid, shm_key int) error

SetupClientRoot performs the necessary actions to get the client telemetry segment linked into the agent-managed tree.

Types

type Counter

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

func GetCounter

func GetCounter(ctx context.Context, name string) (*Counter, error)

func (*Counter) Desc

func (mb *Counter) Desc() string

func (*Counter) FloatValue

func (c *Counter) FloatValue() float64

func (*Counter) FullPath

func (mb *Counter) FullPath() string

func (*Counter) Name

func (mb *Counter) Name() string

func (*Counter) Path

func (mb *Counter) Path() string

func (*Counter) String

func (mb *Counter) String() string

func (*Counter) Type

func (c *Counter) Type() MetricType

func (*Counter) Units

func (mb *Counter) Units() string

func (*Counter) Value

func (c *Counter) Value() uint64

type Duration

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

func GetDuration

func GetDuration(ctx context.Context, name string) (*Duration, error)

func (*Duration) FloatValue

func (d *Duration) FloatValue() float64

func (*Duration) Max

func (sm *Duration) Max() uint64

func (*Duration) Mean

func (sm *Duration) Mean() float64

func (*Duration) Min

func (sm *Duration) Min() uint64

func (*Duration) SampleSize

func (sm *Duration) SampleSize() uint64

func (*Duration) StdDev

func (sm *Duration) StdDev() float64

func (*Duration) Sum

func (sm *Duration) Sum() uint64

func (*Duration) SumSquares

func (sm *Duration) SumSquares() float64

func (*Duration) Type

func (d *Duration) Type() MetricType

func (*Duration) Value

func (d *Duration) Value() time.Duration

type Gauge

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

Gauge is a metric that consists of a single value that may increase or decrease.

func GetGauge

func GetGauge(ctx context.Context, name string) (*Gauge, error)

GetGauge finds the gauge with the requested name in the telemetry tree.

func (*Gauge) Desc

func (mb *Gauge) Desc() string

func (*Gauge) FloatValue

func (g *Gauge) FloatValue() float64

FloatValue returns the value as a float.

func (*Gauge) FullPath

func (mb *Gauge) FullPath() string

func (*Gauge) Name

func (mb *Gauge) Name() string

func (*Gauge) Path

func (mb *Gauge) Path() string

func (*Gauge) String

func (mb *Gauge) String() string

func (*Gauge) Type

func (g *Gauge) Type() MetricType

Type returns the type of gauge.

func (*Gauge) Units

func (mb *Gauge) Units() string

func (*Gauge) Value

func (g *Gauge) Value() uint64

Value returns the value as an unsigned integer.

type Metric

type Metric interface {
	Path() string
	Name() string
	FullPath() string
	Type() MetricType
	Desc() string
	Units() string
	FloatValue() float64
	String() string
}

type MetricType

type MetricType int

func (MetricType) String

func (mt MetricType) String() string

type Schema

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

func NewSchema

func NewSchema() *Schema

func (*Schema) Add

func (s *Schema) Add(hdl *handle, id string, typ C.int, node *C.struct_d_tm_node_t) Metric

func (*Schema) Prune

func (s *Schema) Prune()

type Snapshot

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

func GetSnapshot

func GetSnapshot(ctx context.Context, name string) (*Snapshot, error)

func (*Snapshot) Desc

func (mb *Snapshot) Desc() string

func (*Snapshot) FloatValue

func (s *Snapshot) FloatValue() float64

func (*Snapshot) FullPath

func (mb *Snapshot) FullPath() string

func (*Snapshot) Name

func (mb *Snapshot) Name() string

func (*Snapshot) Path

func (mb *Snapshot) Path() string

func (*Snapshot) String

func (mb *Snapshot) String() string

func (*Snapshot) Type

func (s *Snapshot) Type() MetricType

func (*Snapshot) Units

func (mb *Snapshot) Units() string

func (*Snapshot) Value

func (s *Snapshot) Value() time.Time

type StatsGauge

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

StatsGauge is a gauge with statistics gathered.

func GetStatsGauge

func GetStatsGauge(ctx context.Context, name string) (*StatsGauge, error)

GetStatsGauge finds the gauge with statistics with the given name in the telemetry tree.

func (*StatsGauge) FloatValue

func (g *StatsGauge) FloatValue() float64

FloatValue returns the gauge value as a float.

func (*StatsGauge) Max

func (sm *StatsGauge) Max() uint64

func (*StatsGauge) Mean

func (sm *StatsGauge) Mean() float64

func (*StatsGauge) Min

func (sm *StatsGauge) Min() uint64

func (*StatsGauge) SampleSize

func (sm *StatsGauge) SampleSize() uint64

func (*StatsGauge) StdDev

func (sm *StatsGauge) StdDev() float64

func (*StatsGauge) Sum

func (sm *StatsGauge) Sum() uint64

func (*StatsGauge) SumSquares

func (sm *StatsGauge) SumSquares() float64

func (*StatsGauge) Type

func (g *StatsGauge) Type() MetricType

Type returns the type of the gauge with stats.

func (*StatsGauge) Value

func (g *StatsGauge) Value() uint64

Value returns the gauge value as an unsigned integer.

type StatsMetric

type StatsMetric interface {
	Metric
	Min() uint64
	Max() uint64
	Sum() uint64
	Mean() float64
	StdDev() float64
	SumSquares() float64
	SampleSize() uint64
}

type TestMetric

type TestMetric struct {
	Type MetricType
	Name string

	Cur    float64 // value - may be exact or approximate
	Values []uint64
	// contains filtered or unexported fields
}

func (*TestMetric) FullPath

func (tm *TestMetric) FullPath() string

func (*TestMetric) GetMetric

func (tm *TestMetric) GetMetric(ctx context.Context) (Metric, error)

type TestMetricsMap

type TestMetricsMap map[MetricType]*TestMetric

type Timestamp

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

func GetTimestamp

func GetTimestamp(ctx context.Context, name string) (*Timestamp, error)

func (*Timestamp) Desc

func (mb *Timestamp) Desc() string

func (*Timestamp) FloatValue

func (t *Timestamp) FloatValue() float64

FloatValue converts the timestamp to time in seconds since the UNIX epoch.

func (*Timestamp) FullPath

func (mb *Timestamp) FullPath() string

func (*Timestamp) Name

func (mb *Timestamp) Name() string

func (*Timestamp) Path

func (mb *Timestamp) Path() string

func (*Timestamp) String

func (mb *Timestamp) String() string

func (*Timestamp) Type

func (t *Timestamp) Type() MetricType

func (*Timestamp) Units

func (mb *Timestamp) Units() string

func (*Timestamp) Value

func (t *Timestamp) Value() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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