metadata

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsStability = component.StabilityLevelAlpha
)

Variables

View Source
var MapAttributeClass = map[string]AttributeClass{
	"datapath": AttributeClassDatapath,
	"services": AttributeClassServices,
}

MapAttributeClass is a helper map of string to AttributeClass attribute value.

View Source
var MapAttributeDirection = map[string]AttributeDirection{
	"received":    AttributeDirectionReceived,
	"transmitted": AttributeDirectionTransmitted,
}

MapAttributeDirection is a helper map of string to AttributeDirection attribute value.

View Source
var MapAttributeDiskState = map[string]AttributeDiskState{
	"used":      AttributeDiskStateUsed,
	"available": AttributeDiskStateAvailable,
}

MapAttributeDiskState is a helper map of string to AttributeDiskState attribute value.

View Source
var MapAttributePacketType = map[string]AttributePacketType{
	"dropped": AttributePacketTypeDropped,
	"errored": AttributePacketTypeErrored,
	"success": AttributePacketTypeSuccess,
}

MapAttributePacketType is a helper map of string to AttributePacketType attribute value.

View Source
var (
	Type = component.MustNewType("nsxt")
)

Functions

func Meter added in v0.92.0

func Meter(settings component.TelemetrySettings) metric.Meter

func Tracer added in v0.92.0

func Tracer(settings component.TelemetrySettings) trace.Tracer

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type AttributeClass

type AttributeClass int

AttributeClass specifies the a value class attribute.

const (
	AttributeClassDatapath AttributeClass
	AttributeClassServices
)

func (AttributeClass) String

func (av AttributeClass) String() string

String returns the string representation of the AttributeClass.

type AttributeDirection

type AttributeDirection int

AttributeDirection specifies the a value direction attribute.

const (
	AttributeDirectionReceived AttributeDirection
	AttributeDirectionTransmitted
)

func (AttributeDirection) String

func (av AttributeDirection) String() string

String returns the string representation of the AttributeDirection.

type AttributeDiskState

type AttributeDiskState int

AttributeDiskState specifies the a value disk_state attribute.

const (
	AttributeDiskStateUsed AttributeDiskState
	AttributeDiskStateAvailable
)

func (AttributeDiskState) String

func (av AttributeDiskState) String() string

String returns the string representation of the AttributeDiskState.

type AttributePacketType

type AttributePacketType int

AttributePacketType specifies the a value packet.type attribute.

const (
	AttributePacketTypeDropped AttributePacketType
	AttributePacketTypeErrored
	AttributePacketTypeSuccess
)

func (AttributePacketType) String

func (av AttributePacketType) String() string

String returns the string representation of the AttributePacketType.

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.

func (*MetricConfig) Unmarshal added in v0.77.0

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.CreateSettings, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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(rmo ...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) RecordNsxtNodeCPUUtilizationDataPoint

func (mb *MetricsBuilder) RecordNsxtNodeCPUUtilizationDataPoint(ts pcommon.Timestamp, val float64, classAttributeValue AttributeClass)

RecordNsxtNodeCPUUtilizationDataPoint adds a data point to nsxt.node.cpu.utilization metric.

func (*MetricsBuilder) RecordNsxtNodeFilesystemUsageDataPoint

func (mb *MetricsBuilder) RecordNsxtNodeFilesystemUsageDataPoint(ts pcommon.Timestamp, val int64, diskStateAttributeValue AttributeDiskState)

RecordNsxtNodeFilesystemUsageDataPoint adds a data point to nsxt.node.filesystem.usage metric.

func (*MetricsBuilder) RecordNsxtNodeFilesystemUtilizationDataPoint

func (mb *MetricsBuilder) RecordNsxtNodeFilesystemUtilizationDataPoint(ts pcommon.Timestamp, val float64)

RecordNsxtNodeFilesystemUtilizationDataPoint adds a data point to nsxt.node.filesystem.utilization metric.

