@@ -40,7 +40,6 @@ const (
4040 API_EMAIL_HEADER = "X-CH-Auth-Email"
4141 API_PASSWORD_HEADER = "X-CH-Auth-API-Token"
4242 MIN_TIME_BETWEEN_SYNTH_CHECKS = 60 * time .Second
43- KT_API_LOAD_INTERFACES = "KT_API_LOAD_INTERFACES"
4443 KT_INTERFACE_LOOKUP_TEXT_FILTER = "KT_INTERFACE_LOOKUP_TEXT_FILTER"
4544 KT_LOAD_CUSTOM_COLUMNS = "KT_LOAD_CUSTOM_COLUMNS"
4645 KT_API_LAZY_LOAD_CUSTOMS = "KT_API_LAZY_LOAD_CUSTOMS"
@@ -57,24 +56,25 @@ func init() {
5756
5857type KentikApi struct {
5958 logger.ContextL
60- tr * http.Transport
61- client * http.Client
62- devices map [kt.Cid ]kt.Devices
63- synAgents map [kt.AgentId ]* synthetics.Agent
64- synAgentsByIP map [string ]* synthetics.Agent
65- synTests map [kt.TestId ]* synthetics.Test
66- setTime time.Time
67- apiTimeout time.Duration
68- synClient synthetics.SyntheticsAdminServiceClient
69- deviceClient devicepb.DeviceServiceClient
70- interfaceClient interfacepb.InterfaceServiceClient
71- mux sync.RWMutex
72- lastSynth time.Time
73- config * ktranslate.Config
74- tagLookupClient tagging.EnumerationsAdminServiceClient
75- lazyLoadCustoms bool
76- fullLoadCustoms bool
77- lazyLoadInts bool
59+ tr * http.Transport
60+ client * http.Client
61+ devices map [kt.Cid ]kt.Devices
62+ synAgents map [kt.AgentId ]* synthetics.Agent
63+ synAgentsByIP map [string ]* synthetics.Agent
64+ synTests map [kt.TestId ]* synthetics.Test
65+ setTime time.Time
66+ apiTimeout time.Duration
67+ synClient synthetics.SyntheticsAdminServiceClient
68+ deviceClient devicepb.DeviceServiceClient
69+ interfaceClient interfacepb.InterfaceServiceClient
70+ mux sync.RWMutex
71+ lastSynth time.Time
72+ config * ktranslate.Config
73+ tagLookupClient tagging.EnumerationsAdminServiceClient
74+ lazyLoadCustoms bool
75+ fullLoadCustoms bool
76+ lazyLoadInts bool
77+ interfaceFilterText string
7878}
7979
8080func NewKentikApi (ctx context.Context , log logger.ContextL , cfg * ktranslate.Config ) (* KentikApi , error ) {
@@ -96,14 +96,15 @@ func NewKentikApi(ctx context.Context, log logger.ContextL, cfg *ktranslate.Conf
9696 client := & http.Client {Transport : tr , Timeout : apiTimeout }
9797
9898 kapi := & KentikApi {
99- ContextL : log ,
100- tr : tr ,
101- client : client ,
102- apiTimeout : apiTimeout ,
103- config : cfg ,
104- lazyLoadCustoms : kt .LookupEnvBool (KT_API_LAZY_LOAD_CUSTOMS , false ),
105- fullLoadCustoms : kt .LookupEnvBool (KT_LOAD_CUSTOM_COLUMNS , false ),
106- lazyLoadInts : kt .LookupEnvBool (KT_API_LAZY_LOAD_INTERFACES , false ),
99+ ContextL : log ,
100+ tr : tr ,
101+ client : client ,
102+ apiTimeout : apiTimeout ,
103+ config : cfg ,
104+ lazyLoadCustoms : kt .LookupEnvBool (KT_API_LAZY_LOAD_CUSTOMS , false ),
105+ fullLoadCustoms : kt .LookupEnvBool (KT_LOAD_CUSTOM_COLUMNS , false ),
106+ lazyLoadInts : kt .LookupEnvBool (KT_API_LAZY_LOAD_INTERFACES , false ),
107+ interfaceFilterText : kt .LookupEnvString (KT_INTERFACE_LOOKUP_TEXT_FILTER , "" ),
107108 }
108109
109110 log .Infof ("Setting API timeout to %v, lazyLoadInterfaces=%v, lazyLoadCustoms=%v, fullyLoadCustoms=%v" ,
@@ -585,7 +586,7 @@ func (api *KentikApi) getInterfaces(ctx context.Context, deviceId string, dev *k
585586
586587 api .Debugf ("Loading interfaces for %s" , deviceId )
587588 lt := & interfacepb.ListInterfaceRequest {
588- Filters : & interfacepb.InterfaceFilter {DeviceIds : []string {deviceId }, Text : kt . LookupEnvString ( KT_INTERFACE_LOOKUP_TEXT_FILTER , "" ) },
589+ Filters : & interfacepb.InterfaceFilter {DeviceIds : []string {deviceId }, Text : api . interfaceFilterText },
589590 }
590591 r , err := api .interfaceClient .ListInterface (ctx , lt )
591592 if err != nil {
0 commit comments