-
Notifications
You must be signed in to change notification settings - Fork 217
Create insight collector #1287
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
Create insight collector #1287
Conversation
|
The golinter build is completed with FAILURE. The build will be triggered again when you push any other commits. Or you can trigger it manually by You can check the build log from here. |
09f1ef1 to
0fc0b7d
Compare
|
The following files are not gofmt-ed. By commenting pkg/app/ops/insightcollector/collector.go--- pkg/app/ops/insightcollector/collector.go.orig
+++ pkg/app/ops/insightcollector/collector.go
@@ -24,9 +24,10 @@
"github.com/pipe-cd/pipe/pkg/insightstore"
+ "go.uber.org/zap"
+
"github.com/pipe-cd/pipe/pkg/datastore"
"github.com/pipe-cd/pipe/pkg/model"
- "go.uber.org/zap"
)
var aggregateKinds = []model.InsightMetricsKind{
pkg/insightstore/datapoint_test.go--- pkg/insightstore/datapoint_test.go.orig
+++ pkg/insightstore/datapoint_test.go
@@ -18,8 +18,9 @@
"testing"
"time"
- "github.com/pipe-cd/pipe/pkg/model"
"github.com/stretchr/testify/assert"
+
+ "github.com/pipe-cd/pipe/pkg/model"
)
func Test_ExtractDataPoints(t *testing.T) {
|
pipecd-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return insightstore.ChangeFailureRate{}, time.Time{}, ErrDeploymentNotFound | ||
| } | ||
|
|
||
| var successCount int64 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should drop = 0 from declaration of var successCount; it is the zero value
| } | ||
|
|
||
| var successCount int64 = 0 | ||
| var failureCount int64 = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should drop = 0 from declaration of var failureCount; it is the zero value
|
/golinter fmt |
|
Code coverage for golang is
|
…to create-insight-collector
|
Code coverage for golang is
|
pipecd-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
| } | ||
|
|
||
| maxUpdateAt = apps[len(apps)-1].UpdatedAt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ineffectual assignment to maxUpdateAt
pipecd-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return err | ||
| } | ||
| } | ||
| err = i.insightstore.PutChunk(ctx, chunk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ineffectual assignment to err
|
Code coverage for golang is
|
|
Code coverage for golang is
|
|
Code coverage for golang is
|
|
@nghialv |
|
The following files are not gofmt-ed. By commenting pkg/app/api/grpcapi/web_api_test.go--- pkg/app/api/grpcapi/web_api_test.go.orig
+++ pkg/app/api/grpcapi/web_api_test.go
@@ -386,4 +386,4 @@
assert.Equal(t, tt.wantErr, err != nil)
})
}
-}
\ No newline at end of file
+}
|
|
/golinter fmt |
|
Code coverage for golang is
|
cmd/pipecd/ops.go
Outdated
| cmd.Flags().IntVar(&s.adminPort, "admin-port", s.adminPort, "The port number used to run a HTTP server for admin tasks such as metrics, healthz.") | ||
| cmd.Flags().DurationVar(&s.gracePeriod, "grace-period", s.gracePeriod, "How long to wait for graceful shutdown.") | ||
|
|
||
| cmd.Flags().BoolVar(&s.enableInsightCollector, "enable-insight-collector", s.enableInsightCollector, "enable insight collector.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "Enable"
cmd/pipecd/ops.go
Outdated
| } | ||
| }() | ||
|
|
||
| // Set insight collector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "Starting a cron job for insight collector."
|
Code coverage for golang is
|
cmd/pipecd/ops.go
Outdated
| httpPort int | ||
| adminPort int | ||
| gracePeriod time.Duration | ||
| enable bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: enableInsightCollector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I have understood this comment.
| } | ||
| if err := collector.CollectApplicationInsight(ctx); err != nil { | ||
| t.Logger.Error("failed to run the application insight collector", zap.Error(err)) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, Could you add a log to show how long does each function take to run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, added:+1:
| err = i.updateApplicationChunks(ctx, p.Id, "", k, now) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should continue working on other projects.
if err := i.updateApplicationChunks(ctx, p.Id, "", k, now); err != nil {
log the error
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks :D
|
Code coverage for golang is
|
| break | ||
| } | ||
|
|
||
| for _, app := range apps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ignore the deleted one.
if app.Deleted {
continue
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK 👌 Thanks
|
Code coverage for golang is
|
|
Code coverage for golang is
|
|
Thank you. |
What this PR does / why we need it:
Create the data collector for insight.
Sorry this PR is getting so big.
It's because the test code is too big.
Which issue(s) this PR fixes:
Ref #1142
Does this PR introduce a user-facing change?: