Documentation
¶
Index ¶
- Constants
- Variables
- type AttributeCPULevel
- type AttributeCPUMode
- type AttributeScoreboardState
- type AttributeWorkersState
- 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) RecordApacheCPULoadDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheCPUTimeDataPoint(ts pcommon.Timestamp, inputVal string, ...) error
- func (mb *MetricsBuilder) RecordApacheCurrentConnectionsDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheLoad15DataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheLoad1DataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheLoad5DataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheRequestTimeDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheRequestsDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheScoreboardDataPoint(ts pcommon.Timestamp, val int64, ...)
- func (mb *MetricsBuilder) RecordApacheTrafficDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordApacheUptimeDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordApacheWorkersDataPoint(ts pcommon.Timestamp, inputVal string, ...) error
- func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceAttributeConfig
- type ResourceAttributesConfig
- type ResourceBuilder
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelBeta
)
Variables ¶
var ( Type = component.MustNewType("apache") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/apachereceiver" )
var MapAttributeCPULevel = map[string]AttributeCPULevel{ "self": AttributeCPULevelSelf, "children": AttributeCPULevelChildren, }
MapAttributeCPULevel is a helper map of string to AttributeCPULevel attribute value.
var MapAttributeCPUMode = map[string]AttributeCPUMode{ "system": AttributeCPUModeSystem, "user": AttributeCPUModeUser, }
MapAttributeCPUMode is a helper map of string to AttributeCPUMode attribute value.
var MapAttributeScoreboardState = map[string]AttributeScoreboardState{ "open": AttributeScoreboardStateOpen, "waiting": AttributeScoreboardStateWaiting, "starting": AttributeScoreboardStateStarting, "reading": AttributeScoreboardStateReading, "sending": AttributeScoreboardStateSending, "keepalive": AttributeScoreboardStateKeepalive, "dnslookup": AttributeScoreboardStateDnslookup, "closing": AttributeScoreboardStateClosing, "logging": AttributeScoreboardStateLogging, "finishing": AttributeScoreboardStateFinishing, "idle_cleanup": AttributeScoreboardStateIdleCleanup, "unknown": AttributeScoreboardStateUnknown, }
MapAttributeScoreboardState is a helper map of string to AttributeScoreboardState attribute value.
var MapAttributeWorkersState = map[string]AttributeWorkersState{ "busy": AttributeWorkersStateBusy, "idle": AttributeWorkersStateIdle, }
MapAttributeWorkersState is a helper map of string to AttributeWorkersState attribute value.
Functions ¶
This section is empty.
Types ¶
type AttributeCPULevel ¶ added in v0.61.0
type AttributeCPULevel int
AttributeCPULevel specifies the value cpu_level attribute.
const ( AttributeCPULevelSelf AttributeCPULevel AttributeCPULevelChildren )
func (AttributeCPULevel) String ¶ added in v0.61.0
func (av AttributeCPULevel) String() string
String returns the string representation of the AttributeCPULevel.
type AttributeCPUMode ¶ added in v0.61.0
type AttributeCPUMode int
AttributeCPUMode specifies the value cpu_mode attribute.
const ( AttributeCPUModeSystem AttributeCPUMode AttributeCPUModeUser )
func (AttributeCPUMode) String ¶ added in v0.61.0
func (av AttributeCPUMode) String() string
String returns the string representation of the AttributeCPUMode.
type AttributeScoreboardState ¶
type AttributeScoreboardState int
AttributeScoreboardState specifies the value scoreboard_state attribute.
const ( AttributeScoreboardStateOpen AttributeScoreboardState AttributeScoreboardStateWaiting AttributeScoreboardStateStarting AttributeScoreboardStateReading AttributeScoreboardStateSending AttributeScoreboardStateKeepalive AttributeScoreboardStateDnslookup AttributeScoreboardStateClosing AttributeScoreboardStateLogging AttributeScoreboardStateFinishing AttributeScoreboardStateIdleCleanup AttributeScoreboardStateUnknown )
func (AttributeScoreboardState) String ¶ added in v0.51.0
func (av AttributeScoreboardState) String() string
String returns the string representation of the AttributeScoreboardState.
type AttributeWorkersState ¶
type AttributeWorkersState int
AttributeWorkersState specifies the value workers_state attribute.
const ( AttributeWorkersStateBusy AttributeWorkersState AttributeWorkersStateIdle )
func (AttributeWorkersState) String ¶ added in v0.51.0
func (av AttributeWorkersState) String() string
String returns the string representation of the AttributeWorkersState.
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.45.0
func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption
WithStartTime sets startTime on the metrics builder.
type MetricConfig ¶ added in v0.77.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.45.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.45.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.45.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.48.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.83.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) RecordApacheCPULoadDataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheCPULoadDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheCPULoadDataPoint adds a data point to apache.cpu.load metric.
func (*MetricsBuilder) RecordApacheCPUTimeDataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheCPUTimeDataPoint(ts pcommon.Timestamp, inputVal string, cpuLevelAttributeValue AttributeCPULevel, cpuModeAttributeValue AttributeCPUMode) error
RecordApacheCPUTimeDataPoint adds a data point to apache.cpu.time metric.
func (*MetricsBuilder) RecordApacheCurrentConnectionsDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheCurrentConnectionsDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheCurrentConnectionsDataPoint adds a data point to apache.current_connections metric.
func (*MetricsBuilder) RecordApacheLoad15DataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheLoad15DataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheLoad15DataPoint adds a data point to apache.load.15 metric.
func (*MetricsBuilder) RecordApacheLoad1DataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheLoad1DataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheLoad1DataPoint adds a data point to apache.load.1 metric.
func (*MetricsBuilder) RecordApacheLoad5DataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheLoad5DataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheLoad5DataPoint adds a data point to apache.load.5 metric.
func (*MetricsBuilder) RecordApacheRequestTimeDataPoint ¶ added in v0.61.0
func (mb *MetricsBuilder) RecordApacheRequestTimeDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheRequestTimeDataPoint adds a data point to apache.request.time metric.
func (*MetricsBuilder) RecordApacheRequestsDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheRequestsDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheRequestsDataPoint adds a data point to apache.requests metric.
func (*MetricsBuilder) RecordApacheScoreboardDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheScoreboardDataPoint(ts pcommon.Timestamp, val int64, scoreboardStateAttributeValue AttributeScoreboardState)
RecordApacheScoreboardDataPoint adds a data point to apache.scoreboard metric.
func (*MetricsBuilder) RecordApacheTrafficDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheTrafficDataPoint(ts pcommon.Timestamp, val int64)
RecordApacheTrafficDataPoint adds a data point to apache.traffic metric.
func (*MetricsBuilder) RecordApacheUptimeDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheUptimeDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordApacheUptimeDataPoint adds a data point to apache.uptime metric.
func (*MetricsBuilder) RecordApacheWorkersDataPoint ¶ added in v0.45.0
func (mb *MetricsBuilder) RecordApacheWorkersDataPoint(ts pcommon.Timestamp, inputVal string, workersStateAttributeValue AttributeWorkersState) error
RecordApacheWorkersDataPoint adds a data point to apache.workers metric.
func (*MetricsBuilder) Reset ¶ added in v0.45.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.73.0
type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a configuration for apache metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { ApacheCPULoad MetricConfig `mapstructure:"apache.cpu.load"` ApacheCPUTime MetricConfig `mapstructure:"apache.cpu.time"` ApacheCurrentConnections MetricConfig `mapstructure:"apache.current_connections"` ApacheLoad1 MetricConfig `mapstructure:"apache.load.1"` ApacheLoad15 MetricConfig `mapstructure:"apache.load.15"` ApacheLoad5 MetricConfig `mapstructure:"apache.load.5"` ApacheRequestTime MetricConfig `mapstructure:"apache.request.time"` ApacheRequests MetricConfig `mapstructure:"apache.requests"` ApacheScoreboard MetricConfig `mapstructure:"apache.scoreboard"` ApacheTraffic MetricConfig `mapstructure:"apache.traffic"` ApacheUptime MetricConfig `mapstructure:"apache.uptime"` ApacheWorkers MetricConfig `mapstructure:"apache.workers"` }
MetricsConfig provides config for apache metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
type ResourceAttributeConfig ¶ added in v0.77.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.77.0
type ResourceAttributesConfig struct { ApacheServerName ResourceAttributeConfig `mapstructure:"apache.server.name"` ApacheServerPort ResourceAttributeConfig `mapstructure:"apache.server.port"` }
ResourceAttributesConfig provides config for apache resource attributes.
func DefaultResourceAttributesConfig ¶ added in v0.77.0
func DefaultResourceAttributesConfig() ResourceAttributesConfig
type ResourceBuilder ¶ added in v0.82.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.82.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.82.0
func (rb *ResourceBuilder) Emit() pcommon.Resource
Emit returns the built resource and resets the internal builder state.
func (*ResourceBuilder) SetApacheServerName ¶ added in v0.82.0
func (rb *ResourceBuilder) SetApacheServerName(val string)
SetApacheServerName sets provided value as "apache.server.name" attribute.
func (*ResourceBuilder) SetApacheServerPort ¶ added in v0.82.0
func (rb *ResourceBuilder) SetApacheServerPort(val string)
SetApacheServerPort sets provided value as "apache.server.port" attribute.
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption interface {
// contains filtered or unexported methods
}
ResourceMetricsOption applies changes to provided resource metrics.
func WithResource ¶ added in v0.82.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.52.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.