本文整理匯總了Golang中github.com/cloudfoundry/dropsonde/events.Envelope.GetOrigin方法的典型用法代碼示例。如果您正苦於以下問題:Golang Envelope.GetOrigin方法的具體用法?Golang Envelope.GetOrigin怎麽用?Golang Envelope.GetOrigin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/dropsonde/events.Envelope
的用法示例。
在下文中一共展示了Envelope.GetOrigin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
switch envelope.GetEventType() {
case events.Envelope_HttpStart:
eventId += envelope.GetHttpStart().GetPeerType().String()
case events.Envelope_HttpStop:
eventId += envelope.GetHttpStop().GetPeerType().String()
case events.Envelope_Heartbeat:
case events.Envelope_ValueMetric:
eventId += envelope.GetValueMetric().GetName()
case events.Envelope_CounterEvent:
eventId += envelope.GetCounterEvent().GetName()
default:
panic("Unexpected message type")
}
if envelope.GetOrigin() != origin {
panic("origin not as expected")
}
func() {
lock.Lock()
defer lock.Unlock()
receivedEvents[eventId] = true
}()
}
}()
httpListener, err := net.Listen("tcp", "localhost:0")
Expect(err).ToNot(HaveOccurred())
defer httpListener.Close()
httpHandler := autowire.InstrumentedHandler(FakeHandler{})
示例2:
case events.Envelope_HttpStart:
eventId += envelope.GetHttpStart().GetPeerType().String()
case events.Envelope_HttpStop:
eventId += envelope.GetHttpStop().GetPeerType().String()
case events.Envelope_Heartbeat:
heartbeatUuidsChan <- envelope.GetHeartbeat().GetControlMessageIdentifier().String()
case events.Envelope_ValueMetric:
eventId += envelope.GetValueMetric().GetName()
case events.Envelope_CounterEvent:
eventId += 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[eventId] = true
}()
}
}()
httpListener, err := net.Listen("tcp", "localhost:0")
Expect(err).ToNot(HaveOccurred())
defer httpListener.Close()
httpHandler := dropsonde.InstrumentedHandler(FakeHandler{})