本文整理汇总了Golang中github.com/cloudfoundry/sonde-go/events.Envelope.HttpStop方法的典型用法代码示例。如果您正苦于以下问题:Golang Envelope.HttpStop方法的具体用法?Golang Envelope.HttpStop怎么用?Golang Envelope.HttpStop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/sonde-go/events.Envelope
的用法示例。
在下文中一共展示了Envelope.HttpStop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SendEvent
func (f *FakeFirehose) SendEvent(eventType events.Envelope_EventType, message string) {
envelope := events.Envelope{
Origin: proto.String("origin"),
Timestamp: proto.Int64(1000000000),
Deployment: proto.String("deployment-name"),
Job: proto.String("doppler"),
}
switch eventType {
case events.Envelope_LogMessage:
envelope.EventType = events.Envelope_LogMessage.Enum()
envelope.LogMessage = &events.LogMessage{
Message: []byte(message),
MessageType: events.LogMessage_OUT.Enum(),
Timestamp: proto.Int64(1000000000),
}
case events.Envelope_ValueMetric:
envelope.EventType = events.Envelope_ValueMetric.Enum()
envelope.ValueMetric = &events.ValueMetric{
Name: proto.String(message),
Value: proto.Float64(42),
Unit: proto.String("unit"),
}
case events.Envelope_CounterEvent:
envelope.EventType = events.Envelope_CounterEvent.Enum()
envelope.CounterEvent = &events.CounterEvent{
Name: proto.String(message),
Delta: proto.Uint64(42),
}
case events.Envelope_ContainerMetric:
envelope.EventType = events.Envelope_ContainerMetric.Enum()
envelope.ContainerMetric = &events.ContainerMetric{
ApplicationId: proto.String(message),
InstanceIndex: proto.Int32(1),
CpuPercentage: proto.Float64(1),
MemoryBytes: proto.Uint64(1),
DiskBytes: proto.Uint64(1),
}
case events.Envelope_Error:
envelope.EventType = events.Envelope_Error.Enum()
envelope.Error = &events.Error{
Source: proto.String("source"),
Code: proto.Int32(404),
Message: proto.String(message),
}
case events.Envelope_HttpStart:
envelope.EventType = events.Envelope_HttpStart.Enum()
uuid, _ := uuid.NewV4()
envelope.HttpStart = &events.HttpStart{
Timestamp: proto.Int64(12),
RequestId: NewUUID(uuid),
PeerType: events.PeerType_Client.Enum(),
Method: events.Method_GET.Enum(),
Uri: proto.String("some uri"),
RemoteAddress: proto.String("some address"),
UserAgent: proto.String(message),
}
case events.Envelope_HttpStop:
envelope.EventType = events.Envelope_HttpStop.Enum()
uuid, _ := uuid.NewV4()
envelope.HttpStop = &events.HttpStop{
Timestamp: proto.Int64(12),
Uri: proto.String("http://stop.example.com"),
RequestId: NewUUID(uuid),
PeerType: events.PeerType_Client.Enum(),
StatusCode: proto.Int32(404),
ContentLength: proto.Int64(98475189),
}
case events.Envelope_HttpStartStop:
envelope.EventType = events.Envelope_HttpStartStop.Enum()
uuid, _ := uuid.NewV4()
envelope.HttpStartStop = &events.HttpStartStop{
StartTimestamp: proto.Int64(1234),
StopTimestamp: proto.Int64(5555),
RequestId: NewUUID(uuid),
PeerType: events.PeerType_Server.Enum(),
Method: events.Method_GET.Enum(),
Uri: proto.String("http://startstop.example.com"),
RemoteAddress: proto.String("http://startstop.example.com"),
UserAgent: proto.String("test"),
StatusCode: proto.Int32(1234),
ContentLength: proto.Int64(5678),
ApplicationId: NewUUID(uuid),
}
}
f.addEvent(envelope)
}