observations

package
v0.0.0-...-dc45894 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 25 Imported by: 0

Documentation

Overview

Package observations sets up metric and trace exporting for IPFS cluster.

Index

Constants

View Source
const (
	DefaultEnableStats        = false
	DefaultPrometheusEndpoint = "/ip4/127.0.0.1/tcp/8888"
	DefaultReportingInterval  = 2 * time.Second

	DefaultEnableTracing       = false
	DefaultJaegerAgentEndpoint = "/ip4/0.0.0.0/udp/6831"
	DefaultSamplingProb        = 0.3
	DefaultServiceName         = "cluster-daemon"
)

Default values for this Config.

Variables

View Source
var (
	HostKey       = makeKey("host")
	RemotePeerKey = makeKey("remote_peer")
)

keys

View Source
var (
	// This metric is managed in state/dsstate.
	Pins = stats.Int64("pins", "Total number of cluster pins", stats.UnitDimensionless)

	// These metrics are managed by the pintracker/optracker module.
	PinsQueued   = stats.Int64("pins/pin_queued", "Current number of pins queued for pinning", stats.UnitDimensionless)
	PinsPinning  = stats.Int64("pins/pinning", "Current number of pins currently pinning", stats.UnitDimensionless)
	PinsPinError = stats.Int64("pins/pin_error", "Current number of pins in pin_error state", stats.UnitDimensionless)

	// These metrics and managed in the ipfshttp module.
	PinsIpfsPins    = stats.Int64("pins/ipfs_pins", "Current number of items pinned on IPFS", stats.UnitDimensionless)
	PinsPinAdd      = stats.Int64("pins/pin_add", "Total number of IPFS pin requests", stats.UnitDimensionless)
	PinsPinAddError = stats.Int64("pins/pin_add_errors", "Total number of failed pin requests", stats.UnitDimensionless)
	BlocksPut       = stats.Int64("blocks/put", "Total number of blocks/put requests", stats.UnitDimensionless)
	BlocksAddedSize = stats.Int64("blocks/added_size", "Total size of blocks added in bytes", stats.UnitBytes)

	BlocksAdded      = stats.Int64("blocks/added", "Total number of blocks added", stats.UnitDimensionless)
	BlocksAddedError = stats.Int64("blocks/put_errors", "Total number of block/put errors", stats.UnitDimensionless)

	InformerDisk = stats.Int64("informer/disk", "The metric value weight issued by disk informer", stats.UnitDimensionless)
)

metrics

View Source
var (
	PinsView = &view.View{
		Measure: Pins,

		Aggregation: view.LastValue(),
	}

	PinsQueuedView = &view.View{
		Measure: PinsQueued,

		Aggregation: view.LastValue(),
	}

	PinsPinningView = &view.View{
		Measure: PinsPinning,

		Aggregation: view.LastValue(),
	}

	PinsPinErrorView = &view.View{
		Measure: PinsPinError,

		Aggregation: view.LastValue(),
	}

	PinsIpfsPinsView = &view.View{
		Measure:     PinsIpfsPins,
		Aggregation: view.LastValue(),
	}

	PinsPinAddView = &view.View{
		Measure:     PinsPinAdd,
		Aggregation: view.Sum(),
	}

	PinsPinAddErrorView = &view.View{
		Measure:     PinsPinAddError,
		Aggregation: view.Sum(),
	}

	BlocksPutView = &view.View{
		Measure:     BlocksPut,
		Aggregation: view.Sum(),
	}

	BlocksAddedSizeView = &view.View{
		Measure:     BlocksAddedSize,
		Aggregation: view.Sum(),
	}

	BlocksAddedView = &view.View{
		Measure:     BlocksAdded,
		Aggregation: view.Sum(),
	}

	BlocksAddedErrorView = &view.View{
		Measure:     BlocksAddedError,
		Aggregation: view.Sum(),
	}

	InformerDiskView = &view.View{
		Measure:     InformerDisk,
		Aggregation: view.LastValue(),
	}

	DefaultViews = []*view.View{
		PinsView,
		PinsQueuedView,
		PinsPinningView,
		PinsPinErrorView,
		PinsIpfsPinsView,
		PinsPinAddView,
		PinsPinAddErrorView,
		BlocksPutView,
		BlocksAddedSizeView,
		BlocksAddedView,
		BlocksAddedErrorView,
		InformerDiskView,
	}
)

