You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/02/26 08:46:22 UTC

[GitHub] [servicecomb-kie] GuoYL123 opened a new pull request #98: #79 add get interface for polling data

GuoYL123 opened a new pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391357955
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,50 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{}
+	sessionID := context.ReadQueryParameter("sessionId")
+	if sessionID != "" {
+		query.SessionID = sessionID
+	}
+	ip := context.ReadQueryParameter("ip")
+	if ip != "" {
+		query.IP = ip
+	}
+	urlPath := context.ReadQueryParameter("urlPath")
+	if urlPath != "" {
+		query.URLPath = urlPath
+	}
+	userAgent := context.ReadQueryParameter("userAgent")
+	if userAgent != "" {
+		query.UserAgent = userAgent
+	}
+	domain := ReadDomain(context)
+	if domain == nil {
+		WriteErrResponse(context, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
+		return
+	}
+	query.Domain = domain.(string)
+	records, err := record.Get(context.Ctx, query)
 
 Review comment:
   record改名为track吧

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391356823
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -92,5 +137,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/polling_data",
+			ResourceFunc: r.GetPollingData,
+			FuncDesc:     "get all history record of get and list",
 
 Review comment:
   其实并不是一种history,而是当前的配置现状

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391358590
 
 

 ##########
 File path: server/service/mongo/record/polling_detail_dao.go
 ##########
 @@ -40,9 +42,48 @@ func CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.Po
 		}
 		return nil, res.Err()
 	}
-	_, err := collection.UpdateOne(ctx, queryFilter, detail)
+	_, err := collection.UpdateOne(ctx, queryFilter, bson.D{{"$set", detail}})
 	if err != nil {
 		return nil, err
 	}
 	return detail, nil
 }
