当前位置: 首页>>代码示例>>Golang>>正文


Golang DirectorySpec.RegisterMetricInGroup方法代码示例

本文整理汇总了Golang中github.com/Symantec/tricorder/go/tricorder.DirectorySpec.RegisterMetricInGroup方法的典型用法代码示例。如果您正苦于以下问题:Golang DirectorySpec.RegisterMetricInGroup方法的具体用法?Golang DirectorySpec.RegisterMetricInGroup怎么用?Golang DirectorySpec.RegisterMetricInGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/Symantec/tricorder/go/tricorder.DirectorySpec的用法示例。


在下文中一共展示了DirectorySpec.RegisterMetricInGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: RegisterMetrics

func (s *pageQueueType) RegisterMetrics(d *tricorder.DirectorySpec) (
	err error) {
	var queueStats btreepq.PageQueueStats
	queueGroup := tricorder.NewGroup()
	queueGroup.RegisterUpdateFunc(func() time.Time {
		s.PageQueueStats(&queueStats)
		return time.Now()
	})
	if err = d.RegisterMetricInGroup(
		"/highPriorityCount",
		&queueStats.HighPriorityCount,
		queueGroup,
		units.None,
		"Number of pages in high priority queue"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/lowPriorityCount",
		&queueStats.LowPriorityCount,
		queueGroup,
		units.None,
		"Number of pages in low priority queue"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/totalPages",
		queueStats.TotalCount,
		queueGroup,
		units.None,
		"Total number of pages."); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/nextLowPrioritySeqNo",
		&queueStats.NextLowPrioritySeqNo,
		queueGroup,
		units.None,
		"Next seq no in low priority queue, 0 if empty"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/nextHighPrioritySeqNo",
		&queueStats.NextHighPrioritySeqNo,
		queueGroup,
		units.None,
		"Next seq no in high priority queue, 0 if empty"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/endSeqNo",
		&queueStats.EndSeqNo,
		queueGroup,
		units.None,
		"All seq no smaller than this. Marks end of both queues."); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/highPriorityRatio",
		queueStats.HighPriorityRatio,
		queueGroup,
		units.None,
		"High priority page ratio"); err != nil {
		return
	}

	if err = d.RegisterMetric(
		"/expanding",
		s.IsExpanding,
		units.None,
		"Is page queue expanding."); err != nil {
		return
	}
	if err = d.RegisterMetric(
		"/maxValuesPerPage",
		&s.valueCountPerPage,
		units.None,
		"Maximum number ofvalues that can fit in a page."); err != nil {
		return
	}
	if err = d.RegisterMetric(
		"/inactiveThreshhold",
		&s.inactiveThreshhold,
		units.None,
		"The ratio of inactive pages needed before they are reclaimed first"); err != nil {
		return
	}
	if err = d.RegisterMetric(
		"/btreeDegree",
		&s.degree,
		units.None,
		"The degree of the btrees in the queue"); err != nil {
		return
	}
	return
}
开发者ID:keep94,项目名称:scotty,代码行数:95,代码来源:pagequeue.go

示例2: registerMetrics

func (s *Store) registerMetrics(d *tricorder.DirectorySpec) (err error) {
	if err = s.supplier.RegisterMetrics(d); err != nil {
		return
	}
	// Allow this store instance to be GCed
	maxValuesPerPage := s.supplier.MaxValuesPerPage()
	metrics := s.metrics

	if err = d.RegisterMetric(
		"/pagesPerMetric",
		metrics.PagesPerMetricDist,
		units.None,
		"Number of pages used per metric"); err != nil {
		return
	}
	var primitiveMetrics storePrimitiveMetricsType
	storeGroup := tricorder.NewGroup()
	storeGroup.RegisterUpdateFunc(func() time.Time {
		metrics.Metrics(&primitiveMetrics)
		return time.Now()
	})
	if err = d.RegisterMetricInGroup(
		"/pageUtilization",
		func() float64 {
			metricValueCount := primitiveMetrics.UniqueMetricValueCount
			pagesInUseCount := metrics.PagesPerMetricDist.Sum()
			metricCount := metrics.PagesPerMetricDist.Count()
			extraValueCount := float64(metricValueCount) - float64(metricCount)
			return extraValueCount / pagesInUseCount / float64(maxValuesPerPage)
		},
		storeGroup,
		units.None,
		"Page utilization 0.0 - 1.0"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/metricValueCount",
		&primitiveMetrics.UniqueMetricValueCount,
		storeGroup,
		units.None,
		"Number of unique metrics values"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/timeSpan",
		primitiveMetrics.TimeSpan,
		storeGroup,
		units.Second,
		"Span of time in store"); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/valuePageCount",
		metrics.PagesPerMetricDist.Sum,
		storeGroup,
		units.None,
		"Number of pages used for values."); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/timestampPageCount",
		&primitiveMetrics.TimeStampPageCount,
		storeGroup,
		units.None,
		"Number of pages used for timestamps."); err != nil {
		return
	}
	if err = d.RegisterMetricInGroup(
		"/totalPagesInUseCount",
		func() int64 {
			return primitiveMetrics.TimeStampPageCount + int64(metrics.PagesPerMetricDist.Sum())
		},
		storeGroup,
		units.None,
		"Total number of pages used."); err != nil {
		return
	}
	return
}
开发者ID:keep94,项目名称:scotty,代码行数:79,代码来源:store.go


注:本文中的github.com/Symantec/tricorder/go/tricorder.DirectorySpec.RegisterMetricInGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。