Skip to content

Conversation

@knanao
Copy link
Member

@knanao knanao commented Feb 17, 2022

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Implement live state reporter for Cloud Run

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The following files are not gofmt-ed. By commenting /golinter fmt, the formatted one will be appended to this pull request automatically.

pkg/app/piped/livestatereporter/cloudrun/report.go
--- pkg/app/piped/livestatereporter/cloudrun/report.go.orig
+++ pkg/app/piped/livestatereporter/cloudrun/report.go
@@ -19,12 +19,13 @@
 	"fmt"
 	"time"
 
+	"go.uber.org/zap"
+	"google.golang.org/grpc"
+
 	"github.com/pipe-cd/pipecd/pkg/app/piped/livestatestore/cloudrun"
 	"github.com/pipe-cd/pipecd/pkg/app/server/service/pipedservice"
 	"github.com/pipe-cd/pipecd/pkg/config"
 	"github.com/pipe-cd/pipecd/pkg/model"
-	"go.uber.org/zap"
-	"google.golang.org/grpc"
 )
 
 type applicationLister interface {

@knanao
Copy link
Member Author

knanao commented Feb 17, 2022

/golinter fmt

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.33%. This pull request increases coverage by 0.15%.

File Function Base Head Diff
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineKubernetesAppHealthStatus -- 100.00% +100.00%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineCloudRunAppHealthStatus -- 100.00% +100.00%
pkg/app/pipectl/cmd/planpreview/planpreview.go ReadableResult.String 96.67% 94.44% -2.22%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.DetermineAppHealthStatus 0.00% 100.00% +100.00%
pkg/model/planpreview.go PlanPreviewCommandResult.FillURLs 0.00% 0.00% +0.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.33%. This pull request increases coverage by 0.15%.

File Function Base Head Diff
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineKubernetesAppHealthStatus -- 100.00% +100.00%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineCloudRunAppHealthStatus -- 100.00% +100.00%
pkg/app/pipectl/cmd/planpreview/planpreview.go ReadableResult.String 96.67% 94.44% -2.22%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.DetermineAppHealthStatus 0.00% 100.00% +100.00%
pkg/model/planpreview.go PlanPreviewCommandResult.FillURLs 0.00% 0.00% +0.00%

@knanao
Copy link
Member Author

knanao commented Feb 21, 2022

hold this PR until v0.26.0 released
/hold

@knanao
Copy link
Member Author

knanao commented Feb 21, 2022

/hold cancel


for {
select {
case <-snapshotTicker.C:
Copy link
Member

Choose a reason for hiding this comment

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

This means that the state will be updated every 10 minutes, right?
Do we have any way to make it refresh faster on UI?

Copy link
Member Author

@knanao knanao Feb 21, 2022

Choose a reason for hiding this comment

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

@nghialv

This means that the state will be updated every 10 minutes, right?

Exactly.

Do we have any way to make it refresh faster on UI?

Currently, No we don't. Since livestatestore fetch the live state at 15s intervals and driftdetection and livestatereporter refer to it. But as one idea, it may be better that adding forceRefresh flag into GetApplicationLiveStateRequest in order to get latest live state synchronously.
BTW, It might be a good idea to make this interval one minute like as driftdetection.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.33%. This pull request increases coverage by 0.15%.

File Function Base Head Diff
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineKubernetesAppHealthStatus -- 100.00% +100.00%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.determineCloudRunAppHealthStatus -- 100.00% +100.00%
pkg/app/pipectl/cmd/planpreview/planpreview.go ReadableResult.String 96.67% 94.44% -2.22%
pkg/model/application_live_state.go ApplicationLiveStateSnapshot.DetermineAppHealthStatus 0.00% 100.00% +100.00%
pkg/model/planpreview.go PlanPreviewCommandResult.FillURLs 0.00% 0.00% +0.00%

@nghialv
Copy link
Member

nghialv commented Feb 21, 2022

Nice.
/lgtm

Snapshot: snapshot,
}

if _, err := r.apiClient.ReportApplicationLiveState(ctx, req); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

nit: We may need a new RPC to send a bunch of applications.

Copy link
Member Author

@knanao knanao Feb 21, 2022

Choose a reason for hiding this comment

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

Yep, I think it's good to add new RPC to improve performance in the future.

@khanhtc1202
Copy link
Member

Here you go 🙌
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

This was referenced Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants