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/12/26 08:28:15 UTC

[GitHub] [servicecomb-kie] develpoerX opened a new pull request #168: #79 消息轨迹推送跟踪

develpoerX opened a new pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168


   


----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] GuoYL123 commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
GuoYL123 commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549199195



##########
File path: server/handler/track_handler.go
##########
@@ -66,13 +67,15 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		data := &model.PollingDetail{}
 		data.URLPath = req.Request.Method + " " + req.Request.URL.Path
 		data.SessionID = sessionID
+		data.SessionGroup = req.HeaderParameter(v1.HeaderSessionGroup)
 		data.UserAgent = req.HeaderParameter(v1.HeaderUserAgent)
 		data.Domain = v1.ReadDomain(req.Request.Context())
 		data.IP = iputil.ClientIP(req.Request)
 		data.ResponseBody = req.Attribute(common.RespBodyContextKey).([]*model.KVDoc)
 		data.ResponseCode = ir.Status
+		data.Timestamp = time.Now()
 		if resp != nil {
-			data.ResponseHeader = resp.Header()
+			data.Revision = resp.Header().Get(common.HeaderRevision)
 		}

Review comment:
       感觉没有返回值时甚至可以不记录polling 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



[GitHub] [servicecomb-kie] tianxiaoliang merged pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168


   


----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] develpoerX closed pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
develpoerX closed pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168


   


----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] develpoerX commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
develpoerX commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549231130



##########
File path: deployments/db.js
##########
@@ -114,15 +114,14 @@ db.createCollection( "polling_detail", {
 } );
 
 //index
-db.kv.createIndex({"id": 1}, { unique: true } );
-db.kv.createIndex({key: 1, label_format: 1,domain:1,project:1},{ unique: true });
-db.kv_revision.createIndex( { "delete_time": 1 }, { expireAfterSeconds: 7 * 24 * 3600 } );
-db.label.createIndex({"id": 1}, { unique: true } );
-db.label.createIndex({format: 1,domain:1,project:1},{ unique: true });
-db.polling_detail.createIndex({"id": 1}, { unique: true } );
-db.polling_detail.createIndex({session_id:1,domain:1}, { unique: true } );
-db.counter.createIndex({name: 1,domain:1},{ unique: true });
-db.view.createIndex({"id": 1}, { unique: true } );
-db.view.createIndex({display:1,domain:1,project:1},{ unique: true });
+db.kv.createIndex({"id": 1}, {unique: true});
+db.kv.createIndex({key: 1, label_format: 1, domain: 1, project: 1}, {unique: true});
+db.kv_revision.createIndex({"delete_time": 1}, {expireAfterSeconds: 7 * 24 * 3600});
+db.label.createIndex({"id": 1}, {unique: true});
+db.label.createIndex({format: 1, domain: 1, project: 1}, {unique: true});
+db.polling_detail.createIndex({timestamp: 1}, {expireAfterSeconds: 7 * 24 * 3600});

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



[GitHub] [servicecomb-kie] GuoYL123 commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
GuoYL123 commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549199568



##########
File path: server/handler/track_handler.go
##########
@@ -66,13 +67,15 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		data := &model.PollingDetail{}
 		data.URLPath = req.Request.Method + " " + req.Request.URL.Path
 		data.SessionID = sessionID
+		data.SessionGroup = req.HeaderParameter(v1.HeaderSessionGroup)
 		data.UserAgent = req.HeaderParameter(v1.HeaderUserAgent)
 		data.Domain = v1.ReadDomain(req.Request.Context())
 		data.IP = iputil.ClientIP(req.Request)
 		data.ResponseBody = req.Attribute(common.RespBodyContextKey).([]*model.KVDoc)
 		data.ResponseCode = ir.Status
