Skip to content

Commit

Permalink
feat(run): run logging data list by requester API (#730)
Browse files Browse the repository at this point in the history
Because

- the data that users could see on dashboard are different from what
they can see on Runs page in a single pipeline or model

This commit

- add new run logging API for dashboard


![image](https://github.com/user-attachments/assets/7ff10845-4b99-4a55-a08a-90652ee67454)
  • Loading branch information
joremysh authored Oct 16, 2024
1 parent 4d0afa1 commit e1e844b
Show file tree
Hide file tree
Showing 14 changed files with 688 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/iFaceless/godub v0.0.0-20200728093528-a30bb4d1a0f1
github.com/iancoleman/strcase v0.3.0
github.com/influxdata/influxdb-client-go/v2 v2.12.3
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241007141417-545e5d187408
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a
github.com/instill-ai/x v0.5.0-alpha
github.com/itchyny/gojq v0.12.14
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,8 @@ github.com/influxdata/influxdb-client-go/v2 v2.12.3 h1:28nRlNMRIV4QbtIUvxhWqaxn0
github.com/influxdata/influxdb-client-go/v2 v2.12.3/go.mod h1:IrrLUbCjjfkmRuaCiGQg4m2GbkaeJDcuWoxiWdQEbA0=
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU=
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241007141417-545e5d187408 h1:GTx0g6dXxd7WUm4bvJK1N+j8zuxIaSoXD5AZ2Vl+FXI=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241007141417-545e5d187408/go.mod h1:rf0UY7VpEgpaLudYEcjx5rnbuwlBaaLyD4FQmWLtgAY=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d h1:jf2RQtRFNxnPMkjTD0AAqXDXO8lHYOrWU3Hrr+yGEzY=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20241012090311-e872dc0b511d/go.mod h1:rf0UY7VpEgpaLudYEcjx5rnbuwlBaaLyD4FQmWLtgAY=
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a h1:gmy8BcCFDZQan40c/D3f62DwTYtlCwi0VrSax+pKffw=
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a/go.mod h1:EpX3Yr661uWULtZf5UnJHfr5rw2PDyX8ku4Kx0UtYFw=
github.com/instill-ai/x v0.5.0-alpha h1:xIeIvrLzwJYOBmZwOePVFVkKGEcMDqtHmn1cfVVNlIE=
Expand Down
1 change: 1 addition & 0 deletions pkg/datamodel/runlogging.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (j *JSONB) Scan(value interface{}) error {
type PipelineRun struct {
PipelineTriggerUID uuid.UUID `gorm:"primaryKey" json:"pipeline-trigger-uid"` // Unique identifier for each run
PipelineUID uuid.UUID `gorm:"type:uuid;index" json:"pipeline-uid"` // Pipeline unique ID used in the run
Pipeline Pipeline `gorm:"foreignKey:PipelineUID;references:UID"` // Pipeline instance referenced in the run
PipelineVersion string `gorm:"type:varchar(255)" json:"pipeline-version"` // Pipeline version used in the run
Status RunStatus `gorm:"type:valid_trigger_status;index" json:"status"` // Current status of the run (e.g., Running, Completed, Failed)
Source RunSource `gorm:"type:valid_trigger_source" json:"source"` // Origin of the run (e.g., Web click, API)
Expand Down
17 changes: 17 additions & 0 deletions pkg/handler/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -1994,3 +1994,20 @@ func (h *PublicHandler) ListComponentRuns(ctx context.Context, req *pb.ListCompo

return resp, nil
}

// todo: rename function to ListPipelineRunsByRequester in protobuf and update message names here
func (h *PublicHandler) ListPipelineRunsByCreditOwner(ctx context.Context, req *pb.ListPipelineRunsByCreditOwnerRequest) (*pb.ListPipelineRunsByCreditOwnerResponse, error) {
logger, _ := logger.GetZapLogger(ctx)
logUUID, _ := uuid.NewV4()
logger.Info("ListPipelineRunsByRequester starts", zap.String("logUUID", logUUID.String()))

resp, err := h.service.ListPipelineRunsByRequester(ctx, req)
if err != nil {
logger.Error("failed in ListPipelineRunsByRequester", zap.String("logUUID", logUUID.String()), zap.Error(err))
return nil, status.Error(codes.Internal, "Failed to list pipeline runs")
}

logger.Info("ListPipelineRunsByRequester finished", zap.String("logUUID", logUUID.String()))

return resp, nil
}
2 changes: 2 additions & 0 deletions pkg/mock/acl_client_interface_mock.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/mock/converter_mock.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions pkg/mock/mgmt_private_service_client_mock.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pkg/mock/minio_i_mock.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e1e844b

Please sign in to comment.