initial commit - untested

This commit is contained in:
ycc
2024-07-04 09:14:25 +02:00
parent 4611e44c4c
commit f7eb7e4b81
4 changed files with 1947 additions and 0 deletions

25
main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"log"
"os/exec"
)
func main() {
// Initialize LokiLogger
lokiLogger := NewLokiLogger("http://localhost:3100/loki/api/v1/push") // Replace with your Loki URL
// Run the Argo command
cmd := exec.Command("argo", "submit", "your-workflow.yaml")
output, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("failed to run Argo command: %v", err)
}
// Send logs to Loki
if err := lokiLogger.Log(`{job="argo"}`, string(output)); err != nil {
log.Fatalf("failed to send logs to Loki: %v", err)
}
log.Println("Logs sent to Loki successfully.")
}