+		data.Timestamp = time.Now()
 		if resp != nil {
-			data.ResponseHeader = resp.Header()
+			data.Revision = resp.Header().Get(common.HeaderRevision)

Review comment:
       返回值200时才记录polling data比较合理?存在304数据未变更的情况导致数据被覆盖。




----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549196019



##########
File path: server/service/mongo/track/polling_detail_dao.go
##########
@@ -29,9 +29,10 @@ import (
 )
 
 //CreateOrUpdate create a record or update exist record
+//If revision and session_id is exist: update else:insert
 func CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.PollingDetail, error) {
 	collection := session.GetDB().Collection(session.CollectionPollingDetail)
-	queryFilter := bson.M{"domain": detail.Domain, "session_id": detail.SessionID}
+	queryFilter := bson.M{"revision": detail.Domain, "session_id": detail.SessionID}

Review comment:
       revision不可能和domain产生关系

##########
File path: deployments/db.js
##########
@@ -114,15 +114,14 @@ db.createCollection( "polling_detail", {
 } );
 
 //index
-db.kv.createIndex({"id": 1}, { unique: true } );
-db.kv.createIndex({key: 1, label_format: 1,domain:1,project:1},{ unique: true });
-db.kv_revision.createIndex( { "delete_time": 1 }, { expireAfterSeconds: 7 * 24 * 3600 } );
-db.label.createIndex({"id": 1}, { unique: true } );
-db.label.createIndex({format: 1,domain:1,project:1},{ unique: true });
-db.polling_detail.createIndex({"id": 1}, { unique: true } );
-db.polling_detail.createIndex({session_id:1,domain:1}, { unique: true } );
-db.counter.createIndex({name: 1,domain:1},{ unique: true });
-db.view.createIndex({"id": 1}, { unique: true } );
-db.view.createIndex({display:1,domain:1,project:1},{ unique: true });
+db.kv.createIndex({"id": 1}, {unique: true});
+db.kv.createIndex({key: 1, label_format: 1, domain: 1, project: 1}, {unique: true});
+db.kv_revision.createIndex({"delete_time": 1}, {expireAfterSeconds: 7 * 24 * 3600});
+db.label.createIndex({"id": 1}, {unique: true});
+db.label.createIndex({format: 1, domain: 1, project: 1}, {unique: true});
+db.polling_detail.createIndex({timestamp: 1}, {expireAfterSeconds: 7 * 24 * 3600});

Review comment:
       需要再做个唯一约束,revision+sessionid+domain




----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] GuoYL123 commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
GuoYL123 commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549199005



##########
File path: server/resource/v1/common.go
##########
@@ -43,6 +43,7 @@ import (
 const (
 	HeaderUserAgent    = "User-Agent"
 	HeaderSessionID    = "X-Session-Id"
+	HeaderSessionGroup = "X-Session-Group"

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



[GitHub] [servicecomb-kie] develpoerX commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
develpoerX commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549231012



##########
File path: server/handler/track_handler.go
##########
@@ -66,13 +67,15 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		data := &model.PollingDetail{}
 		data.URLPath = req.Request.Method + " " + req.Request.URL.Path
 		data.SessionID = sessionID
+		data.SessionGroup = req.HeaderParameter(v1.HeaderSessionGroup)
 		data.UserAgent = req.HeaderParameter(v1.HeaderUserAgent)
 		data.Domain = v1.ReadDomain(req.Request.Context())
 		data.IP = iputil.ClientIP(req.Request)
 		data.ResponseBody = req.Attribute(common.RespBodyContextKey).([]*model.KVDoc)
 		data.ResponseCode = ir.Status
+		data.Timestamp = time.Now()
 		if resp != nil {
-			data.ResponseHeader = resp.Header()
+			data.Revision = resp.Header().Get(common.HeaderRevision)

Review comment:
       现在就是返回200才会被覆盖。这是通过和dubboSDK调试时发现的。




----------------------------------------------------------------
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



[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549230916



##########
File path: server/handler/track_handler.go
##########
@@ -66,13 +67,15 @@ func (h *TrackHandler) Handle(chain *handler.Chain, inv *invocation.Invocation,
 		data := &model.PollingDetail{}
 		data.URLPath = req.Request.Method + " " + req.Request.URL.Path
 		data.SessionID = sessionID
+		data.SessionGroup = req.HeaderParameter(v1.HeaderSessionGroup)
 		data.UserAgent = req.HeaderParameter(v1.HeaderUserAgent)
 		data.Domain = v1.ReadDomain(req.Request.Context())
 		data.IP = iputil.ClientIP(req.Request)
 		data.ResponseBody = req.Attribute(common.RespBodyContextKey).([]*model.KVDoc)
 		data.ResponseCode = ir.Status
+		data.Timestamp = time.Now()
 		if resp != nil {
-			data.ResponseHeader = resp.Header()
+			data.Revision = resp.Header().Get(common.HeaderRevision)

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



[GitHub] [servicecomb-kie] develpoerX commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
develpoerX commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549231349



##########
File path: server/service/mongo/track/polling_detail_dao.go
##########
@@ -29,9 +29,10 @@ import (
 )
 
 //CreateOrUpdate create a record or update exist record
+//If revision and session_id is exist: update else:insert
 func CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.PollingDetail, error) {
 	collection := session.GetDB().Collection(session.CollectionPollingDetail)
-	queryFilter := bson.M{"domain": detail.Domain, "session_id": detail.SessionID}
+	queryFilter := bson.M{"revision": detail.Domain, "session_id": detail.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



[GitHub] [servicecomb-kie] develpoerX commented on a change in pull request #168: #79 消息轨迹推送跟踪

Posted by GitBox <gi...@apache.org>.
develpoerX commented on a change in pull request #168:
URL: https://github.com/apache/servicecomb-kie/pull/168#discussion_r549342923



##########
File path: server/resource/v1/common.go
##########
@@ -43,6 +43,7 @@ import (
 const (
 	HeaderUserAgent    = "User-Agent"
 	HeaderSessionID    = "X-Session-Id"
+	HeaderSessionGroup = "X-Session-Group"

Review comment:
       "X-Session-Group"是上次和亮哥拉通评审后,新增的




----------------------------------------------------------------
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