


// ConsumerDispatchHandler consumer
//
// @param msg *sarama.ConsumerMessage
// @param consumer *databus.KafkaConsumer
// @return err error
// @author honeygong
func ConsumerDispatchHandler(msg *kafka.Message, consumer *kc.Consumer) (err error) {
ctx, err := _consumer.NewProfileContext(msg, consumer, 1*time.Minute)
if err != nil {
return
}
ctx.AddBaseHandler(ctx.UnpackKafkaMessage, "", true)
ctx.AddBaseHandler(ctx.InitPerformanceEvent, "", true).AddBaseHandler(ctx.AnalyzeEvent, "", true)
ctx.AddBaseHandler(ctx.WriteKafka, "", true)
ctx.Run()
return
}
// Crash performance event crash
//
// @author kevineluo
// @update 2023-07-05 07:46:11
type Crash struct {
// upload fields
MemoryFreeBytes int64 `json:"memory_free"`
MemoryMaxBytes int64 `json:"memory_max"`
MemoryTotalBytes int64 `json:"memory_total"`
RemainDiskBytes int64 `json:"remain_disk"`
CrashedThread string `json:"crashed_thread"`
CrashType string `json:"crash_type"`
LoseData string `json:"lose_data"`
RepeatOccur string `json:"repeat_occur"`
// analysis fields(produced by profile)
MemoryUsage float64 `json:"memory_usage"`
CrashDegree float64 `json:"crash_degree"`
}
// Lag performance event lag
//
// @author kevineluo
// @update 2023-07-05 07:24:12
type Lag struct {
// upload fields
TimeCost int64 `json:"time_cost"`
Stage string `json:"stage"`
ProcessName string `json:"process_name"`
Type string `json:"type"`
FunctionTimeCost int64 `json:"function_time_cost"`
Range0 int64 `json:"range_0"`
Range1 int64 `json:"range_1"`
Range2_4 int64 `json:"range_2_4"`
Range4_8 int64 `json:"range_4_8"`
Range8_16 int64 `json:"range_8_16"`
Range16Inf int64 `json:"range_16_inf"`
DropCollectMS int64 `json:"drop_collect_ms"`
DropCount int64 `json:"drop_count"`
// analysis fields(produced by profile)
MainFuncPercent float64 `json:"main_func_percent"`
Fluency float64 `json:"fluency"`
FPS float64 `json:"fps"`
}
ProfileContext维护Events
Venus:数据上报时延、成功率
Profile:数据的完整率、健康率、数据上报的处理时间延迟、成功率
项目待办、进度、需求、文档管理
待办:
**提供:**2台服务器和CK