Procházet zdrojové kódy

correction

Corrected change

Signed-off-by: Jason Charcalla <jason@kubecost.com>
Jason Charcalla před 3 roky
rodič
revize
ef020943cc
1 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. 11 1
      pkg/env/costmodelenv.go

+ 11 - 1
pkg/env/costmodelenv.go

@@ -478,11 +478,21 @@ func GetETLMaxPrometheusQueryDuration() time.Duration {
 	mins := time.Duration(GetInt64(ETLMaxPrometheusQueryDurationMinutes, int64(dayMins)))
 	return mins * time.Minute
 }
-
+ 
 func LegacyExternalCostsAPIDisabled() bool {
 	return GetBool(LegacyExternalAPIDisabledVar, false)
 }
 
+// GetETLResolution determines the resolution of ETL queries. The smaller the
+// duration, the higher the resolution; the higher the resolution, the more
+// accurate the query results, but the more computationally expensive.
+func GetETLResolution() time.Duration {
+	// Use the configured ETL resolution, or default to
+	// 5m (i.e. 300s)
+	secs := time.Duration(GetInt64(ETLResolutionSeconds, 300))
+	return secs * time.Second
+}
+
 // GetPromClusterLabel returns the environemnt variable value for PromClusterIDLabel
 func GetPromClusterLabel() string {
 	return Get(PromClusterIDLabelEnvVar, "cluster_id")