@@ -42,8 +42,7 @@ const (
4242 MIN_TIME_BETWEEN_SYNTH_CHECKS = 60 * time .Second
4343 KT_API_LOAD_INTERFACES = "KT_API_LOAD_INTERFACES"
4444 KT_INTERFACE_LOOKUP_TEXT_FILTER = "KT_INTERFACE_LOOKUP_TEXT_FILTER"
45- KT_NO_CUSTOM_COLUMNS = "KT_NO_CUSTOM_COLUMNS"
46- KT_LOAD_CUSTOM_COLS_FOR_DEVS = "KT_LOAD_CUSTOM_COLS_FOR_DEVS"
45+ KT_LOAD_CUSTOM_COLUMNS = "KT_LOAD_CUSTOM_COLUMNS"
4746 KT_API_LAZY_LOAD_CUSTOMS = "KT_API_LAZY_LOAD_CUSTOMS"
4847)
4948
@@ -74,6 +73,7 @@ type KentikApi struct {
7473 tagLookupClient tagging.EnumerationsAdminServiceClient
7574 loadInterfaces bool
7675 lazyLoadCustoms bool
76+ fullLoadCustoms bool
7777}
7878
7979func NewKentikApi (ctx context.Context , log logger.ContextL , cfg * ktranslate.Config ) (* KentikApi , error ) {
@@ -102,9 +102,10 @@ func NewKentikApi(ctx context.Context, log logger.ContextL, cfg *ktranslate.Conf
102102 config : cfg ,
103103 loadInterfaces : kt .LookupEnvBool (KT_API_LOAD_INTERFACES , false ),
104104 lazyLoadCustoms : kt .LookupEnvBool (KT_API_LAZY_LOAD_CUSTOMS , false ),
105+ fullLoadCustoms : kt .LookupEnvBool (KT_LOAD_CUSTOM_COLUMNS , false ),
105106 }
106107
107- log .Infof ("Setting API timeout to %v, loadInterfaces=%v, lazyLoadCustoms=%v" , apiTimeout , kapi .loadInterfaces , kapi .lazyLoadCustoms )
108+ log .Infof ("Setting API timeout to %v, loadInterfaces=%v, lazyLoadCustoms=%v, fullyLoadCustoms=%v " , apiTimeout , kapi .loadInterfaces , kapi .lazyLoadCustoms , kapi . fullLoadCustoms )
108109
109110 // Now, check to see if synthetics API works.
110111 err := kapi .connectSynthAndLookup (ctx )
@@ -521,10 +522,6 @@ func (api *KentikApi) getDeviceInfoNew(ctx context.Context) error {
521522 resDev := map [kt.Cid ]kt.Devices {}
522523 num := 0
523524 deviceIds := []string {}
524- deviceCustomsLoad := map [string ]bool {}
525- for _ , pts := range strings .Split (kt .LookupEnvString (KT_LOAD_CUSTOM_COLS_FOR_DEVS , "" ), "," ) {
526- deviceCustomsLoad [pts ] = true
527- }
528525
529526 for _ , info := range api .config .KentikCreds {
530527 md := metadata .New (map [string ]string {
@@ -534,7 +531,7 @@ func (api *KentikApi) getDeviceInfoNew(ctx context.Context) error {
534531 ctxo := metadata .NewOutgoingContext (ctx , md )
535532
536533 lt := & devicepb.ListDevicesRequest {
537- Query : & devicepb.DeviceQuery {NoCustomColumns : kt . LookupEnvBool ( KT_NO_CUSTOM_COLUMNS , false ) },
534+ Query : & devicepb.DeviceQuery {NoCustomColumns : ! api . fullLoadCustoms },
538535 }
539536 r , err := api .deviceClient .ListDevices (ctxo , lt )
540537 if err != nil {
@@ -555,14 +552,6 @@ func (api *KentikApi) getDeviceInfoNew(ctx context.Context) error {
555552 resDev [dev .CompanyID ] = map [kt.DeviceID ]* kt.Device {}
556553 }
557554
558- if deviceCustomsLoad [device .Id ] {
559- err := api .loadCustoms (ctxo , device .GetId (), dev )
560- if err != nil {
561- api .Warnf ("Cannot load custom columns for device %s: %v" , dev .Name , err )
562- continue
563- }
564- }
565-
566555 deviceIds = append (deviceIds , device .Id )
567556 resDev [dev.CompanyID ][dev.ID ] = dev
568557 num ++
0 commit comments