Documentation ¶
Index ¶
- Constants
- Variables
- type AttributeState
- type MetricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordNginxConnectionsAcceptedDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordNginxConnectionsCurrentDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)
- func (mb *MetricsBuilder) RecordNginxConnectionsHandledDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordNginxRequestsDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceMetricsOption
Constants ¶
const (
MetricsStability = component.StabilityLevelBeta
)
Variables ¶
var ( Type = component.MustNewType("nginx") ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver" )
var MapAttributeState = map[string]AttributeState{ "active": AttributeStateActive, "reading": AttributeStateReading, "writing": AttributeStateWriting, "waiting": AttributeStateWaiting, }
MapAttributeState is a helper map of string to AttributeState attribute value.
Functions ¶
This section is empty.
Types ¶
type AttributeState ¶ added in v0.39.0
type AttributeState int
AttributeState specifies the a value state attribute.
const ( AttributeStateActive AttributeState AttributeStateReading AttributeStateWriting AttributeStateWaiting )
func (AttributeState) String ¶ added in v0.51.0
func (av AttributeState) String() string
String returns the string representation of the AttributeState.
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.44.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.44.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.44.0
func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.44.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) RecordNginxConnectionsAcceptedDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordNginxConnectionsAcceptedDataPoint(ts pcommon.Timestamp, val int64)
RecordNginxConnectionsAcceptedDataPoint adds a data point to nginx.connections_accepted metric.
func (*MetricsBuilder) RecordNginxConnectionsCurrentDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordNginxConnectionsCurrentDataPoint(ts pcommon.Timestamp, val int64, stateAttributeValue AttributeState)
RecordNginxConnectionsCurrentDataPoint adds a data point to nginx.connections_current metric.
func (*MetricsBuilder) RecordNginxConnectionsHandledDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordNginxConnectionsHandledDataPoint(ts pcommon.Timestamp, val int64)
RecordNginxConnectionsHandledDataPoint adds a data point to nginx.connections_handled metric.
func (*MetricsBuilder) RecordNginxRequestsDataPoint ¶ added in v0.44.0
func (mb *MetricsBuilder) RecordNginxRequestsDataPoint(ts pcommon.Timestamp, val int64)
RecordNginxRequestsDataPoint adds a data point to nginx.requests metric.
func (*MetricsBuilder) Reset ¶ added in v0.44.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"`
}
MetricsBuilderConfig is a configuration for nginx metrics builder.
func DefaultMetricsBuilderConfig ¶ added in v0.73.0
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶ added in v0.77.0
type MetricsConfig struct { NginxConnectionsAccepted MetricConfig `mapstructure:"nginx.connections_accepted"` NginxConnectionsCurrent MetricConfig `mapstructure:"nginx.connections_current"` NginxConnectionsHandled MetricConfig `mapstructure:"nginx.connections_handled"` NginxRequests MetricConfig `mapstructure:"nginx.requests"` }
MetricsConfig provides config for nginx metrics.
func DefaultMetricsConfig ¶ added in v0.77.0
func DefaultMetricsConfig() MetricsConfig
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.