Documentation ¶
Index ¶
- Constants
- Variables
- type AttributeStatusCode
- 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) RecordHaproxyBytesInputDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyBytesOutputDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyClientsCanceledDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyCompressionBypassDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyCompressionCountDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyCompressionInputDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyCompressionOutputDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyConnectionsErrorsDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyConnectionsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyConnectionsRetriesDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyConnectionsTotalDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyDowntimeDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyFailedChecksDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsDeniedDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsErrorsDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsQueuedDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsRedispatchedDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyRequestsTotalDataPoint(ts pcommon.Timestamp, inputVal string, ...) error
- func (mb *MetricsBuilder) RecordHaproxyResponsesDeniedDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxyResponsesErrorsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordHaproxyServerSelectedTotalDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxySessionsAverageDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxySessionsCountDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxySessionsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
- func (mb *MetricsBuilder) RecordHaproxySessionsTotalDataPoint(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("haproxy") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/haproxyreceiver" )
var MapAttributeStatusCode = map[string]AttributeStatusCode{ "1xx": AttributeStatusCode1xx, "2xx": AttributeStatusCode2xx, "3xx": AttributeStatusCode3xx, "4xx": AttributeStatusCode4xx, "5xx": AttributeStatusCode5xx, "other": AttributeStatusCodeOther, }
MapAttributeStatusCode is a helper map of string to AttributeStatusCode attribute value.
Functions ¶
This section is empty.
Types ¶
type AttributeStatusCode ¶ added in v0.70.0
type AttributeStatusCode int
AttributeStatusCode specifies the value status_code attribute.
const ( AttributeStatusCode1xx AttributeStatusCode AttributeStatusCode2xx AttributeStatusCode3xx AttributeStatusCode4xx AttributeStatusCode5xx AttributeStatusCodeOther )
func (AttributeStatusCode) String ¶ added in v0.70.0
func (av AttributeStatusCode) String() string
String returns the string representation of the AttributeStatusCode.
type MetricBuilderOption ¶ added in v0.110.0
type MetricBuilderOption interface {
// contains filtered or unexported methods
}
MetricBuilderOption applies changes to default metrics builder.
func WithStartTime ¶
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 ¶
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 ¶
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
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 ¶
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) RecordHaproxyBytesInputDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyBytesInputDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyBytesInputDataPoint adds a data point to haproxy.bytes.input metric.
func (*MetricsBuilder) RecordHaproxyBytesOutputDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyBytesOutputDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyBytesOutputDataPoint adds a data point to haproxy.bytes.output metric.
func (*MetricsBuilder) RecordHaproxyClientsCanceledDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyClientsCanceledDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyClientsCanceledDataPoint adds a data point to haproxy.clients.canceled metric.
func (*MetricsBuilder) RecordHaproxyCompressionBypassDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyCompressionBypassDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyCompressionBypassDataPoint adds a data point to haproxy.compression.bypass metric.
func (*MetricsBuilder) RecordHaproxyCompressionCountDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyCompressionCountDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyCompressionCountDataPoint adds a data point to haproxy.compression.count metric.
func (*MetricsBuilder) RecordHaproxyCompressionInputDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyCompressionInputDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyCompressionInputDataPoint adds a data point to haproxy.compression.input metric.
func (*MetricsBuilder) RecordHaproxyCompressionOutputDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyCompressionOutputDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyCompressionOutputDataPoint adds a data point to haproxy.compression.output metric.
func (*MetricsBuilder) RecordHaproxyConnectionsErrorsDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyConnectionsErrorsDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyConnectionsErrorsDataPoint adds a data point to haproxy.connections.errors metric.
func (*MetricsBuilder) RecordHaproxyConnectionsRateDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyConnectionsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyConnectionsRateDataPoint adds a data point to haproxy.connections.rate metric.
func (*MetricsBuilder) RecordHaproxyConnectionsRetriesDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyConnectionsRetriesDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyConnectionsRetriesDataPoint adds a data point to haproxy.connections.retries metric.
func (*MetricsBuilder) RecordHaproxyConnectionsTotalDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyConnectionsTotalDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyConnectionsTotalDataPoint adds a data point to haproxy.connections.total metric.
func (*MetricsBuilder) RecordHaproxyDowntimeDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyDowntimeDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyDowntimeDataPoint adds a data point to haproxy.downtime metric.
func (*MetricsBuilder) RecordHaproxyFailedChecksDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyFailedChecksDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyFailedChecksDataPoint adds a data point to haproxy.failed_checks metric.
func (*MetricsBuilder) RecordHaproxyRequestsDeniedDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsDeniedDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyRequestsDeniedDataPoint adds a data point to haproxy.requests.denied metric.
func (*MetricsBuilder) RecordHaproxyRequestsErrorsDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsErrorsDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyRequestsErrorsDataPoint adds a data point to haproxy.requests.errors metric.
func (*MetricsBuilder) RecordHaproxyRequestsQueuedDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsQueuedDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyRequestsQueuedDataPoint adds a data point to haproxy.requests.queued metric.
func (*MetricsBuilder) RecordHaproxyRequestsRateDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyRequestsRateDataPoint adds a data point to haproxy.requests.rate metric.
func (*MetricsBuilder) RecordHaproxyRequestsRedispatchedDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsRedispatchedDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyRequestsRedispatchedDataPoint adds a data point to haproxy.requests.redispatched metric.
func (*MetricsBuilder) RecordHaproxyRequestsTotalDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyRequestsTotalDataPoint(ts pcommon.Timestamp, inputVal string, statusCodeAttributeValue AttributeStatusCode) error
RecordHaproxyRequestsTotalDataPoint adds a data point to haproxy.requests.total metric.
func (*MetricsBuilder) RecordHaproxyResponsesDeniedDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyResponsesDeniedDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyResponsesDeniedDataPoint adds a data point to haproxy.responses.denied metric.
func (*MetricsBuilder) RecordHaproxyResponsesErrorsDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyResponsesErrorsDataPoint(ts pcommon.Timestamp, val int64)
RecordHaproxyResponsesErrorsDataPoint adds a data point to haproxy.responses.errors metric.
func (*MetricsBuilder) RecordHaproxyServerSelectedTotalDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxyServerSelectedTotalDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxyServerSelectedTotalDataPoint adds a data point to haproxy.server_selected.total metric.
func (*MetricsBuilder) RecordHaproxySessionsAverageDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxySessionsAverageDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxySessionsAverageDataPoint adds a data point to haproxy.sessions.average metric.
func (*MetricsBuilder) RecordHaproxySessionsCountDataPoint ¶
func (mb *MetricsBuilder) RecordHaproxySessionsCountDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxySessionsCountDataPoint adds a data point to haproxy.sessions.count metric.
func (*MetricsBuilder) RecordHaproxySessionsRateDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxySessionsRateDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxySessionsRateDataPoint adds a data point to haproxy.sessions.rate metric.
func (*MetricsBuilder) RecordHaproxySessionsTotalDataPoint ¶ added in v0.70.0
func (mb *MetricsBuilder) RecordHaproxySessionsTotalDataPoint(ts pcommon.Timestamp, inputVal string) error
RecordHaproxySessionsTotalDataPoint adds a data point to haproxy.sessions.total 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 ¶ added in v0.73.0
type MetricsBuilderConfig struct { Metrics MetricsConfig `mapstructure:"metrics"` ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` }
MetricsBuilderConfig is a configuration for haproxy metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { HaproxyBytesInput MetricConfig `mapstructure:"haproxy.bytes.input"` HaproxyBytesOutput MetricConfig `mapstructure:"haproxy.bytes.output"` HaproxyClientsCanceled MetricConfig `mapstructure:"haproxy.clients.canceled"` HaproxyCompressionBypass MetricConfig `mapstructure:"haproxy.compression.bypass"` HaproxyCompressionCount MetricConfig `mapstructure:"haproxy.compression.count"` HaproxyCompressionInput MetricConfig `mapstructure:"haproxy.compression.input"` HaproxyCompressionOutput MetricConfig `mapstructure:"haproxy.compression.output"` HaproxyConnectionsErrors MetricConfig `mapstructure:"haproxy.connections.errors"` HaproxyConnectionsRate MetricConfig `mapstructure:"haproxy.connections.rate"` HaproxyConnectionsRetries MetricConfig `mapstructure:"haproxy.connections.retries"` HaproxyConnectionsTotal MetricConfig `mapstructure:"haproxy.connections.total"` HaproxyDowntime MetricConfig `mapstructure:"haproxy.downtime"` HaproxyFailedChecks MetricConfig `mapstructure:"haproxy.failed_checks"` HaproxyRequestsDenied MetricConfig `mapstructure:"haproxy.requests.denied"` HaproxyRequestsErrors MetricConfig `mapstructure:"haproxy.requests.errors"` HaproxyRequestsQueued MetricConfig `mapstructure:"haproxy.requests.queued"` HaproxyRequestsRate MetricConfig `mapstructure:"haproxy.requests.rate"` HaproxyRequestsRedispatched MetricConfig `mapstructure:"haproxy.requests.redispatched"` HaproxyRequestsTotal MetricConfig `mapstructure:"haproxy.requests.total"` HaproxyResponsesDenied MetricConfig `mapstructure:"haproxy.responses.denied"` HaproxyResponsesErrors MetricConfig `mapstructure:"haproxy.responses.errors"` HaproxyServerSelectedTotal MetricConfig `mapstructure:"haproxy.server_selected.total"` HaproxySessionsAverage MetricConfig `mapstructure:"haproxy.sessions.average"` HaproxySessionsCount MetricConfig `mapstructure:"haproxy.sessions.count"` HaproxySessionsRate MetricConfig `mapstructure:"haproxy.sessions.rate"` HaproxySessionsTotal MetricConfig `mapstructure:"haproxy.sessions.total"` }
MetricsConfig provides config for haproxy 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 { HaproxyAddr ResourceAttributeConfig `mapstructure:"haproxy.addr"` HaproxyProxyName ResourceAttributeConfig `mapstructure:"haproxy.proxy_name"` HaproxyServiceName ResourceAttributeConfig `mapstructure:"haproxy.service_name"` }
ResourceAttributesConfig provides config for haproxy 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) SetHaproxyAddr ¶ added in v0.82.0
func (rb *ResourceBuilder) SetHaproxyAddr(val string)
SetHaproxyAddr sets provided value as "haproxy.addr" attribute.
func (*ResourceBuilder) SetHaproxyProxyName ¶ added in v0.83.0
func (rb *ResourceBuilder) SetHaproxyProxyName(val string)
SetHaproxyProxyName sets provided value as "haproxy.proxy_name" attribute.
func (*ResourceBuilder) SetHaproxyServiceName ¶ added in v0.83.0
func (rb *ResourceBuilder) SetHaproxyServiceName(val string)
SetHaproxyServiceName sets provided value as "haproxy.service_name" attribute.
type ResourceMetricsOption ¶
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 ¶
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.