ipfs-cluster: github.com/ipfs/ipfs-cluster/observations Index | Files

package observations

import "github.com/ipfs/ipfs-cluster/observations"

Index

Package Files

config.go metrics.go setup.go

Constants

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

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

keys

var (
    // Pins counts the number of pins ipfs-cluster is tracking.
    Pins = stats.Int64("cluster/pin_count", "Number of pins", stats.UnitDimensionless)
    // TrackerPins counts the number of pins the local peer is tracking.
    TrackerPins = stats.Int64("pintracker/pin_count", "Number of pins", stats.UnitDimensionless)
    // Peers counts the number of ipfs-cluster peers are currently in the cluster.
    Peers = stats.Int64("cluster/peers", "Number of cluster peers", stats.UnitDimensionless)
    // Alerts is the number of alerts that have been sent due to peers not sending "ping" heartbeats in time.
    Alerts = stats.Int64("cluster/alerts", "Number of alerts triggered", stats.UnitDimensionless)
)

metrics

var (
    PinsView = &view.View{
        Measure:     Pins,
        TagKeys:     []tag.Key{HostKey},
        Aggregation: view.LastValue(),
    }

    TrackerPinsView = &view.View{
        Measure:     TrackerPins,
        TagKeys:     []tag.Key{HostKey},
        Aggregation: view.LastValue(),
    }

    PeersView = &view.View{
        Measure:     Peers,
        TagKeys:     []tag.Key{HostKey},
        Aggregation: view.LastValue(),
    }

    AlertsView = &view.View{
        Measure:     Alerts,
        TagKeys:     []tag.Key{HostKey, RemotePeerKey},
        Aggregation: messageCountDistribution,
    }

    DefaultViews = []*view.View{
        PinsView,
        TrackerPinsView,
        PeersView,
        AlertsView,
    }
)

views, which is just the aggregation of the metrics

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

attributes

func SetupMetrics Uses

func SetupMetrics(cfg *MetricsConfig) error

SetupMetrics configures and starts stats tooling, if enabled.

type JaegerTracer Uses

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

JaegerTracer implements ipfscluster.Tracer.

func SetupTracing Uses

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

SetupTracing configures and starts tracing tooling, if enabled.

func (*JaegerTracer) SetClient Uses

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

SetClient no-op.

func (*JaegerTracer) Shutdown Uses

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

Shutdown the tracer and flush any remaining traces.

type MetricsConfig Uses

type MetricsConfig struct {
    config.Saver

    EnableStats        bool
    PrometheusEndpoint ma.Multiaddr
    ReportingInterval  time.Duration
}

MetricsConfig configures metrics collection.

func (*MetricsConfig) ApplyEnvVars Uses

func (cfg *MetricsConfig) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*MetricsConfig) ConfigKey Uses

func (cfg *MetricsConfig) ConfigKey() string

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

func (*MetricsConfig) Default Uses

func (cfg *MetricsConfig) Default() error

Default sets the fields of this Config to sensible values.

func (*MetricsConfig) LoadJSON Uses

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 Uses

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

ToDisplayJSON returns JSON config as a string.

func (*MetricsConfig) ToJSON Uses

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

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

func (*MetricsConfig) Validate Uses

func (cfg *MetricsConfig) Validate() error

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

type TracingConfig Uses

type TracingConfig struct {
    config.Saver

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

TracingConfig configures tracing.

func (*TracingConfig) ApplyEnvVars Uses

func (cfg *TracingConfig) ApplyEnvVars() error

ApplyEnvVars fills in any Config fields found as environment variables.

func (*TracingConfig) ConfigKey Uses

func (cfg *TracingConfig) ConfigKey() string

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

func (*TracingConfig) Default Uses

func (cfg *TracingConfig) Default() error

Default sets the fields of this Config to sensible values.

func (*TracingConfig) LoadJSON Uses

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 Uses

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

ToDisplayJSON returns JSON config as a string.

func (*TracingConfig) ToJSON Uses

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

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

func (*TracingConfig) Validate Uses

func (cfg *TracingConfig) Validate() error

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

Package observations imports 24 packages (graph) and is imported by 3 packages. Updated 2020-10-24. Refresh now. Tools for package owners.