Documentation ¶
Overview ¶
Package metrics is a generated GoMock package.
Package metrics is a generated GoMock package.
Package metrics is a generated GoMock package.
Index ¶
- Constants
- func NewMetricsDaemon(store API) *metricsDaemon
- type API
- type Block
- type DataPoint
- type DataTransferMetrics
- type HTTPScraper
- type MetricsDaemon
- type MockAPI
- func (m *MockAPI) AddMetric(arg0 float64, arg1 map[string]string) error
- func (m *MockAPI) AddVector(arg0 model.Vector, arg1 map[string]string) error
- func (m *MockAPI) Blocks() []Block
- func (m *MockAPI) Close() error
- func (m *MockAPI) Deregister() error
- func (m *MockAPI) EXPECT() *MockAPIMockRecorder
- func (m *MockAPI) GetMetricsForTimeRange(arg0, arg1 time.Time, arg2 bool) ([]Series, error)
- func (m *MockAPI) HeadMinTime() time.Time
- func (m *MockAPI) MaxTime() time.Time
- func (m *MockAPI) MinTime() (time.Time, error)
- type MockAPIMockRecorder
- func (mr *MockAPIMockRecorder) AddMetric(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) AddVector(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) Blocks() *gomock.Call
- func (mr *MockAPIMockRecorder) Close() *gomock.Call
- func (mr *MockAPIMockRecorder) Deregister() *gomock.Call
- func (mr *MockAPIMockRecorder) GetMetricsForTimeRange(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) HeadMinTime() *gomock.Call
- func (mr *MockAPIMockRecorder) MaxTime() *gomock.Call
- func (mr *MockAPIMockRecorder) MinTime() *gomock.Call
- type MockMetricsDaemon
- type MockMetricsDaemonMockRecorder
- type MockWriteClient
- type MockWriteClientMockRecorder
- type ObjectScraper
- type PermissiveAllowList
- type RemoteRecoverableError
- type RemoteWrite
- func (r *RemoteWrite) Init(config models.DeviceConfigurationMessage) error
- func (r *RemoteWrite) IsEnabled() bool
- func (r *RemoteWrite) IsRunning() bool
- func (r *RemoteWrite) Update(config models.DeviceConfigurationMessage) error
- func (r *RemoteWrite) Write(client WriteClient, requestNumSamples int)
- type RestrictiveAllowList
- type SampleFilter
- type Scraper
- type Scrapers
- type Series
- type SystemMetrics
- type TSDB
- func (t *TSDB) AddMetric(value float64, labelsMap map[string]string) error
- func (t *TSDB) AddVector(data model.Vector, labelsMap map[string]string) error
- func (t *TSDB) Blocks() []Block
- func (t *TSDB) Close() error
- func (t *TSDB) Deregister() error
- func (t *TSDB) GetMetricsForTimeRange(tMin time.Time, tMax time.Time, sort bool) ([]Series, error)
- func (t *TSDB) HeadMinTime() time.Time
- func (t *TSDB) Init(config models.DeviceConfigurationMessage) error
- func (t *TSDB) MaxTime() time.Time
- func (t *TSDB) MinTime() (time.Time, error)
- func (t *TSDB) String() string
- func (t *TSDB) Update(config models.DeviceConfigurationMessage) error
- type TargetMetric
- func (tg *TargetMetric) ForceEvent()
- func (tg *TargetMetric) IsStopped() bool
- func (tg *TargetMetric) LatestSuccessRun() time.Time
- func (tg *TargetMetric) Run(ctx context.Context) model.Vector
- func (tg *TargetMetric) Start()
- func (tg *TargetMetric) Stop()
- func (tg *TargetMetric) Store(data model.Vector, labels map[string]string) error
- type WorkloadMetrics
- func (wrkM *WorkloadMetrics) Init(config models.DeviceConfigurationMessage) error
- func (wrkM *WorkloadMetrics) Update(config models.DeviceConfigurationMessage) error
- func (wrkM *WorkloadMetrics) WorkloadRemoved(workloadName string)
- func (wrkM *WorkloadMetrics) WorkloadStarted(workloadName string, report []*podman.PodReport)
- type WriteClient
Constants ¶
const ( // DefaultRetentionDuration specifies 7 days data retention DefaultRetentionDuration = int64(7 * 24 * millisInHour) // DefaultMaxBytes specifies no block data size limit DefaultMaxBytes = int64(0) )
const ( LastWriteFileName = "metrics-lastwrite" DeviceLabel = "edgedeviceid" ServerCAFileNamePattern = "remote-write-ca-*.pem" )
const ( DefaultSystemMetricsScrapingInterval = 60 NodeExporterMetricsEndpoint = "http://localhost:9100/metrics" )
const (
DefaultDataTransferMetricsScrapingInterval = 60
)
const (
UserAgent = "flotta-device-worker"
)
Variables ¶
This section is empty.
Functions ¶
func NewMetricsDaemon ¶
func NewMetricsDaemon(store API) *metricsDaemon
Types ¶
type API ¶
type API interface { io.Closer Deregister() error GetMetricsForTimeRange(tMin time.Time, tMax time.Time, sort bool) ([]Series, error) AddMetric(value float64, labelsMap map[string]string) error AddVector(data model.Vector, labelsMap map[string]string) error MinTime() (time.Time, error) MaxTime() time.Time HeadMinTime() time.Time Blocks() []Block }
type DataTransferMetrics ¶
type DataTransferMetrics struct {
// contains filtered or unexported fields
}
func NewDataTransferMetrics ¶
func NewDataTransferMetrics(daemon MetricsDaemon) *DataTransferMetrics
func (*DataTransferMetrics) Deregister ¶
func (dt *DataTransferMetrics) Deregister() error
func (*DataTransferMetrics) Init ¶
func (dt *DataTransferMetrics) Init(config models.DeviceConfigurationMessage) error
func (*DataTransferMetrics) String ¶
func (dt *DataTransferMetrics) String() string
func (*DataTransferMetrics) Update ¶
func (dt *DataTransferMetrics) Update(config models.DeviceConfigurationMessage) error
type HTTPScraper ¶
type HTTPScraper struct {
// contains filtered or unexported fields
}
func (*HTTPScraper) String ¶
func (s *HTTPScraper) String() string
type MetricsDaemon ¶
type MockAPI ¶
type MockAPI struct {
// contains filtered or unexported fields
}
MockAPI is a mock of API interface.
func NewMockAPI ¶
func NewMockAPI(ctrl *gomock.Controller) *MockAPI
NewMockAPI creates a new mock instance.
func (*MockAPI) EXPECT ¶
func (m *MockAPI) EXPECT() *MockAPIMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAPI) GetMetricsForTimeRange ¶
GetMetricsForTimeRange mocks base method.
func (*MockAPI) HeadMinTime ¶
HeadMinTime mocks base method.
type MockAPIMockRecorder ¶
type MockAPIMockRecorder struct {
// contains filtered or unexported fields
}
MockAPIMockRecorder is the mock recorder for MockAPI.
func (*MockAPIMockRecorder) AddMetric ¶
func (mr *MockAPIMockRecorder) AddMetric(arg0, arg1 interface{}) *gomock.Call
AddMetric indicates an expected call of AddMetric.
func (*MockAPIMockRecorder) AddVector ¶
func (mr *MockAPIMockRecorder) AddVector(arg0, arg1 interface{}) *gomock.Call
AddVector indicates an expected call of AddVector.
func (*MockAPIMockRecorder) Blocks ¶
func (mr *MockAPIMockRecorder) Blocks() *gomock.Call
Blocks indicates an expected call of Blocks.
func (*MockAPIMockRecorder) Close ¶
func (mr *MockAPIMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockAPIMockRecorder) Deregister ¶
func (mr *MockAPIMockRecorder) Deregister() *gomock.Call
Deregister indicates an expected call of Deregister.
func (*MockAPIMockRecorder) GetMetricsForTimeRange ¶
func (mr *MockAPIMockRecorder) GetMetricsForTimeRange(arg0, arg1, arg2 interface{}) *gomock.Call
GetMetricsForTimeRange indicates an expected call of GetMetricsForTimeRange.
func (*MockAPIMockRecorder) HeadMinTime ¶
func (mr *MockAPIMockRecorder) HeadMinTime() *gomock.Call
HeadMinTime indicates an expected call of HeadMinTime.
func (*MockAPIMockRecorder) MaxTime ¶
func (mr *MockAPIMockRecorder) MaxTime() *gomock.Call
MaxTime indicates an expected call of MaxTime.
func (*MockAPIMockRecorder) MinTime ¶
func (mr *MockAPIMockRecorder) MinTime() *gomock.Call
MinTime indicates an expected call of MinTime.
type MockMetricsDaemon ¶
type MockMetricsDaemon struct {
// contains filtered or unexported fields
}
MockMetricsDaemon is a mock of MetricsDaemon interface.
func NewMockMetricsDaemon ¶
func NewMockMetricsDaemon(ctrl *gomock.Controller) *MockMetricsDaemon
NewMockMetricsDaemon creates a new mock instance.
func (*MockMetricsDaemon) AddTarget ¶
func (m *MockMetricsDaemon) AddTarget(arg0 string, arg1 Scrapers, arg2 time.Duration, arg3 SampleFilter)
AddTarget mocks base method.
func (*MockMetricsDaemon) DeleteTarget ¶
func (m *MockMetricsDaemon) DeleteTarget(arg0 string)
DeleteTarget mocks base method.
func (*MockMetricsDaemon) EXPECT ¶
func (m *MockMetricsDaemon) EXPECT() *MockMetricsDaemonMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockMetricsDaemonMockRecorder ¶
type MockMetricsDaemonMockRecorder struct {
// contains filtered or unexported fields
}
MockMetricsDaemonMockRecorder is the mock recorder for MockMetricsDaemon.
func (*MockMetricsDaemonMockRecorder) AddTarget ¶
func (mr *MockMetricsDaemonMockRecorder) AddTarget(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
AddTarget indicates an expected call of AddTarget.
func (*MockMetricsDaemonMockRecorder) DeleteTarget ¶
func (mr *MockMetricsDaemonMockRecorder) DeleteTarget(arg0 interface{}) *gomock.Call
DeleteTarget indicates an expected call of DeleteTarget.
func (*MockMetricsDaemonMockRecorder) Start ¶
func (mr *MockMetricsDaemonMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
type MockWriteClient ¶
type MockWriteClient struct {
// contains filtered or unexported fields
}
MockWriteClient is a mock of WriteClient interface.
func NewMockWriteClient ¶
func NewMockWriteClient(ctrl *gomock.Controller) *MockWriteClient
NewMockWriteClient creates a new mock instance.
func (*MockWriteClient) EXPECT ¶
func (m *MockWriteClient) EXPECT() *MockWriteClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockWriteClientMockRecorder ¶
type MockWriteClientMockRecorder struct {
// contains filtered or unexported fields
}
MockWriteClientMockRecorder is the mock recorder for MockWriteClient.
func (*MockWriteClientMockRecorder) Write ¶
func (mr *MockWriteClientMockRecorder) Write(arg0, arg1 interface{}) *gomock.Call
Write indicates an expected call of Write.
type ObjectScraper ¶
type ObjectScraper struct {
// contains filtered or unexported fields
}
func (*ObjectScraper) String ¶
func (o *ObjectScraper) String() string
type PermissiveAllowList ¶
type PermissiveAllowList struct{}
type RemoteRecoverableError ¶
type RemoteRecoverableError struct {
// contains filtered or unexported fields
}
RemoteRecoverableError 'remote.RecoverableError' fields are private and can't be instantiated during testing. Therefore, we use this wrapper
func (RemoteRecoverableError) Error ¶
func (e RemoteRecoverableError) Error() string
type RemoteWrite ¶
type RemoteWrite struct { Config *models.MetricsReceiverConfiguration LastWrite time.Time WaitInterval time.Duration RangeDuration time.Duration RequestRetryInterval time.Duration // contains filtered or unexported fields }
func NewRemoteWrite ¶
func NewRemoteWrite(dataDir, deviceID string, tsdbInstance API) *RemoteWrite
func (*RemoteWrite) Init ¶
func (r *RemoteWrite) Init(config models.DeviceConfigurationMessage) error
func (*RemoteWrite) IsEnabled ¶
func (r *RemoteWrite) IsEnabled() bool
func (*RemoteWrite) IsRunning ¶
func (r *RemoteWrite) IsRunning() bool
func (*RemoteWrite) Update ¶
func (r *RemoteWrite) Update(config models.DeviceConfigurationMessage) error
func (*RemoteWrite) Write ¶
func (r *RemoteWrite) Write(client WriteClient, requestNumSamples int)
write Writes all the metrics. Stops when either no more metrics or failure (after retries)
type RestrictiveAllowList ¶
type RestrictiveAllowList struct {
// contains filtered or unexported fields
}
type SampleFilter ¶
func DefaultDataTransferAllowList ¶
func DefaultDataTransferAllowList() SampleFilter
func DefaultSystemAllowList ¶
func DefaultSystemAllowList() SampleFilter
func NewRestrictiveAllowList ¶
func NewRestrictiveAllowList(list *models.MetricsAllowList) SampleFilter
type Scraper ¶
func NewHTTPScraper ¶
func NewObjectScraper ¶
func NewObjectScraper(gather prometheus.Gatherer) Scraper
type Scrapers ¶
type Scrapers []Scraper
func CreateHTTPScraper ¶
func CreateObjectScraper ¶
func CreateObjectScraper(gather prometheus.Gatherer) Scrapers
type SystemMetrics ¶
type SystemMetrics struct {
// contains filtered or unexported fields
}
func NewSystemMetrics ¶
func NewSystemMetrics(daemon MetricsDaemon) (*SystemMetrics, error)
func NewSystemMetricsWithNodeExporter ¶
func NewSystemMetricsWithNodeExporter(daemon MetricsDaemon, nodeExporter service.Service) *SystemMetrics
func (*SystemMetrics) Deregister ¶
func (sm *SystemMetrics) Deregister() error
func (*SystemMetrics) Init ¶
func (sm *SystemMetrics) Init(config models.DeviceConfigurationMessage) error
func (*SystemMetrics) String ¶
func (sm *SystemMetrics) String() string
func (*SystemMetrics) Update ¶
func (sm *SystemMetrics) Update(config models.DeviceConfigurationMessage) error
type TSDB ¶
type TSDB struct {
// contains filtered or unexported fields
}
func (*TSDB) Deregister ¶
func (*TSDB) GetMetricsForTimeRange ¶
type TargetMetric ¶
type TargetMetric struct {
// contains filtered or unexported fields
}
func NewTargetMetric ¶
func NewTargetMetric(targetName string, interval time.Duration, scrapers Scrapers, store API, allowList SampleFilter) *TargetMetric
func (*TargetMetric) ForceEvent ¶
func (tg *TargetMetric) ForceEvent()
func (*TargetMetric) IsStopped ¶
func (tg *TargetMetric) IsStopped() bool
func (*TargetMetric) LatestSuccessRun ¶
func (tg *TargetMetric) LatestSuccessRun() time.Time
func (*TargetMetric) Start ¶
func (tg *TargetMetric) Start()
func (*TargetMetric) Stop ¶
func (tg *TargetMetric) Stop()
type WorkloadMetrics ¶
type WorkloadMetrics struct {
// contains filtered or unexported fields
}
func NewWorkloadMetrics ¶
func NewWorkloadMetrics(daemon MetricsDaemon) *WorkloadMetrics
func (*WorkloadMetrics) Init ¶
func (wrkM *WorkloadMetrics) Init(config models.DeviceConfigurationMessage) error
func (*WorkloadMetrics) Update ¶
func (wrkM *WorkloadMetrics) Update(config models.DeviceConfigurationMessage) error
func (*WorkloadMetrics) WorkloadRemoved ¶
func (wrkM *WorkloadMetrics) WorkloadRemoved(workloadName string)
func (*WorkloadMetrics) WorkloadStarted ¶
func (wrkM *WorkloadMetrics) WorkloadStarted(workloadName string, report []*podman.PodReport)