 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  
const (
	AppName = "metric"
)
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiStatsCollector ¶ added in v2.0.31
type ApiStatsCollector struct {
	ApiStatsConfig
	HttpRequestTotal             *prometheus.CounterVec
	HttpRequestDurationHistogram *prometheus.HistogramVec
	HttpRequestDurationSummary   *prometheus.SummaryVec
}
    func NewApiStatsCollector ¶ added in v2.0.31
func NewApiStatsCollector(conf ApiStatsConfig, appName string) *ApiStatsCollector
func (*ApiStatsCollector) Collect ¶ added in v2.0.31
func (h *ApiStatsCollector) Collect(ch chan<- prometheus.Metric)
func (*ApiStatsCollector) Describe ¶ added in v2.0.31
func (h *ApiStatsCollector) Describe(ch chan<- *prometheus.Desc)
type ApiStatsConfig ¶ added in v2.0.31
type ApiStatsConfig struct {
	Enable                     bool      `toml:"enable" json:"enable" yaml:"enable" env:"ENABLE"`
	AppConstLabelKey           string    `toml:"app_const_label_key" json:"app_const_label_key" yaml:"app_const_label_key" env:"APP_CONST_LABEL_KEY"`
	RequestHistogram           bool      `toml:"request_histogram" json:"request_histogram" yaml:"request_histogram" env:"REQUEST_HISTOGRAM"`
	RequestHistogramName       string    `toml:"request_histogram_name" json:"request_histogram_name" yaml:"request_histogram_name" env:"REQUEST_HISTOGRAM_NAME"`
	RequestHistogramBucket     []float64 `` /* 143-byte string literal not displayed */
	RequestSummary             bool      `toml:"request_summary" json:"request_summary" yaml:"request_summary" env:"REQUEST_SUMMARY"`
	RequestSummaryName         string    `toml:"request_summary_name" json:"request_summary_name" yaml:"request_summary_name" env:"REQUEST_SUMMARY_NAME"`
	RequestSummaryObjective    []float64 `` /* 147-byte string literal not displayed */
	RequestSummaryMaxAgeSecond int64     `` /* 150-byte string literal not displayed */
	RequestTotal               bool      `toml:"request_total" json:"request_total" yaml:"request_total" env:"REQUEST_TOTAL"`
	RequestTotalName           string    `toml:"request_total_name" json:"request_total_name" yaml:"request_total_name" env:"REQUEST_TOTAL_NAME"`
}
    func (ApiStatsConfig) Objectives ¶ added in v2.0.31
func (c ApiStatsConfig) Objectives() map[float64]float64
type METRIC_PROVIDER ¶ added in v2.0.3
type METRIC_PROVIDER string
const (
	METRIC_PROVIDER_PROMETHEUS METRIC_PROVIDER = "prometheus"
)
    type Metric ¶
type Metric struct {
	Enable   bool            `json:"enable" yaml:"enable" toml:"enable" env:"ENABLE"`
	Provider METRIC_PROVIDER `toml:"provider" json:"provider" yaml:"provider" env:"PROVIDER"`
	Endpoint string          `toml:"endpoint" json:"endpoint" yaml:"endpoint" env:"ENDPOINT"`
	ApiStats ApiStatsConfig  `toml:"api_stats" json:"api_stats" yaml:"api_stats" env:"API_STATS"`
}
    func NewDefaultMetric ¶ added in v2.0.3
func NewDefaultMetric() *Metric
 Click to show internal directories. 
   Click to hide internal directories.