Example #1
0
func (this *TransformExecutor) timing(name string) *avro.Timing {
	timing := avro.NewTiming()
	timing.EventName = name
	timing.Value = time.Now().UnixNano()
	//TODO ntpstatus
	return timing
}
Example #2
0
func (this *TransformExecutor) protoToAvroLogLine(protoLogLine *pb.LogLine, logLine *avro.LogLine) *avro.LogLine {
	logLine.Line = protoLogLine.GetLine()
	logLine.Source = protoLogLine.GetSource()
	logLine.Logtypeid = protoLogLine.GetLogtypeid()

	logLine.Tag = make(map[string]string)
	for _, tag := range protoLogLine.GetTag() {
		logLine.Tag[tag.GetKey()] = tag.GetValue()
	}

	logLine.Timings = make([]*avro.Timing, 0)
	for _, timing := range protoLogLine.GetTimings() {
		kv := avro.NewTiming()
		kv.EventName = timing.GetEventName()
		kv.Value = timing.GetValue()
		logLine.Timings = append(logLine.Timings, kv)
	}

	return logLine
}