telemetry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterShardingStart added in v0.5.0

func AfterShardingStart() error

func Close added in v0.5.0

func Close() error

func Init

func Init(c *Config) error

Init create the global telemetry center according to the config.

func Register

func Register(name string, server Server, isDefault bool)

Types

type Config

type Config struct {
	Cluster  string `mapstructure:"cluster"`  // The cluster name.
	Service  string `mapstructure:"service"`  // The service name.
	Instance string `mapstructure:"instance"` // The instance name.

	// Telemetry export type, support "prometheus", "metrics_service" or "none"
	ExportType string `mapstructure:"export_type"`
	// Export telemetry data through Prometheus server, only works on "export_type=prometheus".
	Prometheus PrometheusConfig `mapstructure:"prometheus"`
	// Export telemetry data through native meter format to OAP backend, only works on "export_type=metrics_service".
	MetricsService MetricsServiceConfig `mapstructure:"metrics_service"`
}

Config defines the common telemetry labels.

type Counter

type Counter interface {
	Metric
	Inc(labelValues ...string)
	Add(val float64, labelValues ...string)
}

func NewCounter

func NewCounter(name, help string, labels ...string) Counter

type DynamicGauge added in v0.4.0

type DynamicGauge interface {
	Metric
	Inc(labelValues ...string)
	Dec(labelValues ...string)
}

func NewDynamicGauge added in v0.4.0

func NewDynamicGauge(name, help string, labels ...string) DynamicGauge

type Gauge added in v0.4.0

type Gauge interface {
	Metric
}

func NewGauge added in v0.4.0

func NewGauge(name, help string, getter func() float64, labels ...string) Gauge

type Metric added in v0.5.0

type Metric interface {
}

type MetricsServiceConfig added in v0.5.0

type MetricsServiceConfig struct {
	ClientName   string `mapstructure:"client_name"`   // The grpc-client plugin name, using the SkyWalking native batch meter protocol
	Interval     int    `mapstructure:"interval"`      // The interval second for sending metrics
	MetricPrefix string `mapstructure:"metric_prefix"` // The prefix of telemetry metric name
}

type PrometheusConfig added in v0.5.0

type PrometheusConfig struct {
	Address  string `mapstructure:"address"`  // The prometheus server address.
	Endpoint string `mapstructure:"endpoint"` // The prometheus server metrics endpoint.
}

type Server added in v0.5.0

type Server interface {
	Start(config *Config) error
	AfterSharingStart() error
	Close() error

	NewCounter(name, help string, labels ...string) Counter
	NewGauge(name, help string, getter func() float64, labels ...string) Gauge
	NewDynamicGauge(name, help string, labels ...string) DynamicGauge
	NewTimer(name, help string, labels ...string) Timer
}

type TimeRecorder added in v0.4.0

type TimeRecorder interface {
	Stop()
}

type Timer added in v0.4.0

type Timer interface {
	Metric
	Start(labelValues ...string) TimeRecorder
	AddTime(t time.Duration, labelValues ...string)
}

func NewTimer added in v0.4.0

func NewTimer(name, help string, labels ...string) Timer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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