コード例 #1
0
func createConfigForAgentWriterTest(t *testing.T) resourced_config.Config {
	config := resourced_config.Config{}
	config.Path = "/insights/du"
	config.Interval = "3s"
	config.Kind = "writer"
	config.ReaderPaths = []string{"/du"}
	config.GoStruct = "StdOut"
	config.GoStructFields = make(map[string]interface{})
	return config
}
コード例 #2
0
ファイル: agent.go プロジェクト: simudream/resourced
// commonData gathers common information for every reader and writer.
func (a *Agent) commonData(config resourced_config.Config) map[string]interface{} {
	record := make(map[string]interface{})
	record["UnixNano"] = time.Now().UnixNano()
	record["Path"] = config.Path

	if config.Interval == "" {
		config.Interval = "1m"
	}
	record["Interval"] = config.Interval

	if config.GoStruct != "" {
		record["GoStruct"] = config.GoStruct
	}

	return record
}