Documentation ¶
Index ¶
- Constants
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder
- func (mb *MetricsBuilder) RecordGitRepositoryBranchCommitAheadbyCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryBranchCommitBehindbyCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryBranchCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
- func (mb *MetricsBuilder) RecordGitRepositoryBranchLineAdditionCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryBranchLineDeletionCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryBranchTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryContributorCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
- func (mb *MetricsBuilder) RecordGitRepositoryCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestApprovalTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestDeploymentTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestMergeTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestMergedCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestOpenCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
- func (mb *MetricsBuilder) RecordGitRepositoryPullRequestTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, ...)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceAttributeConfig
- type ResourceAttributesConfig
- type ResourceBuilder
- type ResourceMetricsOption
Constants ¶
const ( Type = "gitprovider" MetricsStability = component.StabilityLevelDevelopment )
Variables ¶
This section is empty.
Functions ¶
func WithStartTime ¶
WithStartTime sets startTime on the metrics builder.
Types ¶
type MetricConfig ¶
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.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
func (mb *MetricsBuilder) Emit(rmo ...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(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 ¶
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) RecordGitRepositoryBranchCommitAheadbyCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchCommitAheadbyCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryBranchCommitAheadbyCountDataPoint adds a data point to git.repository.branch.commit.aheadby.count metric.
func (*MetricsBuilder) RecordGitRepositoryBranchCommitBehindbyCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchCommitBehindbyCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryBranchCommitBehindbyCountDataPoint adds a data point to git.repository.branch.commit.behindby.count metric.
func (*MetricsBuilder) RecordGitRepositoryBranchCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
RecordGitRepositoryBranchCountDataPoint adds a data point to git.repository.branch.count metric.
func (*MetricsBuilder) RecordGitRepositoryBranchLineAdditionCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchLineAdditionCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryBranchLineAdditionCountDataPoint adds a data point to git.repository.branch.line.addition.count metric.
func (*MetricsBuilder) RecordGitRepositoryBranchLineDeletionCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchLineDeletionCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryBranchLineDeletionCountDataPoint adds a data point to git.repository.branch.line.deletion.count metric.
func (*MetricsBuilder) RecordGitRepositoryBranchTimeDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryBranchTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryBranchTimeDataPoint adds a data point to git.repository.branch.time metric.
func (*MetricsBuilder) RecordGitRepositoryContributorCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryContributorCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
RecordGitRepositoryContributorCountDataPoint adds a data point to git.repository.contributor.count metric.
func (*MetricsBuilder) RecordGitRepositoryCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryCountDataPoint(ts pcommon.Timestamp, val int64)
RecordGitRepositoryCountDataPoint adds a data point to git.repository.count metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestApprovalTimeDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestApprovalTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryPullRequestApprovalTimeDataPoint adds a data point to git.repository.pull_request.approval.time metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestDeploymentTimeDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestDeploymentTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryPullRequestDeploymentTimeDataPoint adds a data point to git.repository.pull_request.deployment.time metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestMergeTimeDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestMergeTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryPullRequestMergeTimeDataPoint adds a data point to git.repository.pull_request.merge.time metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestMergedCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestMergedCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
RecordGitRepositoryPullRequestMergedCountDataPoint adds a data point to git.repository.pull_request.merged.count metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestOpenCountDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestOpenCountDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string)
RecordGitRepositoryPullRequestOpenCountDataPoint adds a data point to git.repository.pull_request.open.count metric.
func (*MetricsBuilder) RecordGitRepositoryPullRequestTimeDataPoint ¶
func (mb *MetricsBuilder) RecordGitRepositoryPullRequestTimeDataPoint(ts pcommon.Timestamp, val int64, repositoryNameAttributeValue string, branchNameAttributeValue string)
RecordGitRepositoryPullRequestTimeDataPoint adds a data point to git.repository.pull_request.time 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 gitprovider metrics builder.
func DefaultMetricsBuilderConfig ¶
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶
type MetricsConfig struct { GitRepositoryBranchCommitAheadbyCount MetricConfig `mapstructure:"git.repository.branch.commit.aheadby.count"` GitRepositoryBranchCommitBehindbyCount MetricConfig `mapstructure:"git.repository.branch.commit.behindby.count"` GitRepositoryBranchCount MetricConfig `mapstructure:"git.repository.branch.count"` GitRepositoryBranchLineAdditionCount MetricConfig `mapstructure:"git.repository.branch.line.addition.count"` GitRepositoryBranchLineDeletionCount MetricConfig `mapstructure:"git.repository.branch.line.deletion.count"` GitRepositoryBranchTime MetricConfig `mapstructure:"git.repository.branch.time"` GitRepositoryContributorCount MetricConfig `mapstructure:"git.repository.contributor.count"` GitRepositoryCount MetricConfig `mapstructure:"git.repository.count"` GitRepositoryPullRequestApprovalTime MetricConfig `mapstructure:"git.repository.pull_request.approval.time"` GitRepositoryPullRequestDeploymentTime MetricConfig `mapstructure:"git.repository.pull_request.deployment.time"` GitRepositoryPullRequestMergeTime MetricConfig `mapstructure:"git.repository.pull_request.merge.time"` GitRepositoryPullRequestMergedCount MetricConfig `mapstructure:"git.repository.pull_request.merged.count"` GitRepositoryPullRequestOpenCount MetricConfig `mapstructure:"git.repository.pull_request.open.count"` GitRepositoryPullRequestTime MetricConfig `mapstructure:"git.repository.pull_request.time"` }
MetricsConfig provides config for gitprovider metrics.
func DefaultMetricsConfig ¶
func DefaultMetricsConfig() MetricsConfig
type ResourceAttributeConfig ¶
type ResourceAttributeConfig struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributesConfig ¶
type ResourceAttributesConfig struct { GitVendorName ResourceAttributeConfig `mapstructure:"git.vendor.name"` OrganizationName ResourceAttributeConfig `mapstructure:"organization.name"` }
ResourceAttributesConfig provides config for gitprovider 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) SetGitVendorName ¶
func (rb *ResourceBuilder) SetGitVendorName(val string)
SetGitVendorName sets provided value as "git.vendor.name" attribute.
func (*ResourceBuilder) SetOrganizationName ¶
func (rb *ResourceBuilder) SetOrganizationName(val string)
SetOrganizationName sets provided value as "organization.name" attribute.
type ResourceMetricsOption ¶
type ResourceMetricsOption func(pmetric.ResourceMetrics)
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.