You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/07/27 12:59:57 UTC

[GitHub] [incubator-devlake] likyh opened a new pull request, #2619: feat: graphql POC in github

likyh opened a new pull request, #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619

   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Does this close any open issues?
   Please mention the issues here.
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] likyh commented on pull request #2619: feat: graphql POC in github

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619#issuecomment-1197636273

   the comparison in different ways:
   
   | Way                     | Restful                                                      | Graphql Rough version(now)                                   | Graphql+Restful                                              |
   | ----------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
   | Theoretical Request Num | Num(PR) * 2 +<br />Num(account) * 2 +<br />Num(PR+issue+comment+issueEvent+reviewComment+milestone) / 100 + 1 | Num(PR+issue) / 100 + 2<br /><br />Not include: comment/<br />issueEvent/milestone/reviewComment | Num(PR+issue+account+comment+<br />issueEvent+milestone) / 100 + 2 |
   | Example: ants           | Requests: 55*(PR)* * 2 + 218*(account)* * 2 + [55*(PR)* + 180*(issue)* + 650*(comment)* + 1400*(issueEvent)* + 104*(reviewComment)* + 1*(milestone)*] / 100 + 1 ≈ 560<br />Time: **About takes 560s for 1 token**<br />RateLimit: 560/5000 requests | Requests:  [55*(PR)* + 180*(issue)*] / 100 + 2 ≈ 5<br />Time: About 10s<br />RateLimit: About 208/5000 points | Requests:  [55*(PR)* + 180*(issue)* + 218*(account)* + 650*(comment)* + 1400(issueEvent) + 1*(milestone)*] / 100 + 2 ≈ 30<br />Time: **About 30s**<br />RateLimit: 13/5000 points + <br />About 23/5000 requests |
   | Example: devlake        | Requests: 1315*(PR)* * 2 + about 100*(account)* * 2 + [1315*(PR)* + 1317*(issue)* + 2950*(comment)* + 19800*(issueEvent)* + 1350*(reviewComment)* + 9*(milestone)*] / 100 + 1 ≈ 3100<br />Time: **About takes 10min for 6 token**<br />RateLimit: 3100/5000 requests | Requests:  [1315*(PR)* + 1317*(issue)*] / 100 + 2 ≈ 30<br />Time: About 3min<br />RateLimit: About 2500/5000 points | Requests:  [1315*(PR)* + 1317*(issue)* + about 100*(account)* + 2950*(comment)* + 19800(issueEvent) + 9*(milestone)*] / 100 + 2 ≈ 260<br />Time: **About 5min for 1 token**<br />RateLimit: 115/5000 points + <br />About 229/5000 requests |
   | Example: clickhouse     | Requests: 27099*(PR)* * 2 + about 3000*(account)* * 2 + [27099*(PR)* + 12372*(issue)* + 40000*(comment)* + 40000*(issueEvent)* + 33200*(reviewComment)* + ...] / 100 + 1 ≈ 61000<br />Time: **About takes 18h for 10 token**<br />RateLimit: -/5000 requests | -                                                            | Requests:  [27099*(PR)* + 12372*(issue)* + about 3000*(account)* + 40000*(comment)* + 40000(issueEvent) + ...] / 100 + 2 ≈ 1200<br />Time: **About 15min for 1 token**<br />RateLimit: 1800/5000 points + <br />About 800/5000 requests |
   
   
   


-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] likyh commented on pull request #2619: feat: graphql POC in github

Posted by GitBox <gi...@apache.org>.
likyh commented on PR #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619#issuecomment-1208248922

   New Update:
   1. collect events by rest
   2. request users in another query to avoid exhausting too many points.


-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2619: feat: graphql POC in github

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619#discussion_r942311084


##########
plugins/github_graphql/tasks/comment_collector.go:
##########
@@ -0,0 +1,135 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tasks
+
+import (
+	"encoding/json"
+	"fmt"
+	githubTasks "github.com/apache/incubator-devlake/plugins/github/tasks"
+	"net/http"
+	"net/url"
+
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+
+	"github.com/apache/incubator-devlake/plugins/helper"
+
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+)
+
+const RAW_COMMENTS_TABLE = "github_api_comments"
+
+func CollectApiComments(taskCtx core.SubTaskContext) error {
+	db := taskCtx.GetDal()
+	data := taskCtx.GetData().(*GithubGraphqlTaskData)

Review Comment:
   added GraphqlClient and deleted duplicate collector.



-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #2619: feat: graphql POC in github

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619#discussion_r942296661


##########
plugins/github_graphql/tasks/comment_collector.go:
##########
@@ -0,0 +1,135 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tasks
+
+import (
+	"encoding/json"
+	"fmt"
+	githubTasks "github.com/apache/incubator-devlake/plugins/github/tasks"
+	"net/http"
+	"net/url"
+
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+
+	"github.com/apache/incubator-devlake/plugins/helper"
+
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+)
+
+const RAW_COMMENTS_TABLE = "github_api_comments"
+
+func CollectApiComments(taskCtx core.SubTaskContext) error {
+	db := taskCtx.GetDal()
+	data := taskCtx.GetData().(*GithubGraphqlTaskData)

Review Comment:
   Maybe we can make `GithubTaskData` nested inside `GithubGraphqlTaskData` so that it can be converted to `GithubTaskData`, thus we can use the original github subtask directly without copying the code.



-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] mindlesscloud merged pull request #2619: feat: graphql POC in github

Posted by GitBox <gi...@apache.org>.
mindlesscloud merged PR #2619:
URL: https://github.com/apache/incubator-devlake/pull/2619


-- 
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: commits-unsubscribe@devlake.apache.org

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