Documentation
¶
Index ¶
Constants ¶
const (
MetricsSubject = "metrics"
)
nats subjects
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricType ¶
type MetricType int
MetricType is prometheus metrics type.
const ( MetricTypeCounter MetricType = iota MetricTypeGauge MetricTypeSummary MetricTypeUntyped MetricTypeHistogrm )
the set of metric types
func (MetricType) String ¶
func (x MetricType) String() string
String returns the string value of MetricType.
func (*MetricType) UnmarshalJSON ¶
func (x *MetricType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the unmarshaler interface.
func (MetricType) Valid ¶
func (x MetricType) Valid() bool
Valid returns whether the metrics type is valid.
type Metrics ¶
type Metrics struct {
Name string `json:"name"`
Tags map[string]string `json:"tags"`
Fields map[string]interface{} `json:"fields"`
Timestamp time.Time `json:"timestamp"`
Type MetricType `json:"type"`
}
Metrics is the default influx based metrics.
type MetricsCollection ¶
type MetricsCollection struct {
OrgID influxdb.ID `json:"orgID"`
BucketID influxdb.ID `json:"bucketID"`
MetricsSlice MetricsSlice `json:"metrics"`
}
MetricsCollection is the struct including metrics and other requirements.
type MetricsSlice ¶
type MetricsSlice []Metrics
MetricsSlice is a slice of Metrics
type PointWriter ¶
type PointWriter struct {
Writer storage.PointsWriter
}
PointWriter will use the storage.PointWriter interface to record metrics.
func (PointWriter) Record ¶
func (s PointWriter) Record(collected MetricsCollection) error
Record the metrics and write using storage.PointWriter interface.
type Recorder ¶
type Recorder interface {
// Subscriber nats.Subscriber
Record(collected MetricsCollection) error
}
Recorder record the metrics of a time based.
type RecorderHandler ¶
type RecorderHandler struct {
Recorder Recorder
// contains filtered or unexported fields
}
RecorderHandler implements nats.Handler interface.
func NewRecorderHandler ¶
func NewRecorderHandler(log *zap.Logger, recorder Recorder) *RecorderHandler
func (*RecorderHandler) Process ¶
func (h *RecorderHandler) Process(s nats.Subscription, m nats.Message)
Process consumes job queue, and use recorder to record.
type Scheduler ¶
type Scheduler struct {
Targets influxdb.ScraperTargetStoreService
// Interval is between each metrics gathering event.
Interval time.Duration
// Timeout is the maximum time duration allowed by each TCP request
Timeout time.Duration
// Publisher will send the gather requests and gathered metrics to the queue.
Publisher nats.Publisher
// contains filtered or unexported fields
}
Scheduler is struct to run scrape jobs.
type Scraper ¶
type Scraper interface {
Gather(ctx context.Context, target influxdb.ScraperTarget) (collected MetricsCollection, err error)
}
Scraper gathers metrics from a scraper target.