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


Golang Envelope.GetIp方法代码示例

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


在下文中一共展示了Envelope.GetIp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: update

func update(values map[string]int64, event *events.Envelope) int64 {

	values[event.GetIp()] = int64(event.GetCounterEvent().GetTotal())

	var sum int64
	for _, v := range values {
		sum = sum + v
	}

	return sum
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:11,代码来源:msgLoss.go

示例6: updateAndReturnValue

func updateAndReturnValue(values map[string]int, event *events.Envelope) int {

	switch event.GetEventType() {
	case events.Envelope_CounterEvent:
		values[event.GetIp()] = int(event.GetCounterEvent().GetTotal())
	case events.Envelope_ValueMetric:
		values[event.GetIp()] = int(event.GetValueMetric().GetValue())
	}

	sum := 0
	for _, v := range values {
		sum += v
	}

	return sum
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:16,代码来源:sinkType.go

示例7: 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.GetIp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。