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


Golang Envelope.GetOrigin方法代码示例

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


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

示例1: dopplerReceivedMessageCount

func dopplerReceivedMessageCount(msg *events.Envelope) bool {
	return msg.GetEventType() == events.Envelope_CounterEvent &&
		(msg.CounterEvent.GetName() == "udpListener.receivedMessageCount" ||
			msg.CounterEvent.GetName() == "tcpListener.receivedMessageCount" ||
			msg.CounterEvent.GetName() == "tlsListener.receivedMessageCount") &&
		msg.GetOrigin() == "DopplerServer"
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:7,代码来源:firehose_reader.go

示例2: HttpStartStop

func HttpStartStop(msg *events.Envelope) Event {
	httpStartStop := msg.GetHttpStartStop()

	fields := logrus.Fields{
		"origin":            msg.GetOrigin(),
		"cf_app_id":         httpStartStop.GetApplicationId(),
		"content_length":    httpStartStop.GetContentLength(),
		"instance_id":       httpStartStop.GetInstanceId(),
		"instance_index":    httpStartStop.GetInstanceIndex(),
		"method":            httpStartStop.GetMethod(),
		"parent_request_id": httpStartStop.GetParentRequestId(),
		"peer_type":         httpStartStop.GetPeerType(),
		"remote_addr":       httpStartStop.GetRemoteAddress(),
		"request_id":        httpStartStop.GetRequestId(),
		"start_timestamp":   httpStartStop.GetStartTimestamp(),
		"status_code":       httpStartStop.GetStatusCode(),
		"stop_timestamp":    httpStartStop.GetStopTimestamp(),
		"uri":               httpStartStop.GetUri(),
		"user_agent":        httpStartStop.GetUserAgent(),
		"duration_ms":       (((httpStartStop.GetStopTimestamp() - httpStartStop.GetStartTimestamp()) / 1000) / 1000),
	}

	return Event{
		Fields: fields,
		Msg:    "",
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:28,代码来源:events.go

示例3: 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

示例4: handleMessage

func (m *MetricsNozzle) handleMessage(envelope *events.Envelope) {
	if m.config.OriginID != "" {
		if envelope.GetOrigin() == m.config.OriginID {
			fmt.Fprintf(m.stdout, "%v \n", envelope)
		}
	} else {
		fmt.Fprintf(m.stdout, "%v \n", envelope)
	}

}
开发者ID:benlaplanche,项目名称:metrics-consumer,代码行数:10,代码来源:nozzle.go

示例5: checkValueMetric

func checkValueMetric(receivedEnvelope *events.Envelope, origin string, name string, value float64, unit string) {
	Expect(receivedEnvelope.GetEventType()).To(Equal(events.Envelope_ValueMetric))
	Expect(receivedEnvelope.GetOrigin()).To(Equal(origin))

	vm := receivedEnvelope.GetValueMetric()
	Expect(vm.GetName()).To(Equal(name))
	Expect(vm.GetValue()).To(BeNumerically("==", value))
	Expect(vm.GetUnit()).To(Equal(unit))

}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:10,代码来源:statsd_listener_test.go

示例6: getName

func getName(envelope *events.Envelope) string {
	switch envelope.GetEventType() {
	case events.Envelope_ValueMetric:
		return envelope.GetOrigin() + "." + envelope.GetValueMetric().GetName()
	case events.Envelope_CounterEvent:
		return envelope.GetOrigin() + "." + envelope.GetCounterEvent().GetName()
	default:
		panic("Unknown event type")
	}
}
开发者ID:simonjohansson,项目名称:datadog-firehose-nozzle,代码行数:10,代码来源:datadog_client.go

示例7: ForChart

func (m *MsgLossChart) ForChart(event *events.Envelope) bool {
	if event.GetEventType() != events.Envelope_CounterEvent {
		return false
	}
	if !contains(event.GetOrigin(), m.validOrigins) {
		return false
	}
	if !contains(event.GetCounterEvent().GetName(), m.validMetricNames) {
		return false
	}
	return true
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:12,代码来源:msgLoss.go

示例8: ForChart

func (s *SinkTypeChart) ForChart(event *events.Envelope) bool {
	if event.GetEventType() != events.Envelope_ValueMetric {
		return false
	}
	if !contains(event.GetOrigin(), s.validOrigins) {
		return false
	}
	if !contains(event.GetValueMetric().GetName(), s.validMetricNames) {
		return false
	}

	//	s.cfUI.Say("%f ", event.GetValueMetric().GetValue())
	return true
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:14,代码来源:sinkType.go

示例9: handleCounter

func (m *MessageAggregator) handleCounter(envelope *events.Envelope) *events.Envelope {
	metrics.BatchIncrementCounter("MessageAggregator.counterEventReceived")

	countID := counterID{
		name:   envelope.GetCounterEvent().GetName(),
		origin: envelope.GetOrigin(),
	}

	newVal := m.counterTotals[countID] + envelope.GetCounterEvent().GetDelta()
	m.counterTotals[countID] = newVal

	envelope.GetCounterEvent().Total = &newVal
	return envelope
}
开发者ID:yingkitw,项目名称:loggregator,代码行数:14,代码来源:message_aggregator.go

示例10: ErrorEvent

func ErrorEvent(msg *events.Envelope) Event {
	errorEvent := msg.GetError()

	fields := logrus.Fields{
		"origin": msg.GetOrigin(),
		"code":   errorEvent.GetCode(),
		"delta":  errorEvent.GetSource(),
	}

	return Event{
		Fields: fields,
		Msg:    errorEvent.GetMessage(),
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:15,代码来源:events.go

示例11: CounterEvent

func CounterEvent(msg *events.Envelope) Event {
	counterEvent := msg.GetCounterEvent()

	fields := logrus.Fields{
		"origin": msg.GetOrigin(),
		"name":   counterEvent.GetName(),
		"delta":  counterEvent.GetDelta(),
		"total":  counterEvent.GetTotal(),
	}

	return Event{
		Fields: fields,
		Msg:    "",
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:16,代码来源:events.go

示例12: ValueMetric

func ValueMetric(msg *events.Envelope) Event {
	valMetric := msg.GetValueMetric()

	fields := logrus.Fields{
		"origin": msg.GetOrigin(),
		"name":   valMetric.GetName(),
		"unit":   valMetric.GetUnit(),
		"value":  valMetric.GetValue(),
	}

	return Event{
		Fields: fields,
		Msg:    "",
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:16,代码来源:events.go

示例13: listenForEvents

func listenForEvents(origin []string) {
	for {
		buffer := make([]byte, 1024)
		n, _, err := udpListener.ReadFrom(buffer)
		if err != nil {
			return
		}

		if n == 0 {
			panic("Received empty packet")
		}
		envelope := new(events.Envelope)
		err = proto.Unmarshal(buffer[0:n], envelope)
		if err != nil {
			panic(err)
		}

		var eventId = envelope.GetEventType().String()

		tracker := eventTracker{eventType: eventId}

		switch envelope.GetEventType() {
		case events.Envelope_HttpStart:
			tracker.name = envelope.GetHttpStart().GetPeerType().String()
		case events.Envelope_HttpStop:
			tracker.name = envelope.GetHttpStop().GetPeerType().String()
		case events.Envelope_ValueMetric:
			tracker.name = envelope.GetValueMetric().GetName()
		case events.Envelope_CounterEvent:
			tracker.name = envelope.GetCounterEvent().GetName()
		default:
			panic("Unexpected message type")

		}

		if envelope.GetOrigin() != strings.Join(origin, "/") {
			panic("origin not as expected")
		}

		func() {
			lock.Lock()
			defer lock.Unlock()
			receivedEvents = append(receivedEvents, tracker)
		}()
	}
}
开发者ID:benlaplanche,项目名称:emitter,代码行数:46,代码来源:dropsonde_end_to_end_test.go

示例14: LogMessage

func LogMessage(msg *events.Envelope) Event {
	logMessage := msg.GetLogMessage()

	fields := logrus.Fields{
		"origin":          msg.GetOrigin(),
		"cf_app_id":       logMessage.GetAppId(),
		"timestamp":       logMessage.GetTimestamp(),
		"source_type":     logMessage.GetSourceType(),
		"message_type":    logMessage.GetMessageType().String(),
		"source_instance": logMessage.GetSourceInstance(),
	}

	return Event{
		Fields: fields,
		Msg:    string(logMessage.GetMessage()),
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:18,代码来源:events.go

示例15: ContainerMetric

func ContainerMetric(msg *events.Envelope) Event {
	containerMetric := msg.GetContainerMetric()

	fields := logrus.Fields{
		"origin":         msg.GetOrigin(),
		"cf_app_id":      containerMetric.GetApplicationId(),
		"cpu_percentage": containerMetric.GetCpuPercentage(),
		"disk_bytes":     containerMetric.GetDiskBytes(),
		"instance_index": containerMetric.GetInstanceIndex(),
		"memory_bytes":   containerMetric.GetMemoryBytes(),
	}

	return Event{
		Fields: fields,
		Msg:    "",
		Type:   msg.GetEventType().String(),
	}
}
开发者ID:eljuanchosf,项目名称:firehose-to-syslog,代码行数:18,代码来源:events.go


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