+
+//Get is to get a
+func Get(ctx context.Context, detail *model.PollingDetail) ([]*model.PollingDetail, error) {
+	collection := session.GetDB().Collection(session.CollectionPollingDetail)
+	queryFilter := bson.M{"domain": detail.Domain}
+	if detail.SessionID != "" {
+		queryFilter["session_id"] = detail.SessionID
+	}
+	if detail.IP != "" {
+		queryFilter["ip"] = detail.IP
+	}
+	if detail.UserAgent != "" {
+		queryFilter["user_agent"] = detail.UserAgent
+	}
+	if detail.URLPath != "" {
+		queryFilter["url_path"] = detail.URLPath
+	}
+	cur, err := collection.Find(ctx, queryFilter)
+	if err != nil {
+		return nil, err
+	}
+	defer cur.Close(ctx)
+	if cur.Err() != nil {
+		return nil, err
+	}
+	records := make([]*model.PollingDetail, 0)
+	for cur.Next(ctx) {
+		curRecord := &model.PollingDetail{}
+		if err := cur.Decode(curRecord); err != nil {
+			openlogging.Error("decode to KVs error: " + err.Error())
+			return nil, err
+		}
+		records = append(records, curRecord)
 
 Review comment:
   返回的时候得把domain干掉,别反回租户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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391357611
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -92,5 +137,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/polling_data",
 
 Review comment:
   叫 /v1/{project}/kie/track 吧 更符合中文的定义

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r385533123
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -93,5 +123,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/record",
 
 Review comment:
   record不够具体,叫polling_detail比较好

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on issue #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on issue #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#issuecomment-599022872
 
 
   冲突有空解决

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r385533648
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,35 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{
+		Domain:    context.ReadQueryParameter("domain"),
+		SessionID: context.ReadQueryParameter("sessionId"),
+		IP:        context.ReadQueryParameter("ip"),
+		ID:        context.ReadQueryParameter("id"),
 
 Review comment:
   不需要根据数据库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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] GuoYL123 commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
GuoYL123 commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r394819997
 
 

 ##########
 File path: server/handler/track_handler.go
 ##########
 @@ -60,13 +60,10 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		return
 	}
 	chain.Next(inv, func(ir *invocation.Response) error {
-		resp, ok := ir.Result.(*restful.Response)
-		if !ok {
-			err := cb(ir)
-			if err != nil {
-				return err
-			}
-			return nil
+		resp, _ := ir.Result.(*restful.Response)
 
 Review comment:
   没有response header是不是也要记录,如果这样就无法记录

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r394808432
 
 

 ##########
 File path: server/handler/track_handler.go
 ##########
 @@ -60,13 +60,10 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		return
 	}
 	chain.Next(inv, func(ir *invocation.Response) error {
-		resp, ok := ir.Result.(*restful.Response)
-		if !ok {
-			err := cb(ir)
-			if err != nil {
-				return err
-			}
-			return nil
+		resp, _ := ir.Result.(*restful.Response)
 
 Review comment:
   是否转换成功需要保留,不成功就执行回到前置handler

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] GuoYL123 commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
GuoYL123 commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r394826517
 
 

 ##########
 File path: server/handler/track_handler.go
 ##########
 @@ -60,13 +60,10 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		return
 	}
 	chain.Next(inv, func(ir *invocation.Response) error {
-		resp, ok := ir.Result.(*restful.Response)
-		if !ok {
-			err := cb(ir)
-			if err != nil {
-				return err
-			}
-			return nil
+		resp, _ := ir.Result.(*restful.Response)
+		err := cb(ir)
 
 Review comment:
   删除了这段代码

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r392805085
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -92,5 +136,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/track",
+			ResourceFunc: r.GetPollingData,
+			FuncDesc:     "get the request/response data by latest getKV or list",
 
 Review comment:
   "get the request/response data by latest getKV or list换成get polling tracks of clients of kie server

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang merged pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r385533919
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,35 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{
+		Domain:    context.ReadQueryParameter("domain"),
 
 Review comment:
   domain id可是用户的租户信息啊,不可能作为用户可选的参数传进来,只能是在另一个端口开放admin 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391357311
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,50 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{}
+	sessionID := context.ReadQueryParameter("sessionId")
+	if sessionID != "" {
+		query.SessionID = sessionID
+	}
+	ip := context.ReadQueryParameter("ip")
+	if ip != "" {
+		query.IP = ip
+	}
+	urlPath := context.ReadQueryParameter("urlPath")
+	if urlPath != "" {
+		query.URLPath = urlPath
+	}
+	userAgent := context.ReadQueryParameter("userAgent")
+	if userAgent != "" {
+		query.UserAgent = userAgent
+	}
+	domain := ReadDomain(context)
+	if domain == nil {
+		WriteErrResponse(context, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
+		return
+	}
+	query.Domain = domain.(string)
+	records, err := record.Get(context.Ctx, query)
+	if err != nil {
+		if err == service.ErrRecordNotExists {
+			WriteErrResponse(context, http.StatusNotFound, err.Error(), common.ContentTypeText)
+			return
+		}
+		WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
+		return
+	}
+	if len(records) == 0 {
 
 Review comment:
   这个0的判断多余了,绝对不会发生

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391357785
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,50 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{}
+	sessionID := context.ReadQueryParameter("sessionId")
 
 Review comment:
   这些参数,都应当是常量

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r385533373
 
 

 ##########
 File path: server/service/mongo/record/polling_detail_dao.go
 ##########
 @@ -46,3 +48,37 @@ func CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.Po
 	}
 	return detail, nil
 }
+
+//Get is to get a
+func Get(ctx context.Context, detail *model.PollingDetail) ([]*model.PollingDetail, error) {
+	collection := session.GetDB().Collection(session.CollectionPollingDetail)
+	queryFilter := bson.M{
+		"domain":     detail.Domain,
 
 Review comment:
   如果你这么传参,某些参数没传进来,mongdb查询时就会按照这个字段必须为空来查了,你可以写ut试试

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r394808230
 
 

 ##########
 File path: server/handler/track_handler.go
 ##########
 @@ -60,13 +60,10 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		return
 	}
 	chain.Next(inv, func(ir *invocation.Response) error {
-		resp, ok := ir.Result.(*restful.Response)
-		if !ok {
-			err := cb(ir)
-			if err != nil {
-				return err
-			}
-			return nil
+		resp, _ := ir.Result.(*restful.Response)
+		err := cb(ir)
 
 Review comment:
   不该立刻callback回到前置handler中,应该按顺序执行回去

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r392804239
 
 

 ##########
 File path: pkg/model/kv.go
 ##########
 @@ -86,3 +72,9 @@ type DocResponseGetKey struct {
 	Data  []*DocResponseSingleKey `json:"data"`
 	Total int64                   `json:"total"`
 }
+
+//DocPollingData  is response doc
+type DocPollingData struct {
 
 Review comment:
   DocPollingData 改名叫PollingDataResponse 类似KVResponse

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r395409593
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -75,6 +76,49 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{}
+	sessionID := context.ReadQueryParameter(common.QueryParamSessionID)
+	if sessionID != "" {
+		query.SessionID = sessionID
+	}
+	ip := context.ReadQueryParameter(common.QueryParamIP)
+	if ip != "" {
+		query.IP = ip
+	}
+	urlPath := context.ReadQueryParameter(common.QueryParamURLPath)
+	if urlPath != "" {
+		query.URLPath = urlPath
+	}
+	userAgent := context.ReadQueryParameter(common.QueryParamUserAgent)
+	if userAgent != "" {
+		query.UserAgent = userAgent
+	}
+	domain := ReadDomain(context)
+	if domain == nil {
+		WriteErrResponse(context, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
+		return
+	}
+	query.Domain = domain.(string)
+	records, err := track.Get(context.Ctx, query)
+	if err != nil {
+		if err == service.ErrRecordNotExists {
+			WriteErrResponse(context, http.StatusNotFound, err.Error(), common.ContentTypeText)
+			return
+		}
+		WriteErrResponse(context, http.StatusInternalServerError, err.Error(), common.ContentTypeText)
 
 Review comment:
   先给你合入,我正在做统一的错误处理规范,现在错误返回都太随意了

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391357842
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -92,5 +137,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/polling_data",
+			ResourceFunc: r.GetPollingData,
+			FuncDesc:     "get all history record of get and list",
+			Parameters: []*restful.Parameters{
+				DocPathProject,
 
 Review comment:
   文档代码保持一致

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r391356976
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -92,5 +137,23 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
 			Consumes: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 			Produces: []string{goRestful.MIME_JSON, common.ContentTypeYaml},
 		},
+		{
+			Method:       http.MethodGet,
+			Path:         "/v1/{project}/kie/polling_data",
+			ResourceFunc: r.GetPollingData,
+			FuncDesc:     "get all history record of get and list",
+			Parameters: []*restful.Parameters{
+				DocPathProject,
+			},
+			Returns: []*restful.Returns{
+				{
+					Code:    http.StatusOK,
+					Message: "true",
+					Model:   []model.PollingDetail{},
 
 Review comment:
   为了保持风格一致,返回都用json object,这里用{"data":[]}封一层

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #98: #79 add get interface for polling data
URL: https://github.com/apache/servicecomb-kie/pull/98#discussion_r385533919
 
 

 ##########
 File path: server/resource/v1/history_resource.go
 ##########
 @@ -72,6 +73,35 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
 	}
 }
 
+//GetPollingData get the record of the get or list history
+func (r *HistoryResource) GetPollingData(context *restful.Context) {
+	query := &model.PollingDetail{
+		Domain:    context.ReadQueryParameter("domain"),
 
 Review comment:
   domain id可是用户的租户信息啊,不可能作为用户可选的参数传进来,只能是在另一个端口开放admin 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services