Skip to content

Conversation

@sanposhiho
Copy link
Member

@sanposhiho sanposhiho commented Dec 18, 2020

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

NONE

@pipecd-bot
Copy link
Collaborator

GO_LINTER

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 /golinter trigger command right now.

You can check the build log from here.

@sanposhiho sanposhiho force-pushed the create-insight-collector branch from 09f1ef1 to 0fc0b7d Compare December 18, 2020 06:52
@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/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) {

Copy link
Collaborator

@pipecd-bot pipecd-bot left a comment

Choose a reason for hiding this comment

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

GO_LINTER

Some issues were detected while linting go source files in your changes.

return insightstore.ChangeFailureRate{}, time.Time{}, ErrDeploymentNotFound
}

var successCount int64 = 0
Copy link
Collaborator

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
Copy link
Collaborator

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

@sanposhiho
Copy link
Member Author

/golinter fmt

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.94%. This pull request increases coverage by 0.68%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightData -- 86.00% +86.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.00% +96.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go Merge -- 39.29% +39.29%
pkg/insightstore/datapoint.go toDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go AppendDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go findDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go GetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go SetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 100.00% 77.78% -22.22%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate 85.71% 0.00% -85.71%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.94%. This pull request increases coverage by 0.68%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightData -- 86.00% +86.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.00% +96.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go Merge -- 39.29% +39.29%
pkg/insightstore/datapoint.go toDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go AppendDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go findDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go GetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go SetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 100.00% 77.78% -22.22%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate 85.71% 0.00% -85.71%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

Copy link
Collaborator

@pipecd-bot pipecd-bot left a comment

Choose a reason for hiding this comment

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

GO_LINTER

Some issues were detected while linting go source files in your changes.

}
}

maxUpdateAt = apps[len(apps)-1].UpdatedAt
Copy link
Collaborator

Choose a reason for hiding this comment

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

ineffectual assignment to maxUpdateAt

Copy link
Collaborator

@pipecd-bot pipecd-bot left a comment

Choose a reason for hiding this comment

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

GO_LINTER

Some issues were detected while linting go source files in your changes.

return err
}
}
err = i.insightstore.PutChunk(ctx, chunk)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ineffectual assignment to err

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.89%. This pull request increases coverage by 0.63%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.Run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 78.95% +78.95%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.00% +96.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go Merge -- 39.29% +39.29%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go AppendDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go findDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go GetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go SetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 100.00% 77.78% -22.22%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate 85.71% 0.00% -85.71%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.84%. This pull request increases coverage by 0.59%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.Run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 78.95% +78.95%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.00% +96.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go Merge -- 39.29% +39.29%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go AppendDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go findDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go GetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go SetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 100.00% 77.78% -22.22%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate 85.71% 0.00% -85.71%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.84%. This pull request increases coverage by 0.59%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.Run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 78.95% +78.95%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.00% +96.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go Merge -- 39.29% +39.29%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go AppendDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go findDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go GetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go SetDataPoint -- 100.00% +100.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 100.00% 77.78% -22.22%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate 85.71% 0.00% -85.71%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@sanposhiho
Copy link
Member Author

@nghialv
Thanks for reviews, fix them all.

@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/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
+}

@sanposhiho
Copy link
Member Author

/golinter fmt

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.23%. This pull request increases coverage by 0.62%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.Run -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateDataPoints -- 76.92% +76.92%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 100.00% +100.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 95.83% +95.83%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go NewChunk -- 0.00% +0.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Merge -- 66.67% +66.67%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Merge -- 0.00% +0.00%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go UpdateDataPoint -- 80.00% +80.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

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.")
Copy link
Member

Choose a reason for hiding this comment

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

nit: "Enable"

}
}()

// Set insight collector
Copy link
Member

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

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.17%. This pull request increases coverage by 0.56%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectProjectsInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectApplicationInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateApplicationChunks -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateDataPoints -- 76.92% +76.92%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 93.75% +93.75%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.15% +96.15%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go NewChunk -- 0.00% +0.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Merge -- 66.67% +66.67%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Merge -- 0.00% +0.00%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go UpdateDataPoint -- 80.00% +80.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

httpPort int
adminPort int
gracePeriod time.Duration
enable bool
Copy link
Member

Choose a reason for hiding this comment

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

