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


Golang Envelope.GetJob方法代碼示例

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


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

示例1: AddMetric

func (c *Client) AddMetric(envelope *events.Envelope) {
	c.totalMessagesReceived++
	if envelope.GetEventType() != events.Envelope_ValueMetric && envelope.GetEventType() != events.Envelope_CounterEvent {
		return
	}

	key := metricKey{
		eventType:  envelope.GetEventType(),
		name:       getName(envelope),
		deployment: envelope.GetDeployment(),
		job:        envelope.GetJob(),
		index:      envelope.GetIndex(),
		ip:         envelope.GetIp(),
	}

	mVal := c.metricPoints[key]
	value := getValue(envelope)

	mVal.tags = getTags(envelope)
	mVal.points = append(mVal.points, Point{
		Timestamp: envelope.GetTimestamp() / int64(time.Second),
		Value:     value,
	})

	c.metricPoints[key] = mVal
}
開發者ID:simonjohansson,項目名稱:datadog-firehose-nozzle,代碼行數:26,代碼來源:datadog_client.go

示例2: getTags

func getTags(envelope *events.Envelope) poster.Tags {
	ret := poster.Tags{
		Deployment: envelope.GetDeployment(),
		Job:        envelope.GetJob(),
		Index:      envelope.GetIndex(),
		IP:         envelope.GetIp(),
	}
	return ret
}
開發者ID:pivotal-cf-experimental,項目名稱:opentsdb-firehose-nozzle,代碼行數:9,代碼來源:opentsdb_client.go

示例3: getTags

func getTags(envelope *events.Envelope) []string {
	var tags []string

	tags = appendTagIfNotEmpty(tags, "deployment", envelope.GetDeployment())
	tags = appendTagIfNotEmpty(tags, "job", envelope.GetJob())
	tags = appendTagIfNotEmpty(tags, "index", envelope.GetIndex())
	tags = appendTagIfNotEmpty(tags, "ip", envelope.GetIp())

	return tags
}
開發者ID:simonjohansson,項目名稱:datadog-firehose-nozzle,代碼行數:10,代碼來源:datadog_client.go

示例4: AnnotateWithEnveloppeData

func (e *Event) AnnotateWithEnveloppeData(msg *events.Envelope) {
	e.Fields["origin"] = msg.GetOrigin()
	e.Fields["deployment"] = msg.GetDeployment()
	e.Fields["ip"] = msg.GetIp()
	e.Fields["job"] = msg.GetJob()
	e.Fields["index"] = msg.GetIndex()
	//e.Fields["tags"] = msg.GetTags()
	e.Type = msg.GetEventType().String()

}
開發者ID:yacloud-io,項目名稱:firehose-to-syslog,代碼行數:10,代碼來源:events.go

示例5: EventToJSON

//EventToJSON turns a firehose event into a json representation
func EventToJSON(event *events.Envelope) *[]byte {
	props := map[string]interface{}{
		"time":       event.GetTimestamp() / 1000000000,
		"origin":     event.GetOrigin(),
		"deployment": event.GetDeployment(),
		"job":        event.GetJob(),
		"index":      event.GetIndex(),
		"ip":         event.GetIp(),
		"token":      mixPanelToken,
	}
	data := map[string]interface{}{
		"event":      event.GetEventType().String(),
		"properties": props,
	}

	j, err := json.Marshal(data)
	if nil != err {
		log.Print("Failed to marshal event")
		log.Print(data)
	}
	return &j
}
開發者ID:krujos,項目名稱:firehose-mixpanel,代碼行數:23,代碼來源:sender.go


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