@@ -18,7 +18,6 @@ package cache
1818import (
1919 "context"
2020 "fmt"
21- "strconv"
2221 "time"
2322
2423 prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1"
7574 metrics .WaitingLoraAdapters ,
7675 metrics .RunningLoraAdapters ,
7776 }
78- // TODO: add a helper function for get methods.
79- podMetricRefreshInterval = getPodMetricRefreshInterval ()
77+ podMetricRefreshInterval = time .Duration (utils .LoadEnvInt ("AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS" , defaultPodMetricRefreshIntervalInMS )) * time .Millisecond
8078)
8179
8280func initPrometheusAPI () prometheusv1.API {
@@ -99,21 +97,6 @@ func initPrometheusAPI() prometheusv1.API {
9997 return prometheusApi
10098}
10199
102- func getPodMetricRefreshInterval () time.Duration {
103- value := utils .LoadEnv ("AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS" , "" )
104- if value != "" {
105- intValue , err := strconv .Atoi (value )
106- if err != nil || intValue <= 0 {
107- klog .Infof ("invalid AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS: %s, falling back to default" , value )
108- } else {
109- klog .Infof ("using AIBRIX_POD_METRIC_REFRESH_INTERVAL_MS env value for pod metrics refresh interval: %d ms" , intValue )
110- return time .Duration (intValue ) * time .Millisecond
111- }
112- }
113- klog .Infof ("using default refresh interval: %d ms" , defaultPodMetricRefreshIntervalInMS )
114- return defaultPodMetricRefreshIntervalInMS * time .Millisecond
115- }
116-
117100func (c * Store ) getPodMetricImpl (podName string , metricStore * utils.SyncMap [string , metrics.MetricValue ], metricName string ) (metrics.MetricValue , error ) {
118101 metricVal , ok := metricStore .Load (metricName )
119102 if ! ok {
0 commit comments