nit: enableInsightCollector

Copy link
Member Author

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))
}
Copy link
Member

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?

Copy link
Member Author

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
}
Copy link
Member

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
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, thanks :D

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.17%. This pull request increases coverage by 0.56%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectProjectsInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectApplicationInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateApplicationChunks -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateDataPoints -- 76.92% +76.92%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 93.75% +93.75%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.15% +96.15%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go NewChunk -- 0.00% +0.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Merge -- 66.67% +66.67%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Merge -- 0.00% +0.00%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go UpdateDataPoint -- 80.00% +80.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

break
}

for _, app := range apps {
Copy link
Member

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
}

Copy link
Member Author

Choose a reason for hiding this comment

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

OK 👌 Thanks

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.18%. This pull request increases coverage by 0.57%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectProjectsInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectApplicationInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateApplicationChunks -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateDataPoints -- 76.92% +76.92%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 93.75% +93.75%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.15% +96.15%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go NewChunk -- 0.00% +0.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Merge -- 66.67% +66.67%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Merge -- 0.00% +0.00%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go UpdateDataPoint -- 80.00% +80.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.17%. This pull request increases coverage by 0.56%.

File Function Base Head Diff
pkg/app/ops/insightcollector/collector.go NewInsightCollector -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectProjectsInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.CollectApplicationInsight -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateApplicationChunks -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateChunk -- 0.00% +0.00%
pkg/app/ops/insightcollector/collector.go InsightCollector.updateDataPoints -- 76.92% +76.92%
pkg/app/ops/insightcollector/collector.go InsightCollector.getDailyInsightData -- 93.33% +93.33%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForDeployFrequency -- 93.75% +93.75%
pkg/app/ops/insightcollector/collector.go InsightCollector.getInsightDataForChangeFailureRate -- 96.15% +96.15%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetDataPoints -- 90.00% +90.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetDataPoints -- 60.00% +60.00%
pkg/insightstore/chunk.go NewChunk -- 0.00% +0.00%
pkg/insightstore/chunk.go ToChunk -- 75.00% +75.00%
pkg/insightstore/datapoint.go DeployFrequency.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Value -- 100.00% +100.00%
pkg/insightstore/datapoint.go DeployFrequency.Merge -- 66.67% +66.67%
pkg/insightstore/datapoint.go ChangeFailureRate.GetTimestamp -- 100.00% +100.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Value -- 0.00% +0.00%
pkg/insightstore/datapoint.go ChangeFailureRate.Merge -- 0.00% +0.00%
pkg/insightstore/datapoint.go ToDataPoints -- 90.00% +90.00%
pkg/insightstore/datapoint.go UpdateDataPoint -- 80.00% +80.00%
pkg/insightstore/datapoint.go extractDataPoints -- 87.50% +87.50%
pkg/insightstore/filestore.go NormalizeTime -- 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.GetDataPoints 0.00% 33.33% +33.33%
pkg/insightstore/chunk.go Chunks.ExtractDataPoints 69.23% 68.75% -0.48%
pkg/insightstore/filestore.go NewStore 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.SetAccumulatedTo 0.00% 100.00% +100.00%
pkg/insightstore/chunk.go DeployFrequencyChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go DeployFrequency.GetTimestamp 100.00% -- -100.00%
pkg/insightstore/chunk.go DeployFrequency.Value 100.00% -- -100.00%
pkg/insightstore/chunk.go ChangeFailureRateChunk.DataCount 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.GetTimestamp 0.00% -- +-0.00%
pkg/insightstore/chunk.go ChangeFailureRate.Value 0.00% -- +-0.00%
pkg/insightstore/chunk.go toChunk 75.00% -- -75.00%
pkg/insightstore/chunk.go toDataPoints 50.00% -- -50.00%
pkg/insightstore/chunk.go extractDataPoints 81.82% -- -81.82%
pkg/insightstore/filestore.go normalizeTime 100.00% -- -100.00%

@nghialv
Copy link
Member

nghialv commented Dec 22, 2020

Thank you.
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nghialv.

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.

@pipecd-bot pipecd-bot merged commit abf1bd9 into master Dec 22, 2020
@pipecd-bot pipecd-bot deleted the create-insight-collector branch December 22, 2020 10:27
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