Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status: map weavelet id to pids for multi, single and ssh deployment. #767

Merged
merged 4 commits into from
May 30, 2024

Conversation

flouthoc
Copy link
Contributor

As of now weaver logs shows the weavelet id but not pids and weaver multi status shows the respective pid but its hard to map weavelet id from the logs to the running process, following commit adds weavelet id with the pids of the components so its easier to debug.

weavelet_id

@flouthoc
Copy link
Contributor Author

@rgrandl @mwhittaker PTAL

Copy link
Contributor

@rgrandl rgrandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the change. This is a great idea.

You'll also need to fix the single deployer and the ssh deployer, because they use the same status package.

internal/status/status.go Outdated Show resolved Hide resolved
internal/status/status.go Outdated Show resolved Hide resolved
internal/status/status.proto Outdated Show resolved Hide resolved
internal/tool/multi/deployer.go Outdated Show resolved Hide resolved
internal/tool/multi/deployer.go Outdated Show resolved Hide resolved
internal/tool/multi/deployer.go Outdated Show resolved Hide resolved
internal/tool/multi/deployer.go Outdated Show resolved Hide resolved
@flouthoc
Copy link
Contributor Author

@rgrandl PTAL again. I have tested both single and multi deploy but I was not able to test ssh although I think my code changes should work without any issues. Do we have test for ssh in CI ? or should i setup ssh in my environment.

@flouthoc flouthoc requested a review from rgrandl May 29, 2024 20:20
@flouthoc flouthoc changed the title status, multi: map weavelet id to pids status: map weavelet id to pids for multi, single and ssh deployment. May 29, 2024
@flouthoc
Copy link
Contributor Author

@rgrandl I might be able to test on ssh as well today, but irrespective of that I think PR is ready for a review again.

@flouthoc
Copy link
Contributor Author

@rgrandl I might be able to test on ssh as well today, but irrespective of that I think PR is ready for a review again.

Well I configured ssh setup only to figure out there is no status command in ssh deployer at all, there is a dashboard command but it is a webview. @rgrandl is there any cli command in ssh which is equivalent to status.

Copy link
Contributor

@rgrandl rgrandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I tried the ssh deployer and it works too.

I think you need to update the dashboard as well. If you do weaver multi dashboard you will see an error.

These are the changes you need to do:

diff --git a/internal/status/dashboard.go b/internal/status/dashboard.go
index ca821c1..ef55fd6 100644
--- a/internal/status/dashboard.go
+++ b/internal/status/dashboard.go
@@ -54,10 +54,17 @@ var (
        deploymentHTML     string
        deploymentTemplate = template.Must(template.New("deployment").Funcs(template.FuncMap{
                "shorten": logging.ShortenComponent,
-               "pidjoin": func(pids []int64) string {
-                       s := make([]string, len(pids))
-                       for i, x := range pids {
-                               s[i] = fmt.Sprint(x)
+               "pidjoin": func(replicas []*Replica) string {
+                       s := make([]string, len(replicas))
+                       for i, x := range replicas {
+                               s[i] = fmt.Sprint(x.Pid)
+                       }
+                       return strings.Join(s, ", ")
+               },
+               "widjoin": func(replicas []*Replica) string {
+                       s := make([]string, len(replicas))
+                       for i, x := range replicas {
+                               s[i] = x.WeaveletId[0:8]
                        }
                        return strings.Join(s, ", ")
                },
diff --git a/internal/status/templates/deployment.html b/internal/status/templates/deployment.html
index 2ae661b..5753bbc 100644
--- a/internal/status/templates/deployment.html
+++ b/internal/status/templates/deployment.html
@@ -152,14 +152,16 @@
               <th>Component</th>
               <th>Replication</th>
               <th>PIDs</th>
+              <th>Weavelet IDs</th>
             </tr>
           </thead>
           <tbody>
             {{range $c := .Components}}
             <tr>
               <td>{{shorten $c.Name}}</td>
-              <td>{{len $c.Pids}}</td>
-              <td>{{pidjoin $c.Pids}}</td>
+              <td>{{len $c.Replicas}}</td>
+              <td>{{pidjoin $c.Replicas}}</td>
+              <td>{{widjoin $c.Replicas}}</td>
             </tr>
             {{end}}
           </tbody>

weaveletIds := make([]string, len(component.Replicas))
for i, replica := range component.Replicas {
pids[i] = fmt.Sprint(replica.Pid)
if len(replica.WeaveletId) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should let it crash here. If we don't set the weavelet id somehow, we shouldn't hide it.

flouthoc added 2 commits May 30, 2024 09:56
As of now weaver logs shows the weavelet id and `weaver multi status`
shows the respective `pid` but its hard to map weavelet id from the logs
to the running process, following commit adds weavelet id with the pids
of the components so its easier to debug.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Extends work in PR ServiceWeaver#767 to
refect weavelet id on status dashboard as well.

Thanks to @rgrandl for diff provided here: ServiceWeaver#767 (review)

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc flouthoc requested a review from rgrandl May 30, 2024 17:04
@flouthoc
Copy link
Contributor Author

@rgrandl Please take a look again.

Copy link
Contributor

@rgrandl rgrandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks a lot!

@rgrandl
Copy link
Contributor

rgrandl commented May 30, 2024

@rgrandl I might be able to test on ssh as well today, but irrespective of that I think PR is ready for a review again.

Well I configured ssh setup only to figure out there is no status command in ssh deployer at all, there is a dashboard command but it is a webview. @rgrandl is there any cli command in ssh which is equivalent to status.

There is no status command in the ssh deployer apparently.

@rgrandl
Copy link
Contributor

rgrandl commented May 30, 2024

@flouthoc can you also run ./dev/build_and_test tidy generate build vet test testrace

flouthoc added a commit to flouthoc/weaver that referenced this pull request May 30, 2024
Context: ServiceWeaver#767 (comment)

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
flouthoc added a commit to flouthoc/weaver that referenced this pull request May 30, 2024
Context: ServiceWeaver#767 (comment)

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
flouthoc added 2 commits May 30, 2024 10:34
Context: ServiceWeaver#767 (comment)

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Run `./dev/build_and_test tidy generate build vet test testrace` on
source.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc flouthoc requested a review from rgrandl May 30, 2024 17:36
@rgrandl rgrandl merged commit e912504 into ServiceWeaver:main May 30, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants