本文整理汇总了Golang中github.com/cloudfoundry/sonde-go/events.Envelope.Index方法的典型用法代码示例。如果您正苦于以下问题:Golang Envelope.Index方法的具体用法?Golang Envelope.Index怎么用?Golang Envelope.Index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/sonde-go/events.Envelope
的用法示例。
在下文中一共展示了Envelope.Index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: addDefaultTags
func addDefaultTags(envelope *events.Envelope) *events.Envelope {
envelope.Deployment = proto.String("deployment-name")
envelope.Job = proto.String("test-component")
envelope.Index = proto.String("42")
envelope.Ip = proto.String(localIPAddress)
return envelope
}
示例2: basicTaggedHttpStartStopMessage
func basicTaggedHttpStartStopMessage(envelope events.Envelope) *events.Envelope {
ip, _ := localip.LocalIP()
envelope.Deployment = proto.String("test-deployment")
envelope.Job = proto.String("test-job")
envelope.Index = proto.String("2")
envelope.Ip = proto.String(ip)
return &envelope
}
示例3: setDefaultTags
func (t *Tagger) setDefaultTags(envelope *events.Envelope) {
if envelope.Deployment == nil {
envelope.Deployment = proto.String(t.deploymentName)
}
if envelope.Job == nil {
envelope.Job = proto.String(t.job)
}
if envelope.Index == nil {
envelope.Index = proto.String(t.index)
}
if envelope.Ip == nil {
envelope.Ip = proto.String(t.ip)
}
}
示例4:
Expect(mockWriter.Events).To(HaveLen(1))
writtenEnvelope := mockWriter.Events[0]
Eventually(*writtenEnvelope.Deployment).Should(Equal("another-deployment"))
})
It("when job is already set", func() {
envelope.Job = proto.String("another-job")
t.Write(envelope)
Expect(mockWriter.Events).To(HaveLen(1))
writtenEnvelope := mockWriter.Events[0]
Eventually(*writtenEnvelope.Job).Should(Equal("another-job"))
})
It("when index is already set", func() {
envelope.Index = proto.String("3")
t.Write(envelope)
Expect(mockWriter.Events).To(HaveLen(1))
writtenEnvelope := mockWriter.Events[0]
Eventually(*writtenEnvelope.Index).Should(Equal("3"))
})
It("when ip is already set", func() {
envelope.Ip = proto.String("1.1.1.1")
t.Write(envelope)
Expect(mockWriter.Events).To(HaveLen(1))
writtenEnvelope := mockWriter.Events[0]
Eventually(*writtenEnvelope.Ip).Should(Equal("1.1.1.1"))
})