You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/29 09:04:31 UTC

[GitHub] [apisix-dashboard] RedemptionC opened a new issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

RedemptionC opened a new issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011


   ## Issue description
   *sorry to label this issue as Bug,but it seems there are only two options*
   
   I want to **add a cache verification tool for Apache APISIX dashboard,which is intented to check whether cached data in ETCD is consistent with cached data in the dashboard** ,but there seems to be some problems not clear for me:
   1. do we add this tool as a new cobra command? like those in the api/cmd/ directory
   2. which data does cached data refer?
   3. how do we insepect them ?  in ETCD and in dashboard?
   
   the source code is good,but hard to find a starting point
   Any advice or related resource will greatly  appreciated
   ## Additional context
   this is a sub-task of [project](https://summer.iscas.ac.cn/#/org/prodetail/210050252?lang=en) in open summer 2021
   
   @nic-chen 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891410325


   > > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   > 
   > 
   > 
   > Or , do I misunderstand something?It will be greatly appreciated if you could point out that
   
   It just explains why they look different. You need to search which way is more suitable for object comparison.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891435824


   > And it seems the doc of manager api is not complete?
   
   @RedemptionC Yes, and I'm managing to combing APIs' docs 🤔 It will take a lot of time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-893531844


   @nic-chen 
   Hello,I'm trying to implement this tool,but I don't know how to deal with the initialization stuff yet
   I mean,when we run manager API,it does a lot of initialization stuff,including reading value from ETCD into the cache,which is what we need
   
   when we implement this tool,should it rely on a running manager API,say,get the cache content throught some API,like migrate/export,then transform the response into proper form,then get the data from ETCD somehow,and then compare 
   
   Or,should we do the initialization stuff in the tool's implementation,but it seems that we need to  find the minimum initialization stuff needed for this tool(not including running the manager API on some port),also,it seems that we need to duplicate pretty much code in this way
   what's the proper way?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-890433879


   cc @nic-chen 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891866935


   > I probably need to study something about how dashboard use etcd
   
   All APIs are under the `/api` folder, you could cc @nic-chen for help


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891702884


   > > > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   > > 
   > > 
   > > Or , do I misunderstand something?It will be greatly appreciated if you could point out that
   > 
   > It just explains why they look different. You need to search which way is more suitable for object comparison.
   
   it seems I used the wrong API
   now they are much more similar :
   ```
   consumer.List is called
   in list
   cache: key(red):val(&{red  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627738877) %!s(int64=1627738933)})
   etcd:  key(/apisix/consumers/red):val({"username":"red","plugins":{"key-auth":{"key":"key-of-john"}},"update_time":1627738933,"create_time":1627738877})
   .....
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891695057


   > > > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   > > 
   > > 
   > > Or , do I misunderstand something?It will be greatly appreciated if you could point out that
   > 
   > It just explains why they look different. You need to search which way is more suitable for object comparison.
   
   got it
   but pretty have no idea yet..


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891092414


   If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891885644


   @nic-chen 
   it seems we can compare them using this code snippet:
   ```go
   func AreEqualJSON(s1, s2 string) (bool, error) {
   	fmt.Printf("compare:\ncache: %s\nand\netcd: %s\n", s1, s2)
   	var o1 interface{}
   	var o2 interface{}
   
   	var err error
   	err = json.Unmarshal([]byte(s1), &o1)
   	if err != nil {
   		return false, fmt.Errorf("Error mashalling string 1 :: %s", err.Error())
   	}
   	err = json.Unmarshal([]byte(s2), &o2)
   	if err != nil {
   		return false, fmt.Errorf("Error mashalling string 2 :: %s", err.Error())
   	}
   
   	return reflect.DeepEqual(o1, o2), nil
   }
   ```
   in the store.go/List(),we get the value from cache and etcd,value returned by etcd.go/Get is already string(json format)
   we just need to parse value from cache into json string
   then use the function above
   and this is the output:
   ```
   consumer.List is called                                                                                                                
   in list                                                                                                                                
   compare:                                                                                                                               
   cache: {"username":"red","plugins":{"key-auth":{"key":"key-of-john"}},"create_time":1627738877,"update_time":1627738933}
   and
   etcd: {"username":"red","plugins":{"key-auth":{"key":"key-of-john"}},"update_time":1627738933,"create_time":1627738877}
   cache content and etcd content on this key(/apisix/consumers/red) is the same: true
   ......
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889272931


   > @RedemptionC
   > All read operations in the dashboard read the data in the cache, see:
   > https://github.com/apache/apisix-dashboard/blob/master/api/internal/core/store/store.go
   
   I still don't get it:
   I add some printf statement in store.go,like what's in the cache,and which method is called
   but after I run manager api(using make api-run),and query something using curl,nothing is printed:
   ```sh
   ❯ curl localhost:9000/apisix/admin/consumers -H "Authorization: $(curl -s  localhost:9000/apisix/admin/user/login -X POST -d '{"username":"admin","password":"admin"}'  | jq -r '.data | .token')"
   {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"f078935d-0097-49e9-b4a5-32e413936e7e"}% 
   ```
   only printf statement in init method ran,and the output of manager api is :
   ```
   ❯ make api-run                        
   api/build.sh --dry-run
   in init
   in init
   key(00000000000000006474):val(&{{00000000000000006474 %!s(int64=1627546210) %!s(int64=1627546210)} /services/users/* []   %!s(int=0) [GET] example.com []  [] []  <nil> <nil> map[] <nil> %!s(*entity.UpstreamDef=&{map[httpbin.org:80:1] 0 <nil> roundrobin <nil> vars  http  pass     map[] <nil>}) <nil> <nil>  map[] %!s(bool=false) %!s(entity.Status=1)})
   key(1):val(&{{1 %!s(int64=1625113578) %!s(int64=1627546423)} /get []   %!s(int=0) [] httpbin.org []  [] []  <nil> <nil> map[] <nil> %!s(*entity.UpstreamDef=<nil>) <nil> 1  map[] %!s(bool=false) %!s(entity.Status=1)})
   in init
   in init
   in init
   key(1):val(&{{1 %!s(int64=1625113669) %!s(int64=1627546363)} {map[httpbin.org:80:%!s(float64=1)] %!s(int=0) <nil> roundrobin <nil> vars  http  pass     map[] %!s(*entity.UpstreamTLS=<nil>)}})
   in init
   in init
   in init
   key(410d5340-bc4e-4713-a3eb-5633eee03100):val(&{{410d5340-bc4e-4713-a3eb-5633eee03100 %!s(int64=0) %!s(int64=0)} %!s(int64=1627573250) %!s(int64=4620) %!s(int64=1627568630) 3.4.0 99f927a8f180 2.6})
   in init
   The manager-api is running successfully!
   
   Version : 2.7
   GitHash : 4514e45
   Listen  : 0.0.0.0:9000
   Loglevel: warn
   ErrorLogFile: /home/andy/myrepo/forked/apisix-dashboard/api/logs/error.log
   AccessLogFile: /home/andy/myrepo/forked/apisix-dashboard/api/logs/access.log
   
   ```
   how should I make sense of it?
   or rather,what's the proper way to read this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC edited a comment on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC edited a comment on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891843234


   > > > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   > > 
   > > 
   > > Or , do I misunderstand something?It will be greatly appreciated if you could point out that
   > 
   > It just explains why they look different. You need to search which way is more suitable for object comparison.
   
   I parsed the cache value into json,like this :
   ```
   consumer.Get is called
   in get
   cache: key(andy):val({"username":"andy","plugins":{"key-auth":{"key":"key-of-john"}},"create_time":1627739045,"update_time":1627744978})
   etcd:  key(/apisix/consumers/andy):val({"username":"andy","plugins":{"key-auth":{"key":"key-of-john"}},"update_time":1627744978,"create_time":1627739045})
   cache content and etcd content on this key(andy) is the same: false
   ```
   the output suggests that they are almost the same,except the create time and update time are in different order


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-890367707


   > hi @RedemptionC
   > 
   > The relevant data needs to be written before there is a cache.
   > 
   > In your example, you should create a consumer first.
   
   thanks 
   And when I study the code,I found that:
   in consumer.go,there are Get,List,Set handler,and it also apply route for them,i.e.,when user use the API,these method should be called
   ```go
   	r.GET("/apisix/admin/consumers", wgin.Wraps(h.List,
   		wrapper.InputType(reflect.TypeOf(ListInput{}))))
   
   	r.PUT("/apisix/admin/consumers", wgin.Wraps(h.Set,
   		wrapper.InputType(reflect.TypeOf(SetInput{}))))
   ```
   but I tried:
   query all consumers
   ```
   curl localhost:9000/apisix/admin/consumers -H "Authorization: $(curl -s  localhost:9000/apisix/admin/user/login -X POST -d '{"username":"admin","password":"admin"}'  | jq -r '.data | .token')" | jq
   
   ```
   create new consumer
   ```
   curl "http://127.0.0.1:9080/apisix/admin/consumers" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
   {                          
     "username": "apisix",
     "plugins": {
       "key-auth": {
         "key": "key-of-john"
       }
     }
   }'
   
   ```
   and something else,only the consumer.List method is called
   ```
   consumer.List is called
   in list(Store.go)
   cache: key(andy):val(&{andy  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627739045) %!s(int64=1627744978)})
   cache: key(john):val(&{john  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627731085) %!s(int64=1627738858)})
   cache: key(red):val(&{red  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627738877) %!s(int64=1627738933)})
   cache: key(dashboard):val(&{dashboard  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627746151) %!s(int64=1627746151)})
   cache: key(apisix):val(&{apisix  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627746172) %!s(int64=1627746172)})
   
   ```
   while other api also takes effect,i.e.,it did create a new consumer
   1. how should I make sense of it? why consumer.Set is not called?
   2. did I use the admin API the right way? i.e.,when I create a consumer , I need to have a X-API-KEY in my header? is it OK to use the key in the offcial doc's example,or should I use my own key?Do I need to login in to get it?
   3. also,I don't quite understand how dashboard use etcd,I'm trying to figure out it,and any forms of help will be appreciated


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889001699


   @RedemptionC 
   All read operations in the dashboard read the data in the cache, see: 
   https://github.com/apache/apisix-dashboard/blob/master/api/internal/core/store/store.go


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889725970


   @RedemptionC 
   
   
   1. https://github.com/apache/apisix-dashboard/blob/master/api/internal/handler/consumer/consumer.go#L113
   
   2. https://github.com/apache/apisix-dashboard/blob/d49b28381bc68c4da1552fe953c1ea7080423f4b/api/internal/core/store/store.go#L189
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891109346


   > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   
   Or , do I misunderstand something?It will be greatly appreciated if you could point out that


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891004434


   > @RedemptionC Please make sure you write the log in the correct location and restart the Manager API.
   
   Ok I found that it's due to that I mixed admin API with manager API:in the command I posted,when creating a consumer,I used admin API(port:9080),while manager API is on port 9000
   And it seems the doc of manager api is not complete?(@juzhiyuan,could you give some context?)it only shows API on query
   I don't get it why this command(to create a consumer using manager API) can not succeed:
   ```
   ❯ curl "http://127.0.0.1:9000/apisix/admin/consumers" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -H "Authorization: $(curl -s  localhost:9000/apisix/admin/user/login -X POST -d '{"usern    ame":"admin","password":"admin"}'  | jq -r '.data | .token')"  -X PUT -d '
   {
     "username": "test",
     "plugins": {
       "key-auth": {
         "key": "key-of-john"
       }
     }
   }'
   {"code":4107,"message":"request unauthorized","data":null,"request_id":""}%  
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC closed issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC closed issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-890462652


   @RedemptionC  Please make sure you write the log in the correct location and restart the Manager API.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891435824


   > And it seems the doc of manager api is not complete?
   
   @RedemptionC Yes, and I'm managing to comb APIs' docs 🤔 and it still needs some time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891679526


   > > And it seems the doc of manager api is not complete?
   > 
   > @RedemptionC Yes, and I'm managing to comb APIs' docs 🤔 and it still needs some time.
   
   got it 
   thank you for your support :)
   I probably need to study something about how dashboard use etcd now,do you have any advice for me?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889599922


   @nic-chen Please have a check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889032362


   > @RedemptionC
   > All read operations in the dashboard read the data in the cache, see:
   > https://github.com/apache/apisix-dashboard/blob/master/api/internal/core/store/store.go
   
   thanks for your quick reply,I will read this now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891076643


   @nic-chen 
   Hello,it seems that I know how to access content in cache and etcd now
   this is the log output:
   ```
   consumer.Get is called
   in get
   
   cache: key(andy):val(&{andy  map[key-auth:map[key:key-of-john]] map[] %!s(int64=1627739045) %!s(int64=1627744978)})
   ......(something else in the cache)
   etcd:  key(andy):val(&{cluster_id:14841639068965178418 member_id:10276657743932975437 revision:11844 raft_term:38  [] %!s(bool=false) %!s(int64=0) {}  %!s(int32=0)})
   
   ```
   and here is my log statement:
   ```go
   	fmt.Println("in get")
   	s.cache.Range(func(k, v interface{}) bool {
   		fmt.Printf("cache: key(%s):val(%s)\n", k, v)
   		return true
   	})
   	val,err:=storage.Client.Get(context.TODO(),key)
   	if err!=nil{
   		fmt.Println(err)
   	}else{
   		fmt.Printf("etcd:  key(%s):val(%s)\n", key, val)
   	}
   ```
   but they are pretty different, I don't know what the data retrived from etcd mean
   but when I use etcdctl,its value is pretty the same as that in the cache:
   ```shell
   ❯ etcdctl get /apisix/consumers/andy         
   /apisix/consumers/andy
   {"username":"andy","plugins":{"key-auth":{"key":"key-of-john"}},"update_time":1627744978,"create_time":1627739045}
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-889724247


   hi @RedemptionC  
   
   The relevant data needs to be written before there is a cache.
   
   In your example, you should create a consumer first.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891099786


   > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   
   No,what I want is to make sure they contain the same content,as the task indicated.But as the output suggests,the value retrived from etcd contains different content from the value in the cache
   OK,I will try to convert them to json,and see what the value from etcd looks like


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] RedemptionC commented on issue #2011: request help: I want to add a cache verification tool for the dashboard,and I have some questions

Posted by GitBox <gi...@apache.org>.
RedemptionC commented on issue #2011:
URL: https://github.com/apache/apisix-dashboard/issues/2011#issuecomment-891843234


   > > > If you just want them to look the same, you can convert them to json instead of printing directly. @RedemptionC
   > > 
   > > 
   > > Or , do I misunderstand something?It will be greatly appreciated if you could point out that
   > 
   > It just explains why they look different. You need to search which way is more suitable for object comparison.
   
   I parsed the cache value into json,like this :
   ```
   consumer.Get is called
   in get
   cache: key(andy):val({"username":"andy","plugins":{"key-auth":{"key":"key-of-john"}},"create_time":1627739045,"update_time":1627744978})
   etcd:  key(/apisix/consumers/andy):val({"username":"andy","plugins":{"key-auth":{"key":"key-of-john"}},"update_time":1627744978,"create_time":1627739045})
   cache content and etcd content on this key(andy) is the same: false
   ```
   the output suggests that they are almost the same,except the create time and update time


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org