func (*MetricsBuilder) RecordNsxtNodeMemoryCacheUsageDataPoint

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

RecordNsxtNodeMemoryCacheUsageDataPoint adds a data point to nsxt.node.memory.cache.usage metric.

func (*MetricsBuilder) RecordNsxtNodeMemoryUsageDataPoint

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

RecordNsxtNodeMemoryUsageDataPoint adds a data point to nsxt.node.memory.usage metric.

func (*MetricsBuilder) RecordNsxtNodeNetworkIoDataPoint

func (mb *MetricsBuilder) RecordNsxtNodeNetworkIoDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection)

RecordNsxtNodeNetworkIoDataPoint adds a data point to nsxt.node.network.io metric.

func (*MetricsBuilder) RecordNsxtNodeNetworkPacketCountDataPoint

func (mb *MetricsBuilder) RecordNsxtNodeNetworkPacketCountDataPoint(ts pcommon.Timestamp, val int64, directionAttributeValue AttributeDirection, packetTypeAttributeValue AttributePacketType)

RecordNsxtNodeNetworkPacketCountDataPoint adds a data point to nsxt.node.network.packet.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 added in v0.73.0

type MetricsBuilderConfig struct {
	Metrics            MetricsConfig            `mapstructure:"metrics"`
	ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}

MetricsBuilderConfig is a configuration for nsxt metrics builder.

func DefaultMetricsBuilderConfig added in v0.73.0

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig added in v0.77.0

type MetricsConfig struct {
	NsxtNodeCPUUtilization        MetricConfig `mapstructure:"nsxt.node.cpu.utilization"`
	NsxtNodeFilesystemUsage       MetricConfig `mapstructure:"nsxt.node.filesystem.usage"`
	NsxtNodeFilesystemUtilization MetricConfig `mapstructure:"nsxt.node.filesystem.utilization"`
	NsxtNodeMemoryCacheUsage      MetricConfig `mapstructure:"nsxt.node.memory.cache.usage"`
	NsxtNodeMemoryUsage           MetricConfig `mapstructure:"nsxt.node.memory.usage"`
	NsxtNodeNetworkIo             MetricConfig `mapstructure:"nsxt.node.network.io"`
	NsxtNodeNetworkPacketCount    MetricConfig `mapstructure:"nsxt.node.network.packet.count"`
}

MetricsConfig provides config for nsxt 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.

func (*ResourceAttributeConfig) Unmarshal added in v0.87.0

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

type ResourceAttributesConfig added in v0.77.0

type ResourceAttributesConfig struct {
	DeviceID     ResourceAttributeConfig `mapstructure:"device.id"`
	NsxtNodeID   ResourceAttributeConfig `mapstructure:"nsxt.node.id"`
	NsxtNodeName ResourceAttributeConfig `mapstructure:"nsxt.node.name"`
	NsxtNodeType ResourceAttributeConfig `mapstructure:"nsxt.node.type"`
}

ResourceAttributesConfig provides config for nsxt 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) SetDeviceID added in v0.82.0

func (rb *ResourceBuilder) SetDeviceID(val string)

SetDeviceID sets provided value as "device.id" attribute.

func (*ResourceBuilder) SetNsxtNodeID added in v0.82.0

func (rb *ResourceBuilder) SetNsxtNodeID(val string)

SetNsxtNodeID sets provided value as "nsxt.node.id" attribute.

func (*ResourceBuilder) SetNsxtNodeName added in v0.82.0

func (rb *ResourceBuilder) SetNsxtNodeName(val string)

SetNsxtNodeName sets provided value as "nsxt.node.name" attribute.

func (*ResourceBuilder) SetNsxtNodeType added in v0.82.0

func (rb *ResourceBuilder) SetNsxtNodeType(val string)

SetNsxtNodeType sets provided value as "nsxt.node.type" attribute.

type ResourceMetricsOption

type ResourceMetricsOption func(pmetric.ResourceMetrics)

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.

Jump to

Keyboard shortcuts

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