Update fetch.go and fetchRunner.go

This commit is contained in:
RamiBerm 2021-07-11 14:35:15 +03:00
parent de1295e29d
commit 466214c4b5
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ type MizuFetchOptions struct {
FromTimestamp int64 FromTimestamp int64
ToTimestamp int64 ToTimestamp int64
Directory string Directory string
MizuPort uint MizuPort uint16
} }
var mizuFetchOptions = MizuFetchOptions{} var mizuFetchOptions = MizuFetchOptions{}
@ -28,5 +28,5 @@ func init() {
fetchCmd.Flags().StringVarP(&mizuFetchOptions.Directory, "directory", "d", ".", "Provide a custom directory for fetched entries") fetchCmd.Flags().StringVarP(&mizuFetchOptions.Directory, "directory", "d", ".", "Provide a custom directory for fetched entries")
fetchCmd.Flags().Int64Var(&mizuFetchOptions.FromTimestamp, "from", 0, "Custom start timestamp for fetched entries") fetchCmd.Flags().Int64Var(&mizuFetchOptions.FromTimestamp, "from", 0, "Custom start timestamp for fetched entries")
fetchCmd.Flags().Int64Var(&mizuFetchOptions.ToTimestamp, "to", 0, "Custom end timestamp fetched entries") fetchCmd.Flags().Int64Var(&mizuFetchOptions.ToTimestamp, "to", 0, "Custom end timestamp fetched entries")
fetchCmd.Flags().UintVarP(&mizuFetchOptions.MizuPort, "port", "p", 8899, "Custom port for mizu") fetchCmd.Flags().Uint16VarP(&mizuFetchOptions.MizuPort, "port", "p", 8899, "Custom port for mizu")
} }

View File

@ -16,7 +16,7 @@ import (
) )
func RunMizuFetch(fetch *MizuFetchOptions) { func RunMizuFetch(fetch *MizuFetchOptions) {
mizuProxiedUrl := kubernetes.GetMizuCollectorProxiedHostAndPath(uint16(fetch.MizuPort), mizu.ResourcesNamespace, mizu.AggregatorPodName) mizuProxiedUrl := kubernetes.GetMizuCollectorProxiedHostAndPath(fetch.MizuPort, mizu.ResourcesNamespace, mizu.AggregatorPodName)
resp, err := http.Get(fmt.Sprintf("http://%s/api/har?from=%v&to=%v", mizuProxiedUrl, fetch.FromTimestamp, fetch.ToTimestamp)) resp, err := http.Get(fmt.Sprintf("http://%s/api/har?from=%v&to=%v", mizuProxiedUrl, fetch.FromTimestamp, fetch.ToTimestamp))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)