Documentation ¶
Index ¶
- Constants
- Variables
- type MetricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption)
- func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
- func (mb *MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveReadDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveWriteDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerCPUPercentDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordContainerCPUUsagePercpuDataPoint(ts pcommon.Timestamp, val int64, coreAttributeValue string)
- func (mb *MetricsBuilder) RecordContainerCPUUsageSystemDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerCPUUsageTotalDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerMemoryPercentDataPoint(ts pcommon.Timestamp, val float64)
- func (mb *MetricsBuilder) RecordContainerMemoryUsageLimitDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerMemoryUsageTotalDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerNetworkIoUsageRxBytesDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordContainerNetworkIoUsageTxBytesDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceAttributeConfig
- type ResourceAttributesConfig
- type ResourceBuilder
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelAlpha
)
Variables ¶
var ( Type = component.MustNewType("podman_stats") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver" )
Functions ¶
This section is empty.
Types ¶
type MetricBuilderOption ¶ added in v0.110.0
type MetricBuilderOption interface {
// contains filtered or unexported methods
}
MetricBuilderOption applies changes to default metrics builder.
func WithStartTime ¶ added in v0.98.0
func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption
WithStartTime sets startTime on the metrics builder.
type MetricConfig ¶ added in v0.98.0
type MetricConfig struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricConfig provides common config for a particular metric.
type MetricsBuilder ¶ added in v0.98.0
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 config.
func NewMetricsBuilder ¶ added in v0.98.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.98.0
func (mb *MetricsBuilder) Emit(options ...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 config, e.g. delta or cumulative.
func (*MetricsBuilder) EmitForResource ¶ added in v0.98.0
func (mb *MetricsBuilder) EmitForResource(options ...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) NewResourceBuilder ¶ added in v0.98.0
func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics.
func (*MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveReadDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveReadDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerBlockioIoServiceBytesRecursiveReadDataPoint adds a data point to container.blockio.io_service_bytes_recursive.read metric.
func (*MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveWriteDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerBlockioIoServiceBytesRecursiveWriteDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerBlockioIoServiceBytesRecursiveWriteDataPoint adds a data point to container.blockio.io_service_bytes_recursive.write metric.
func (*MetricsBuilder) RecordContainerCPUPercentDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerCPUPercentDataPoint(ts pcommon.Timestamp, val float64)
RecordContainerCPUPercentDataPoint adds a data point to container.cpu.percent metric.
func (*MetricsBuilder) RecordContainerCPUUsagePercpuDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerCPUUsagePercpuDataPoint(ts pcommon.Timestamp, val int64, coreAttributeValue string)
RecordContainerCPUUsagePercpuDataPoint adds a data point to container.cpu.usage.percpu metric.
func (*MetricsBuilder) RecordContainerCPUUsageSystemDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerCPUUsageSystemDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerCPUUsageSystemDataPoint adds a data point to container.cpu.usage.system metric.
func (*MetricsBuilder) RecordContainerCPUUsageTotalDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerCPUUsageTotalDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerCPUUsageTotalDataPoint adds a data point to container.cpu.usage.total metric.
func (*MetricsBuilder) RecordContainerMemoryPercentDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerMemoryPercentDataPoint(ts pcommon.Timestamp, val float64)
RecordContainerMemoryPercentDataPoint adds a data point to container.memory.percent metric.
func (*MetricsBuilder) RecordContainerMemoryUsageLimitDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerMemoryUsageLimitDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerMemoryUsageLimitDataPoint adds a data point to container.memory.usage.limit metric.
func (*MetricsBuilder) RecordContainerMemoryUsageTotalDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerMemoryUsageTotalDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerMemoryUsageTotalDataPoint adds a data point to container.memory.usage.total metric.
func (*MetricsBuilder) RecordContainerNetworkIoUsageRxBytesDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerNetworkIoUsageRxBytesDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerNetworkIoUsageRxBytesDataPoint adds a data point to container.network.io.usage.rx_bytes metric.
func (*MetricsBuilder) RecordContainerNetworkIoUsageTxBytesDataPoint ¶ added in v0.98.0
func (mb *MetricsBuilder) RecordContainerNetworkIoUsageTxBytesDataPoint(ts pcommon.Timestamp, val int64)
RecordContainerNetworkIoUsageTxBytesDataPoint adds a data point to container.network.io.usage.tx_bytes metric.
func (*MetricsBuilder) Reset ¶ added in v0.98.0
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 ¶ added in v0.98.0
type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a configuration for podman_stats metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.98.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.98.0
type MetricsConfig struct { ContainerBlockioIoServiceBytesRecursiveRead MetricConfig `mapstructure:"container.blockio.io_service_bytes_recursive.read"` ContainerBlockioIoServiceBytesRecursiveWrite MetricConfig `mapstructure:"container.blockio.io_service_bytes_recursive.write"` ContainerCPUPercent MetricConfig `mapstructure:"container.cpu.percent"` ContainerCPUUsagePercpu MetricConfig `mapstructure:"container.cpu.usage.percpu"` ContainerCPUUsageSystem MetricConfig `mapstructure:"container.cpu.usage.system"` ContainerCPUUsageTotal MetricConfig `mapstructure:"container.cpu.usage.total"` ContainerMemoryPercent MetricConfig `mapstructure:"container.memory.percent"` ContainerMemoryUsageLimit MetricConfig `mapstructure:"container.memory.usage.limit"` ContainerMemoryUsageTotal MetricConfig `mapstructure:"container.memory.usage.total"` ContainerNetworkIoUsageRxBytes MetricConfig `mapstructure:"container.network.io.usage.rx_bytes"` ContainerNetworkIoUsageTxBytes MetricConfig `mapstructure:"container.network.io.usage.tx_bytes"` }
MetricsConfig provides config for podman_stats metrics.
func DefaultMetricsConfig ¶ added in v0.98.0
func DefaultMetricsConfig() MetricsConfig
type ResourceAttributeConfig ¶ added in v0.98.0
type ResourceAttributeConfig struct { Enabled bool `mapstructure:"enabled"` // Experimental: MetricsInclude defines a list of filters for attribute values. // If the list is not empty, only metrics with matching resource attribute values will be emitted. MetricsInclude []filter.Config `mapstructure:"metrics_include"` // Experimental: MetricsExclude defines a list of filters for attribute values. // If the list is not empty, metrics with matching resource attribute values will not be emitted. // MetricsInclude has higher priority than MetricsExclude. MetricsExclude []filter.Config `mapstructure:"metrics_exclude"` // contains filtered or unexported fields }
ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributesConfig ¶ added in v0.98.0
type ResourceAttributesConfig struct { ContainerID ResourceAttributeConfig `mapstructure:"container.id"` ContainerImageName ResourceAttributeConfig `mapstructure:"container.image.name"` ContainerName ResourceAttributeConfig `mapstructure:"container.name"` ContainerRuntime ResourceAttributeConfig `mapstructure:"container.runtime"` }
ResourceAttributesConfig provides config for podman_stats resource attributes.
func DefaultResourceAttributesConfig ¶ added in v0.98.0
func DefaultResourceAttributesConfig() ResourceAttributesConfig
type ResourceBuilder ¶ added in v0.98.0
type ResourceBuilder struct {
// contains filtered or unexported fields
}
ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines.
func NewResourceBuilder ¶ added in v0.98.0
func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder
NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.
func (*ResourceBuilder) Emit ¶ added in v0.98.0
func (rb *ResourceBuilder) Emit() pcommon.Resource
Emit returns the built resource and resets the internal builder state.
func (*ResourceBuilder) SetContainerID ¶ added in v0.98.0
func (rb *ResourceBuilder) SetContainerID(val string)
SetContainerID sets provided value as "container.id" attribute.
func (*ResourceBuilder) SetContainerImageName ¶ added in v0.98.0
func (rb *ResourceBuilder) SetContainerImageName(val string)
SetContainerImageName sets provided value as "container.image.name" attribute.
func (*ResourceBuilder) SetContainerName ¶ added in v0.98.0
func (rb *ResourceBuilder) SetContainerName(val string)
SetContainerName sets provided value as "container.name" attribute.
func (*ResourceBuilder) SetContainerRuntime ¶ added in v0.98.0
func (rb *ResourceBuilder) SetContainerRuntime(val string)
SetContainerRuntime sets provided value as "container.runtime" attribute.
type ResourceMetricsOption ¶ added in v0.98.0
type ResourceMetricsOption interface {
// contains filtered or unexported methods
}
ResourceMetricsOption applies changes to provided resource metrics.
func WithResource ¶ added in v0.98.0
func WithResource(res pcommon.Resource) ResourceMetricsOption
WithResource sets the provided resource on the emitted ResourceMetrics. It's recommended to use ResourceBuilder to create the resource.
func WithStartTimeOverride ¶ added in v0.98.0
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.