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


Golang Envelope.GetValueMetric方法代码示例

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


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

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

示例2: getValue

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

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

示例4: ProcessEvent

func (s *UAAChart) ProcessEvent(event *events.Envelope) {
	switch event.GetValueMetric().GetName() {
	case "audit_service.user_authentication_count":
		s.data[0] = updateAndReturnValue(s.dataByIp[0], event)
	case "audit_service.user_authentication_failure_count":
		s.data[1] = updateAndReturnValue(s.dataByIp[1], event)
	case "audit_service.principal_authentication_failure_count":
		s.data[2] = updateAndReturnValue(s.dataByIp[2], event)
	case "audit_service.user_password_failures":
		s.data[3] = updateAndReturnValue(s.dataByIp[3], event)
	}
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:12,代码来源:uaa.go

示例5: ProcessEvent

func (s *SinkTypeChart) ProcessEvent(event *events.Envelope) {
	switch event.GetValueMetric().GetName() {
	case "messageRouter.numberOfContainerMetricSinks":
		s.data[0] = updateAndReturnValue(s.dataByIp[0], event)
	case "messageRouter.numberOfSyslogSinks":
		s.data[1] = updateAndReturnValue(s.dataByIp[1], event)
	case "messageRouter.numberOfDumpSinks":
		s.data[2] = updateAndReturnValue(s.dataByIp[2], event)
	case "messageRouter.numberOfWebsocketSinks":
		s.data[3] = updateAndReturnValue(s.dataByIp[3], event)
	case "messageRouter.numberOfFirehoseSinks":
		s.data[4] = updateAndReturnValue(s.dataByIp[4], event)
	}
}
开发者ID:wfernandes,项目名称:firehose-stats,代码行数:14,代码来源:sinkType.go

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

示例7: ValueMetric

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

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

	return Event{
		Fields: fields,
		Msg:    "",
	}
}
开发者ID:yacloud-io,项目名称:firehose-to-syslog,代码行数:14,代码来源:events.go

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

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

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

示例11: valid

func valid(env *events.Envelope) bool {
	switch env.GetEventType() {
	case events.Envelope_HttpStartStop:
		return env.GetHttpStartStop() != nil
	case events.Envelope_LogMessage:
		return env.GetLogMessage() != nil
	case events.Envelope_ValueMetric:
		return env.GetValueMetric() != nil
	case events.Envelope_CounterEvent:
		return env.GetCounterEvent() != nil
	case events.Envelope_Error:
		return env.GetError() != nil
	case events.Envelope_ContainerMetric:
		return env.GetContainerMetric() != nil
	}
	return true
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:17,代码来源:event_unmarshaller.go

示例12: Write

func (f *fakeWriter) Write(message *events.Envelope) {
	if message.GetEventType() == events.Envelope_ValueMetric {

		switch message.GetValueMetric().GetName() {
		case "Uptime":
			atomic.StoreUint64(&f.lastUptime, uint64(message.GetValueMetric().GetValue()))
		case "LinuxFileDescriptor":
			atomic.StoreUint64(&f.openFileDescriptors, uint64(message.GetValueMetric().GetValue()))
		}
	}
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:11,代码来源:fake_writer_test.go

示例13: Write

func (f *fakeWriter) Write(message *events.Envelope) {
	if message.GetEventType() == events.Envelope_ValueMetric && message.GetValueMetric().GetName() == "Uptime" {
		atomic.StoreUint64(&f.lastUptime, uint64(message.GetValueMetric().GetValue()))
	}
}
开发者ID:lyuyun,项目名称:loggregator,代码行数:5,代码来源:monitor_test.go

示例14: processValueMetric

func (metrics *metrics) processValueMetric(metric *events.Envelope) {
	metrics.metricsByName[metric.GetValueMetric().GetName()] = metric.GetValueMetric().GetValue()
}
开发者ID:khj0651,项目名称:loggregator,代码行数:3,代码来源:metrics.go

示例15:

						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_Heartbeat:
						tracker.name = envelope.GetHeartbeat().GetControlMessageIdentifier().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:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:dropsonde_end_to_end_test.go


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