Documentation ¶
Index ¶
- Constants
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordFileAtimeDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordFileCtimeDataPoint(ts pcommon.Timestamp, val int64, filePermissionsAttributeValue string)
- func (mb *MetricsBuilder) RecordFileMtimeDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordFileSizeDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsBuilderConfig
- type MetricsSettings
- type ResourceAttributeSettings
- type ResourceAttributesSettings
- type ResourceMetricsOption
Constants ¶
const ( Type = "filestats" Stability = component.StabilityLevelDevelopment )
Variables ¶
This section is empty.
Functions ¶
func WithStartTime ¶
WithStartTime sets startTime on the metrics builder.
Types ¶
type MetricSettings ¶
type MetricSettings struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶
type MetricsBuilder struct {
// contains filtered or unexported fields
}
MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations required to produce metric representation defined in metadata and user settings.
func NewMetricsBuilder ¶
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
Emit returns all the metrics accumulated by the metrics builder and updates the internal state to be ready for recording another set of metrics. This function will be responsible for applying all the transformations required to produce metric representation defined in metadata and user settings, e.g. delta or cumulative.
func (*MetricsBuilder) EmitForResource ¶
func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
EmitForResource saves all the generated metrics under a new resource and updates the internal state to be ready for recording another set of data points as part of another resource. This function can be helpful when one scraper needs to emit metrics from several resources. Otherwise calling this function is not required, just `Emit` function can be called instead. Resource attributes should be provided as ResourceMetricsOption arguments.
func (*MetricsBuilder) RecordFileAtimeDataPoint ¶
func (mb *MetricsBuilder) RecordFileAtimeDataPoint(ts pcommon.Timestamp, val int64)
RecordFileAtimeDataPoint adds a data point to file.atime metric.
func (*MetricsBuilder) RecordFileCtimeDataPoint ¶
func (mb *MetricsBuilder) RecordFileCtimeDataPoint(ts pcommon.Timestamp, val int64, filePermissionsAttributeValue string)
RecordFileCtimeDataPoint adds a data point to file.ctime metric.
func (*MetricsBuilder) RecordFileMtimeDataPoint ¶
func (mb *MetricsBuilder) RecordFileMtimeDataPoint(ts pcommon.Timestamp, val int64)
RecordFileMtimeDataPoint adds a data point to file.mtime metric.
func (*MetricsBuilder) RecordFileSizeDataPoint ¶
func (mb *MetricsBuilder) RecordFileSizeDataPoint(ts pcommon.Timestamp, val int64)
RecordFileSizeDataPoint adds a data point to file.size metric.
func (*MetricsBuilder) Reset ¶
func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted, and metrics builder should update its startTime and reset it's internal state accordingly.
type MetricsBuilderConfig ¶
type MetricsBuilderConfig struct { Metrics MetricsSettings `mapstructure:"metrics"` ResourceAttributes ResourceAttributesSettings `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a structural subset of an otherwise 1-1 copy of metadata.yaml
func DefaultMetricsBuilderConfig ¶
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
func NewMetricsBuilderConfig ¶
func NewMetricsBuilderConfig(ms MetricsSettings, ras ResourceAttributesSettings) MetricsBuilderConfig
type MetricsSettings ¶
type MetricsSettings struct { FileAtime MetricSettings `mapstructure:"file.atime"` FileCtime MetricSettings `mapstructure:"file.ctime"` FileMtime MetricSettings `mapstructure:"file.mtime"` FileSize MetricSettings `mapstructure:"file.size"` }
MetricsSettings provides settings for filestats metrics.
func DefaultMetricsSettings ¶
func DefaultMetricsSettings() MetricsSettings
type ResourceAttributeSettings ¶
type ResourceAttributeSettings struct {
Enabled bool `mapstructure:"enabled"`
}
ResourceAttributeSettings provides common settings for a particular metric.
type ResourceAttributesSettings ¶
type ResourceAttributesSettings struct { FileName ResourceAttributeSettings `mapstructure:"file.name"` FilePath ResourceAttributeSettings `mapstructure:"file.path"` }
ResourceAttributesSettings provides settings for filestats metrics.
func DefaultResourceAttributesSettings ¶
func DefaultResourceAttributesSettings() ResourceAttributesSettings
type ResourceMetricsOption ¶
type ResourceMetricsOption func(ResourceAttributesSettings, pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithFileName ¶
func WithFileName(val string) ResourceMetricsOption
WithFileName sets provided value as "file.name" attribute for current resource.
func WithFilePath ¶
func WithFilePath(val string) ResourceMetricsOption
WithFilePath sets provided value as "file.path" attribute for current resource.
func WithStartTimeOverride ¶
func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption
WithStartTimeOverride overrides start time for all the resource metrics data points. This option should be only used if different start time has to be set on metrics coming from different resources.