@@ -11,33 +11,29 @@ import (
1111 "github.com/sirupsen/logrus"
1212)
1313
14- func NewBuildReportHandler (cfg aws. Config ) * BuildReportHandler {
14+ func NewBuildReportHandler (store SampleStorageFunc ) * BuildReportHandler {
1515 hdlr := & BuildReportHandler {
16- Config : cfg ,
17- storeSample : func (ctx context.Context , sample PackageSample ) error {
18- logrus .WithField ("sample" , sample ).Info ("package sample" )
19- return nil
20- },
16+ storeSample : store ,
2117 }
2218 return hdlr
2319}
2420
2521type BuildReportHandler struct {
2622 Config aws.Config
27- storeSample func ( ctx context. Context , sample PackageSample ) error
23+ storeSample SampleStorageFunc
2824
2925 v1connect.UnimplementedReporterServiceHandler
3026}
3127
3228// BuildFinished implements v1connect.ReporterServiceHandler
3329func (handler * BuildReportHandler ) BuildFinished (ctx context.Context , req * connect_go.Request [v1.BuildFinishedRequest ]) (* connect_go.Response [v1.EmptyResponse ], error ) {
34- logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).Info ("BuildFinished" )
30+ logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).Debug ("BuildFinished" )
3531 return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
3632}
3733
3834// BuildStarted implements v1connect.ReporterServiceHandler
3935func (handler * BuildReportHandler ) BuildStarted (ctx context.Context , req * connect_go.Request [v1.BuildStartedRequest ]) (* connect_go.Response [v1.EmptyResponse ], error ) {
40- logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("status" , req .Msg .Status ).Info ("BuildStarted" )
36+ logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("status" , req .Msg .Status ).Debug ("BuildStarted" )
4137 return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
4238}
4339
@@ -56,25 +52,26 @@ func (handler *BuildReportHandler) PackageBuildFinished(ctx context.Context, req
5652 Time : time .Now (),
5753 Status : status ,
5854 DirtyWorkingCopy : req .Msg .Package .DirtyWorkingCopy ,
55+ Type : req .Msg .Package .Type ,
5956 }
6057 err := handler .storeSample (ctx , sample )
6158 if err != nil {
6259 return nil , err
6360 }
6461
65- logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("dur" , req .Msg .DurationMs ).WithField ("success" , req .Msg .Error == "" ).Info ("PackageBuildFinished" )
62+ logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("dur" , req .Msg .DurationMs ).WithField ("success" , req .Msg .Error == "" ).Debug ("PackageBuildFinished" )
6663 return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
6764}
6865
6966// PackageBuildLog implements v1connect.ReporterServiceHandler
7067func (handler * BuildReportHandler ) PackageBuildLog (ctx context.Context , req * connect_go.Request [v1.PackageBuildLogRequest ]) (* connect_go.Response [v1.EmptyResponse ], error ) {
71- logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .PackageName ).Info ("PackageBuildLog" )
68+ logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .PackageName ).Debug ("PackageBuildLog" )
7269 return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
7370}
7471
7572// PackageBuildStarted implements v1connect.ReporterServiceHandler
7673func (handler * BuildReportHandler ) PackageBuildStarted (ctx context.Context , req * connect_go.Request [v1.PackageBuildStartedRequest ]) (* connect_go.Response [v1.EmptyResponse ], error ) {
77- logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("dirtyWorkingCopy" , req .Msg .Package .DirtyWorkingCopy ).Info ("PackageBuildStarted" )
74+ logrus .WithField ("session" , req .Msg .SessionId ).WithField ("pkg" , req .Msg .Package .Name ).WithField ("dirtyWorkingCopy" , req .Msg .Package .DirtyWorkingCopy ).Debug ("PackageBuildStarted" )
7875 return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
7976}
8077
0 commit comments