metadata

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelBeta
)

Variables

View Source
var (
	Type      = component.MustNewType("nginx")
	ScopeName = "otelcol/nginxreceiver"
)

MapAttributeNginxConnectionsOutcome is a helper map of string to AttributeNginxConnectionsOutcome attribute value.

MapAttributeNginxStatusRange is a helper map of string to AttributeNginxStatusRange attribute value.

View Source
var MetricsInfo = metricsInfo{
	NginxHTTPConnectionCount: metricInfo{
		Name: "nginx.http.connection.count",
	},
	NginxHTTPConnections: metricInfo{
		Name: "nginx.http.connections",
	},
	NginxHTTPRequestCount: metricInfo{
		Name: "nginx.http.request.count",
	},
	NginxHTTPRequests: metricInfo{
		Name: "nginx.http.requests",
	},
	NginxHTTPResponseCount: metricInfo{
		Name: "nginx.http.response.count",
	},
}

Functions

This section is empty.

Types

type AttributeNginxConnectionsOutcome

type AttributeNginxConnectionsOutcome int

AttributeNginxConnectionsOutcome specifies the value nginx.connections.outcome attribute.

const (
	AttributeNginxConnectionsOutcomeACCEPTED AttributeNginxConnectionsOutcome
	AttributeNginxConnectionsOutcomeACTIVE
	AttributeNginxConnectionsOutcomeHANDLED
	AttributeNginxConnectionsOutcomeREADING
	AttributeNginxConnectionsOutcomeWRITING
	AttributeNginxConnectionsOutcomeWAITING
)

func (AttributeNginxConnectionsOutcome) String

String returns the string representation of the AttributeNginxConnectionsOutcome.

type AttributeNginxStatusRange

type AttributeNginxStatusRange int

AttributeNginxStatusRange specifies the value nginx.status_range attribute.

const (
	AttributeNginxStatusRange1xx AttributeNginxStatusRange
	AttributeNginxStatusRange2xx
	AttributeNginxStatusRange3xx
	AttributeNginxStatusRange4xx
	AttributeNginxStatusRange5xx
)

func (AttributeNginxStatusRange) String

func (av AttributeNginxStatusRange) String() string

String returns the string representation of the AttributeNginxStatusRange.

type MetricBuilderOption

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

type MetricConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

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

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) RecordNginxHTTPConnectionCountDataPoint

func (mb *MetricsBuilder) RecordNginxHTTPConnectionCountDataPoint(ts pcommon.Timestamp, val int64, nginxConnectionsOutcomeAttributeValue AttributeNginxConnectionsOutcome)

RecordNginxHTTPConnectionCountDataPoint adds a data point to nginx.http.connection.count metric.

func (*MetricsBuilder) RecordNginxHTTPConnectionsDataPoint

func (mb *MetricsBuilder) RecordNginxHTTPConnectionsDataPoint(ts pcommon.Timestamp, val int64, nginxConnectionsOutcomeAttributeValue AttributeNginxConnectionsOutcome)

RecordNginxHTTPConnectionsDataPoint adds a data point to nginx.http.connections metric.

func (*MetricsBuilder) RecordNginxHTTPRequestCountDataPoint

func (mb *MetricsBuilder) RecordNginxHTTPRequestCountDataPoint(ts pcommon.Timestamp, val int64)

RecordNginxHTTPRequestCountDataPoint adds a data point to nginx.http.request.count metric.

func (*MetricsBuilder) RecordNginxHTTPRequestsDataPoint

func (mb *MetricsBuilder) RecordNginxHTTPRequestsDataPoint(ts pcommon.Timestamp, val int64)

RecordNginxHTTPRequestsDataPoint adds a data point to nginx.http.requests metric.

func (*MetricsBuilder) RecordNginxHTTPResponseCountDataPoint

func (mb *MetricsBuilder) RecordNginxHTTPResponseCountDataPoint(ts pcommon.Timestamp, val int64, nginxStatusRangeAttributeValue AttributeNginxStatusRange)

RecordNginxHTTPResponseCountDataPoint adds a data point to nginx.http.response.count 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            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for nginx metrics builder.

func DefaultMetricsBuilderConfig

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	NginxHTTPConnectionCount MetricConfig `mapstructure:"nginx.http.connection.count"`
	NginxHTTPConnections     MetricConfig `mapstructure:"nginx.http.connections"`
	NginxHTTPRequestCount    MetricConfig `mapstructure:"nginx.http.request.count"`
	NginxHTTPRequests        MetricConfig `mapstructure:"nginx.http.requests"`
	NginxHTTPResponseCount   MetricConfig `mapstructure:"nginx.http.response.count"`
}

MetricsConfig provides config for nginx metrics.

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

type ResourceAttributeConfig

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.

func (*ResourceAttributeConfig) Unmarshal

func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error

type ResourceAttributesConfig

type ResourceAttributesConfig struct {
	InstanceID   ResourceAttributeConfig `mapstructure:"instance.id"`
	InstanceType ResourceAttributeConfig `mapstructure:"instance.type"`
}

ResourceAttributesConfig provides config for nginx resource attributes.

func DefaultResourceAttributesConfig

func DefaultResourceAttributesConfig() ResourceAttributesConfig

type ResourceBuilder

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

func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder

NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application.

func (*ResourceBuilder) Emit

func (rb *ResourceBuilder) Emit() pcommon.Resource

Emit returns the built resource and resets the internal builder state.

func (*ResourceBuilder) SetInstanceID

func (rb *ResourceBuilder) SetInstanceID(val string)

SetInstanceID sets provided value as "instance.id" attribute.

func (*ResourceBuilder) SetInstanceType

func (rb *ResourceBuilder) SetInstanceType(val string)

SetInstanceType sets provided value as "instance.type" attribute.

type ResourceMetricsOption

type ResourceMetricsOption interface {
	// contains filtered or unexported methods
}

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL