metadata

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TracesStability  = component.StabilityLevelDevelopment
	MetricsStability = component.StabilityLevelAlpha
)

Variables

View Source
var (
	Type      = component.MustNewType("github")
	ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver"
)
View Source
var MapAttributeVcsChangeState = map[string]AttributeVcsChangeState{
	"open":   AttributeVcsChangeStateOpen,
	"merged": AttributeVcsChangeStateMerged,
}

MapAttributeVcsChangeState is a helper map of string to AttributeVcsChangeState attribute value.

MapAttributeVcsLineChangeType is a helper map of string to AttributeVcsLineChangeType attribute value.

View Source
var MapAttributeVcsRefHeadType = map[string]AttributeVcsRefHeadType{
	"branch": AttributeVcsRefHeadTypeBranch,
	"tag":    AttributeVcsRefHeadTypeTag,
}

MapAttributeVcsRefHeadType is a helper map of string to AttributeVcsRefHeadType attribute value.

MapAttributeVcsRevisionDeltaDirection is a helper map of string to AttributeVcsRevisionDeltaDirection attribute value.

Functions

This section is empty.

Types

type AttributeVcsChangeState added in v0.116.0

type AttributeVcsChangeState int

AttributeVcsChangeState specifies the a value vcs.change.state attribute.

const (
	AttributeVcsChangeStateOpen AttributeVcsChangeState
	AttributeVcsChangeStateMerged
)

func (AttributeVcsChangeState) String added in v0.116.0

func (av AttributeVcsChangeState) String() string

String returns the string representation of the AttributeVcsChangeState.

type AttributeVcsLineChangeType added in v0.116.0

type AttributeVcsLineChangeType int

AttributeVcsLineChangeType specifies the a value vcs.line_change.type attribute.

const (
	AttributeVcsLineChangeTypeAdded AttributeVcsLineChangeType
	AttributeVcsLineChangeTypeRemoved
)

func (AttributeVcsLineChangeType) String added in v0.116.0

func (av AttributeVcsLineChangeType) String() string

String returns the string representation of the AttributeVcsLineChangeType.

type AttributeVcsRefHeadType added in v0.116.0

type AttributeVcsRefHeadType int

AttributeVcsRefHeadType specifies the a value vcs.ref.head.type attribute.

const (
	AttributeVcsRefHeadTypeBranch AttributeVcsRefHeadType
	AttributeVcsRefHeadTypeTag
)

func (AttributeVcsRefHeadType) String added in v0.116.0

func (av AttributeVcsRefHeadType) String() string

String returns the string representation of the AttributeVcsRefHeadType.

type AttributeVcsRevisionDeltaDirection added in v0.116.0

type AttributeVcsRevisionDeltaDirection int

AttributeVcsRevisionDeltaDirection specifies the a value vcs.revision_delta.direction attribute.

const (
	AttributeVcsRevisionDeltaDirectionAhead AttributeVcsRevisionDeltaDirection
	AttributeVcsRevisionDeltaDirectionBehind
)

func (AttributeVcsRevisionDeltaDirection) String added in v0.116.0

String returns the string representation of the AttributeVcsRevisionDeltaDirection.

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

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) RecordVcsChangeCountDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsChangeCountDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsChangeStateAttributeValue AttributeVcsChangeState, vcsRepositoryNameAttributeValue string)

RecordVcsChangeCountDataPoint adds a data point to vcs.change.count metric.

func (*MetricsBuilder) RecordVcsChangeDurationDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsChangeDurationDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string, vcsChangeStateAttributeValue AttributeVcsChangeState)

RecordVcsChangeDurationDataPoint adds a data point to vcs.change.duration metric.

func (*MetricsBuilder) RecordVcsChangeTimeToApprovalDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsChangeTimeToApprovalDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string)

RecordVcsChangeTimeToApprovalDataPoint adds a data point to vcs.change.time_to_approval metric.

func (*MetricsBuilder) RecordVcsChangeTimeToMergeDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsChangeTimeToMergeDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string)

RecordVcsChangeTimeToMergeDataPoint adds a data point to vcs.change.time_to_merge metric.

func (*MetricsBuilder) RecordVcsContributorCountDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsContributorCountDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string)

RecordVcsContributorCountDataPoint adds a data point to vcs.contributor.count metric.

func (*MetricsBuilder) RecordVcsRefCountDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsRefCountDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadTypeAttributeValue AttributeVcsRefHeadType)

RecordVcsRefCountDataPoint adds a data point to vcs.ref.count metric.

func (*MetricsBuilder) RecordVcsRefLinesDeltaDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsRefLinesDeltaDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string, vcsRefHeadTypeAttributeValue AttributeVcsRefHeadType, vcsLineChangeTypeAttributeValue AttributeVcsLineChangeType)

RecordVcsRefLinesDeltaDataPoint adds a data point to vcs.ref.lines_delta metric.

func (*MetricsBuilder) RecordVcsRefRevisionsDeltaDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsRefRevisionsDeltaDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string, vcsRefHeadTypeAttributeValue AttributeVcsRefHeadType, vcsRevisionDeltaDirectionAttributeValue AttributeVcsRevisionDeltaDirection)

RecordVcsRefRevisionsDeltaDataPoint adds a data point to vcs.ref.revisions_delta metric.

func (*MetricsBuilder) RecordVcsRefTimeDataPoint added in v0.116.0

func (mb *MetricsBuilder) RecordVcsRefTimeDataPoint(ts pcommon.Timestamp, val int64, vcsRepositoryURLFullAttributeValue string, vcsRepositoryNameAttributeValue string, vcsRefHeadNameAttributeValue string, vcsRefHeadTypeAttributeValue AttributeVcsRefHeadType)

RecordVcsRefTimeDataPoint adds a data point to vcs.ref.time metric.

func (*MetricsBuilder) RecordVcsRepositoryCountDataPoint

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

RecordVcsRepositoryCountDataPoint adds a data point to vcs.repository.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 github metrics builder.

func DefaultMetricsBuilderConfig

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	VcsChangeCount          MetricConfig `mapstructure:"vcs.change.count"`
	VcsChangeDuration       MetricConfig `mapstructure:"vcs.change.duration"`
	VcsChangeTimeToApproval MetricConfig `mapstructure:"vcs.change.time_to_approval"`
	VcsChangeTimeToMerge    MetricConfig `mapstructure:"vcs.change.time_to_merge"`
	VcsContributorCount     MetricConfig `mapstructure:"vcs.contributor.count"`
	VcsRefCount             MetricConfig `mapstructure:"vcs.ref.count"`
	VcsRefLinesDelta        MetricConfig `mapstructure:"vcs.ref.lines_delta"`
	VcsRefRevisionsDelta    MetricConfig `mapstructure:"vcs.ref.revisions_delta"`
	VcsRefTime              MetricConfig `mapstructure:"vcs.ref.time"`
	VcsRepositoryCount      MetricConfig `mapstructure:"vcs.repository.count"`
}

MetricsConfig provides config for github 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 {
	OrganizationName ResourceAttributeConfig `mapstructure:"organization.name"`
	VcsVendorName    ResourceAttributeConfig `mapstructure:"vcs.vendor.name"`
}

ResourceAttributesConfig provides config for github 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) SetOrganizationName

func (rb *ResourceBuilder) SetOrganizationName(val string)

SetOrganizationName sets provided value as "organization.name" attribute.

func (*ResourceBuilder) SetVcsVendorName

func (rb *ResourceBuilder) SetVcsVendorName(val string)

SetVcsVendorName sets provided value as "vcs.vendor.name" 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