-
Notifications
You must be signed in to change notification settings - Fork 205
Add a definition of function for the deployment frequency graph #1179
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
Add a definition of function for the deployment frequency graph #1179
Conversation
|
The commit message (as well as the PR title) should start with an uppercase letter like "Add application...". |
a603228 to
174d9a8
Compare
|
|
||
| message GetApplicationDeploymentFrequencyRequest { | ||
| string application_id = 1 [(validate.rules).string.min_len = 1]; | ||
| repeated int64 dates = 2; |
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.
@sanposhiho If we want to fetch for a week data, how we use this parameter?
[startDate, endDate] or [date1, date2, date3, ..., date7] ?
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.
[date1, date2, date3, ..., date7], so that we may want to add filter for dates(not including holidays in the graph, etc.) later.
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.
(not including holidays in the graph, etc.)
Agree with you 👍
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.
pkg/app/api/grpcapi/web_api.go
Outdated
| }, nil | ||
| } | ||
|
|
||
| func (a *WebAPI) GetApplicationDeploymentFrequency(ctx context.Context, req *webservice.GetApplicationDeploymentFrequencyRequest) (*webservice.GetApplicationDeploymentFrequencyResponse, error) { |
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.
ctx is unused in GetApplicationDeploymentFrequency
pkg/app/api/grpcapi/web_api.go
Outdated
| }, nil | ||
| } | ||
|
|
||
| func (a *WebAPI) GetApplicationDeploymentFrequency(ctx context.Context, req *webservice.GetApplicationDeploymentFrequencyRequest) (*webservice.GetApplicationDeploymentFrequencyResponse, error) { |
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.
req is unused in GetApplicationDeploymentFrequency
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.
pkg/app/api/grpcapi/web_api.go
Outdated
| }, nil | ||
| } | ||
|
|
||
| // [WIP] Made a temporary implementation to satisfy interface |
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.
comment on exported method WebAPI.GetApplicationDeploymentFrequency should be of the form "GetApplicationDeploymentFrequency ..."
|
Code coverage for golang is
|
|
Code coverage for golang is
|
| message GetApplicationDeploymentFrequencyResponse { | ||
| // key: date, value: deployment_count_of_the_day | ||
| map<int64, int64> deployment_counts = 1; | ||
| } |
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 can abstract the models/definitions around this Insights functionality.
First of all, a graph can be considered as a series of data points.
So maybe only one rpc to retrieve the graph data is enough.
The web client sends a request that includes:
- metrics_kind: what kind of metrics should be returned (deployment frequency, change failure rate, MTTR...)
- step: the time unit (daily, weekly, monthly, yearly)
- range: from when to when
- filters: e.g. application id...
and the response will contain either a list of data points or an error.
Here are suggestions:
- inside the model package
message InsightDataPoint {
int64 timestamp
float value
}
enum InsightMetricsKind {
DEPLOYMENT_FREQUENCY
CHANGE_FAILURE_RATE
...
}
enum InsightStep {
DAILY
WEEKLY
...
}
- inside the service package
rpc GetInsightData()...
message GetInsightDataRequest{
InsightMetricsKind metrics_kind;
...
}
message GetInsightDataResponse {
int64 updated_at;
repeated InsightDataPoint data_points;
}
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.
Looks good. Some metrics kind may not be able to be represented by only timestamp and value alone, but then let's reconsider it at that time.
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.
Good :)
fixed like above.
pkg/app/api/grpcapi/web_api.go
Outdated
| } | ||
|
|
||
| // GetApplicationDeploymentFrequency [WIP] Made a temporary implementation to satisfy interface | ||
| func (a *WebAPI) GetApplicationDeploymentFrequency(ctx context.Context, req *webservice.GetApplicationDeploymentFrequencyRequest) (*webservice.GetApplicationDeploymentFrequencyResponse, error) { |
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.
With _, can be a clear indication of what not to use in a function.
| func (a *WebAPI) GetApplicationDeploymentFrequency(ctx context.Context, req *webservice.GetApplicationDeploymentFrequencyRequest) (*webservice.GetApplicationDeploymentFrequencyResponse, error) { | |
| func (a *WebAPI) GetApplicationDeploymentFrequency(_ context.Context, _ *webservice.GetApplicationDeploymentFrequencyRequest) (*webservice.GetApplicationDeploymentFrequencyResponse, error) { |
|
Code coverage for golang is
|
| repeated model.APIKey keys = 1; | ||
| } | ||
|
|
||
| message GetApplicationDeploymentFrequencyRequest { |
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.
Still is it needed? I feel like all operations can be done via GetInsightDataRequest.
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.
Oh, I forgot removing 👍
Co-authored-by: Ryo Nakao <[email protected]>
|
Code coverage for golang is
|
|
/lgtm |
pkg/model/insight.proto
Outdated
| enum InsightStep { | ||
| DAILY = 0; | ||
| WEEKLY = 1; | ||
| YEARLY = 2; |
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.
Missing the MONTHLY
pkg/model/insight.proto
Outdated
| option go_package = "github.com/pipe-cd/pipe/pkg/model"; | ||
|
|
||
| message InsightDataPoint { | ||
| int64 timestamp = 1; |
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.
Please add the validation for this field.
| message GetInsightDataResponse { | ||
| int64 updated_at = 1; | ||
| repeated pipe.model.InsightDataPoint data_points = 2; | ||
| } |
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.
Please add an empty line at the end of the file.
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.
Do we have lint for this kind of problem? Missing line at the end of the file is a regular issue. 👀
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.
We were talking about that adding a Kapetanios plugin to perform the linter for protobuf before, but still not addressed it...
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 see, thanks 🙆♂️
| pipe.model.InsightStep insight_step = 3; | ||
| int64 first_date = 4; | ||
| int64 last_date = 5; | ||
| } |
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.
Please add the validation for those fields.
| // GetInsightData [WIP] Made a temporary implementation to satisfy interface | ||
| func (a *WebAPI) GetInsightData(_ context.Context, _ *webservice.GetInsightDataRequest) (*webservice.GetInsightDataResponse, error) { | ||
| return nil, nil | ||
| } |
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:
// GetInsightData returns the accumulated insight data.
func (a *WebAPI) GetInsightData(_ context.Context, _ *webservice.GetInsightDataRequest) (*webservice.GetInsightDataResponse, error) {
return nil, status.Error(codes. Unimplemented, "")
}
| message GetInsightDataRequest { | ||
| string application_id = 1 [(validate.rules).string.min_len = 1]; | ||
| pipe.model.InsightMetricsKind metrics_kind = 2; | ||
| pipe.model.InsightStep insight_step = 3; |
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: I think "step" is fine. We are also using "metrics_kind" instead of "insight_metrics_kind"
| pipe.model.InsightMetricsKind metrics_kind = 2; | ||
| pipe.model.InsightStep insight_step = 3; | ||
| int64 first_date = 4; | ||
| int64 last_date = 5; |
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.
These are the Unix times so, range_from, and range_to looks good.
| pipe.model.InsightStep insight_step = 3; | ||
| int64 first_date = 4; | ||
| int64 last_date = 5; | ||
| } |
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.
Can we reorder the fields by their stability/importance. I mean the metrics_kind must be required so it should at the top.
metrics_kind
step
range_from
range_to
application_id
| } | ||
|
|
||
| message GetInsightDataRequest { | ||
| string application_id = 1 [(validate.rules).string.min_len = 1]; |
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 the application id is optional.
If it was specified we find the data for only the specified one.
If it was empty, we find the data for the whole project.
|
@sanposhiho Thank you. I have just left some comments. |
…b.com:pipe-cd/pipe into create-application-deployment-frequency-proto
|
@nghialv Fix:
|
|
Nice. Thank you. |
What this PR does / why we need it:
Add a definition of function to pass data to plot the deployment frequency graph
Which issue(s) this PR fixes:
ref: #1142
Does this PR introduce a user-facing change?: