Documentation ¶
Index ¶
- Constants
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeJobStatus
- type MetricConfig
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordJenkinsJobCommitDeltaDataPoint(ts pcommon.Timestamp, val int64, jobNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordJenkinsJobDurationDataPoint(ts pcommon.Timestamp, val int64, jobNameAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordJenkinsJobsCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsBuilderConfig
- type MetricsConfig
- type ResourceMetricsOption
Constants ¶
const ( Type = "jenkins" MetricsStability = component.StabilityLevelDevelopment )
Variables ¶
var MapAttributeJobStatus = map[string]AttributeJobStatus{ "failed": AttributeJobStatusFailed, "success": AttributeJobStatusSuccess, "unknown": AttributeJobStatusUnknown, }
MapAttributeJobStatus is a helper map of string to AttributeJobStatus attribute value.
Functions ¶
func WithStartTime ¶
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeJobStatus ¶
type AttributeJobStatus int
AttributeJobStatus specifies the a value job.status attribute.
const ( AttributeJobStatusFailed AttributeJobStatus AttributeJobStatusSuccess AttributeJobStatusUnknown )
func (AttributeJobStatus) String ¶
func (av AttributeJobStatus) String() string
String returns the string representation of the AttributeJobStatus.
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) RecordJenkinsJobCommitDeltaDataPoint ¶
func (mb *MetricsBuilder) RecordJenkinsJobCommitDeltaDataPoint(ts pcommon.Timestamp, val int64, jobNameAttributeValue string, jobStatusAttributeValue AttributeJobStatus)
RecordJenkinsJobCommitDeltaDataPoint adds a data point to jenkins.job.commit_delta metric.
func (*MetricsBuilder) RecordJenkinsJobDurationDataPoint ¶
func (mb *MetricsBuilder) RecordJenkinsJobDurationDataPoint(ts pcommon.Timestamp, val int64, jobNameAttributeValue string, jobStatusAttributeValue AttributeJobStatus)
RecordJenkinsJobDurationDataPoint adds a data point to jenkins.job.duration metric.
func (*MetricsBuilder) RecordJenkinsJobsCountDataPoint ¶
func (mb *MetricsBuilder) RecordJenkinsJobsCountDataPoint(ts pcommon.Timestamp, val int64)
RecordJenkinsJobsCountDataPoint adds a data point to jenkins.jobs.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"`
}
MetricsBuilderConfig is a configuration for jenkins metrics builder.
func DefaultMetricsBuilderConfig ¶
func DefaultMetricsBuilderConfig() MetricsBuilderConfig
type MetricsConfig ¶
type MetricsConfig struct { JenkinsJobCommitDelta MetricConfig `mapstructure:"jenkins.job.commit_delta"` JenkinsJobDuration MetricConfig `mapstructure:"jenkins.job.duration"` JenkinsJobsCount MetricConfig `mapstructure:"jenkins.jobs.count"` }
MetricsConfig provides config for jenkins metrics.
func DefaultMetricsConfig ¶
func DefaultMetricsConfig() MetricsConfig
type ResourceMetricsOption ¶
type ResourceMetricsOption func(pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
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.