Documentation
¶
Index ¶
- Variables
- func GetTraceInfoFromContext(ctx context.Context) (traceId, pSpanId, spanId string)
- func JaegerTrace(next echo.HandlerFunc) echo.HandlerFunc
- func NewTracer(serviceName string, options ...config.Option) (closer io.Closer, err error)
- type CountRecord
- type GaugeRecord
- type HistogramRecord
- type Metric
- func (m *Metric) Counter(metric metrics.Options) metrics.Counter
- func (m *Metric) Gauge(metric metrics.Options) metrics.Gauge
- func (m *Metric) Histogram(metric metrics.HistogramOptions) metrics.Histogram
- func (m *Metric) Namespace(scope metrics.NSOptions) metrics.Factory
- func (m *Metric) PrintLog()
- func (m *Metric) Timer(metric metrics.TimerOptions) metrics.Timer
- type NamespaceRecord
- type TimeRecord
Constants ¶
This section is empty.
Variables ¶
View Source
var JaegerConfig struct { AgentUrl string `json:"agent_url"` CollectorUrl string `json:"collector_url"` Probability float64 `json:"probability"` }
jaeger 相关配置信息
Functions ¶
func GetTraceInfoFromContext ¶
从 context 获取 trace 信息
func JaegerTrace ¶
func JaegerTrace(next echo.HandlerFunc) echo.HandlerFunc
jaeger 中间件,用于对每个请求生成一个span,并使用opentracing生成的spanID作为日志的spanID
Types ¶
type GaugeRecord ¶
type GaugeRecord struct { Option metrics.Options `json:"option"` RecordValue int64 `json:"record_value"` }
func (*GaugeRecord) Update ¶
func (g *GaugeRecord) Update(n int64)
type HistogramRecord ¶
type HistogramRecord struct { Option metrics.HistogramOptions `json:"option"` RecordValue float64 `json:"record_value"` }
func (*HistogramRecord) Record ¶
func (h *HistogramRecord) Record(n float64)
type Metric ¶
type Metric struct { CounterRecord []*CountRecord `json:"counter_record,omitempty"` TimerRecord []*TimeRecord `json:"timer_record,omitempty"` GaugeRecord []*GaugeRecord `json:"gauge_record,omitempty"` HistogramRecord []*HistogramRecord `json:"histogram_record,omitempty"` NamespaceRecord []*NamespaceRecord `json:"namespace_record,omitempty"` }
自定义集中式度量系统 metrics
type NamespaceRecord ¶
type TimeRecord ¶
type TimeRecord struct { Option metrics.TimerOptions `json:"option"` RecordTime time.Duration `json:"record_time"` }
func (*TimeRecord) Record ¶
func (t *TimeRecord) Record(dur time.Duration)
Click to show internal directories.
Click to hide internal directories.