Documentation
¶
Index ¶
Constants ¶
const ( DefaultEnableStats = false DefaultPrometheusEndpoint = "/ip4/0.0.0.0/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 ( // PinCountMetric counts the number of pins ipfs-cluster is tracking. PinCountMetric = stats.Int64("cluster/pin_count", "Number of pins", stats.UnitDimensionless) // TrackerPinCountMetric counts the number of pins the local peer is tracking. TrackerPinCountMetric = stats.Int64("pintracker/pin_count", "Number of pins", stats.UnitDimensionless) // PeerCountMetric counts the number of ipfs-cluster peers are currently in the cluster. PeerCountMetric = stats.Int64("cluster/peer_count", "Number of cluster peers", stats.UnitDimensionless) )
opencensus metrics
var ( PinCountView = &view.View{ Measure: PinCountMetric, Aggregation: view.Sum(), } TrackerPinCountView = &view.View{ Measure: TrackerPinCountMetric, TagKeys: []tag.Key{HostKey}, Aggregation: view.Sum(), } PeerCountView = &view.View{ Measure: PeerCountMetric, TagKeys: []tag.Key{HostKey}, Aggregation: view.Count(), } DefaultViews = []*view.View{ PinCountView, TrackerPinCountView, PeerCountView, } )
opencensus views, which is just the aggregation of the metrics
var (
ClientIPAttribute = "http.client.ip"
)
opencensus attributes
var (
HostKey = makeKey("host")
)
opencensus keys
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.
type MetricsConfig ¶
type MetricsConfig struct { config.Saver EnableStats bool PrometheusEndpoint ma.Multiaddr ReportingInterval time.Duration }
MetricsConfig configures metrics collection.
func (*MetricsConfig) ApplyEnvVars ¶ added in v0.10.0
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) 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 ¶ added in v0.10.0
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) 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.