Before you understand how to develop the Input plugin, you need to understand the Input plugin interface. The current Input plugins are divided into two categories, namely MetricInput and ServiceInput. MetricInput can be used to control the collection frequency globally, which is suitable for the pull of Metric indicators. ServiceInput is more suitable to receive external input, such as receiving SkyWalking's Trace data.
// MetricInput ...
type MetricInput interface {
// Init called for init some system resources, like socket, mutex...
// return call interval(ms) and error flag, if interval is 0, use default interval
Init(Context) (int, error)
// Description returns a one-sentence description on the Input
Description() string
// Collect takes in an accumulator and adds the metrics that the Input
// gathers. This is called every "interval"
Collect(Collector) error
}
The development of MetricInput is divided into the following steps:
// ServiceInput ...
type ServiceInput interface {
// Init called for init some system resources, like socket, mutex...
// return interval(ms) and error flag, if interval is 0, use default interval
Init(Context) (int, error)
// Description returns a one-sentence description on the Input
Description() string
// Start starts the ServiceInput's service, whatever that may be
Start(Collector) error
// Stop stops the services and closes any necessary channels and connections
Stop() error
}
The development of ServiceInput is divided into the following steps:
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )