Hello, I have a requirement to create a datadog dashboard with application metrics. The app names are read from a config.toml. The code runs only for the first app provided in the toml file and never proceeds to the second app. The structure is a follows:
*config.toml* application = ["app1", "app2", "app3"] customer = ["abc"] *main.go* // Sending Metrics to Datadog UI func sendMetrics(name string, channel chan string) { // Calculates the Epoch Time for App EpochTime1 := epochTime() // Calculates the Epoch Time for Github EpochTime2 := gitEpochTime() // Lead Time from Github Commit to App Deployment calculated_time := EpochTime1 - EpochTime2 v := versionDetails() dd_tags := "metric_tag:" + v tags := []string{dd_tags} rate := float64(1) c, err := statsd.New("127.0.0.1:18125") if err != nil { log.Fatal(err) } e := c.Gauge(name, float64(calculated_time), tags, rate) if e != nil { log.Println(e) fmt.Println("name:::", name) fmt.Println("lead time:::", leadTime) channel <- name } fmt.Println("name:::", name) fmt.Println("lead time:::", leadTime) channel <- name log.Printf("Metrics for %s sent successfully!!", name) } func main() { channel := make(chan string) appName, _ := getTag() //gets the appName and customerName both of which are [] string type fmt.Println("App names: ", appName, reflect.TypeOf(appName)) for _, app := range appName { // Calculate the Epoch Time fmt.Println("Executing app............ ", app) if epochTime() == 0 { log.Println("No deployment present during the Time Frame!") for res := range channel { go func(app string) { time.Sleep(3 * time.Second) sendMetrics(app, channel) }(res) } } else { go sendMetrics(app, channel) for res := range channel { go func(name string) { time.Sleep(3 * time.Second) sendMetrics(name, channel) }(res) } } } } I am new to Golang and any help is highly appreciated. Thanks, Shatabdi -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7d1f590f-4f54-446f-9693-8bc650bbb348n%40googlegroups.com.