views, which is just the aggregation of the metrics

View Source
var (
	ClientIPAttribute = "http.client.ip"
)

attributes

Functions

func SetupMetrics

func SetupMetrics(cfg *MetricsConfig) error

SetupMetrics configures and starts stats tooling, if enabled.

Types

type JaegerTracer

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

JaegerTracer implements ipfscluster.Tracer.

func SetupTracing

func SetupTracing(cfg *TracingConfig) (*JaegerTracer, error)

SetupTracing configures and starts tracing tooling, if enabled.

func (*JaegerTracer) SetClient

func (t *JaegerTracer) SetClient(*rpc.Client)

SetClient no-op.

func (*JaegerTracer) Shutdown

func (t *JaegerTracer) Shutdown(context.Context) error

Shutdown the tracer and flush any remaining traces.

type MetricsConfig

type MetricsConfig struct {
	config.Saver

	EnableStats        bool
	PrometheusEndpoint ma.Multiaddr
	ReportingInterval  time.Duration
}

MetricsConfig configures metrics collection.

func (*MetricsConfig) ApplyEnvVars

func (cfg *MetricsConfig) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*MetricsConfig) ConfigKey

func (cfg *MetricsConfig) ConfigKey() string

ConfigKey provides a human-friendly identifier for this type of Config.

func (*MetricsConfig) Default

func (cfg *MetricsConfig) Default() error

Default sets the fields of this Config to sensible values.

func (*MetricsConfig) LoadJSON

func (cfg *MetricsConfig) LoadJSON(raw []byte) error

LoadJSON sets the fields of this Config to the values defined by the JSON representation of it, as generated by ToJSON.

func (*MetricsConfig) ToDisplayJSON

func (cfg *MetricsConfig) ToDisplayJSON() ([]byte, error)

ToDisplayJSON returns JSON config as a string.

func (*MetricsConfig) ToJSON

func (cfg *MetricsConfig) ToJSON() ([]byte, error)

ToJSON generates a human-friendly JSON representation of this Config.

func (*MetricsConfig) Validate

func (cfg *MetricsConfig) Validate() error

Validate checks that the fields of this Config have working values, at least in appearance.

type TracingConfig

type TracingConfig struct {
	config.Saver

	EnableTracing       bool
	JaegerAgentEndpoint ma.Multiaddr
	SamplingProb        float64
	ServiceName         string
	ClusterID           string
	ClusterPeername     string
}

TracingConfig configures tracing.

func (*TracingConfig) ApplyEnvVars

func (cfg *TracingConfig) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*TracingConfig) ConfigKey

func (cfg *TracingConfig) ConfigKey() string

ConfigKey provides a human-friendly identifier for this type of Config.

func (*TracingConfig) Default

func (cfg *TracingConfig) Default() error

Default sets the fields of this Config to sensible values.

func (*TracingConfig) LoadJSON

func (cfg *TracingConfig) LoadJSON(raw []byte) error

LoadJSON sets the fields of this Config to the values defined by the JSON representation of it, as generated by ToJSON.

func (*TracingConfig) ToDisplayJSON

func (cfg *TracingConfig) ToDisplayJSON() ([]byte, error)

ToDisplayJSON returns JSON config as a string.

func (*TracingConfig) ToJSON

func (cfg *TracingConfig) ToJSON() ([]byte, error)

ToJSON generates a human-friendly JSON representation of this Config.

func (*TracingConfig) Validate

func (cfg *TracingConfig) Validate() error

Validate checks that the fields of this Config have working values, at least in appearance.

Jump to

Keyboard shortcuts

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