當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Envelope.GetHeartbeat方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/noaa/events.Envelope.GetHeartbeat方法的典型用法代碼示例。如果您正苦於以下問題:Golang Envelope.GetHeartbeat方法的具體用法?Golang Envelope.GetHeartbeat怎麽用?Golang Envelope.GetHeartbeat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/noaa/events.Envelope的用法示例。


在下文中一共展示了Envelope.GetHeartbeat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Process

func (p *HeartbeatProcessor) Process(e *events.Envelope) []metrics.WMetric {
	processedMetrics := make([]metrics.WMetric, 4)
	heartbeat := e.GetHeartbeat()
	origin := e.GetOrigin()

	processedMetrics[0] = *p.ProcessHeartbeatCount(heartbeat, origin)
	processedMetrics[1] = *p.ProcessHeartbeatEventsSentCount(heartbeat, origin)
	processedMetrics[2] = *p.ProcessHeartbeatEventsReceivedCount(heartbeat, origin)
	processedMetrics[3] = *p.ProcessHeartbeatEventsErrorCount(heartbeat, origin)

	return processedMetrics
}
開發者ID:CA-APM,項目名稱:epagent-nozzle,代碼行數:12,代碼來源:heartbeat_processor.go

示例2: Heartbeat

func Heartbeat(msg *events.Envelope) Event {
	heartbeat := msg.GetHeartbeat()

	var avail uint64

	if heartbeat.GetSentCount() > 0 {
		avail = heartbeat.GetReceivedCount() / heartbeat.GetSentCount()
	}

	fields := logrus.Fields{
		"ctl_msg_id":     heartbeat.GetControlMessageIdentifier(),
		"error_count":    heartbeat.GetErrorCount(),
		"origin":         msg.GetOrigin(),
		"received_count": heartbeat.GetReceivedCount(),
		"sent_count":     heartbeat.GetSentCount(),
		"availability":   avail,
	}

	return Event{
		Fields: fields,
		Msg:    "",
		Type:   msg.GetEventType().String(),
	}
}
開發者ID:shinji62,項目名稱:firehose-to-syslog,代碼行數:24,代碼來源:events.go


注:本文中的github.com/cloudfoundry/noaa/events.Envelope.GetHeartbeat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。