@@ -11,33 +11,29 @@ import (
11
11
"github.com/sirupsen/logrus"
12
12
)
13
13
14
- func NewBuildReportHandler (cfg aws. Config ) * BuildReportHandler {
14
+ func NewBuildReportHandler (store SampleStorageFunc ) * BuildReportHandler {
15
15
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 ,
21
17
}
22
18
return hdlr
23
19
}
24
20
25
21
type BuildReportHandler struct {
26
22
Config aws.Config
27
- storeSample func ( ctx context. Context , sample PackageSample ) error
23
+ storeSample SampleStorageFunc
28
24
29
25
v1connect.UnimplementedReporterServiceHandler
30
26
}
31
27
32
28
// BuildFinished implements v1connect.ReporterServiceHandler
33
29
func (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" )
35
31
return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
36
32
}
37
33
38
34
// BuildStarted implements v1connect.ReporterServiceHandler
39
35
func (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" )
41
37
return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
42
38
}
43
39
@@ -56,25 +52,26 @@ func (handler *BuildReportHandler) PackageBuildFinished(ctx context.Context, req
56
52
Time : time .Now (),
57
53
Status : status ,
58
54
DirtyWorkingCopy : req .Msg .Package .DirtyWorkingCopy ,
55
+ Type : req .Msg .Package .Type ,
59
56
}
60
57
err := handler .storeSample (ctx , sample )
61
58
if err != nil {
62
59
return nil , err
63
60
}
64
61
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" )
66
63
return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
67
64
}
68
65
69
66
// PackageBuildLog implements v1connect.ReporterServiceHandler
70
67
func (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" )
72
69
return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
73
70
}
74
71
75
72
// PackageBuildStarted implements v1connect.ReporterServiceHandler
76
73
func (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" )
78
75
return & connect_go.Response [v1.EmptyResponse ]{Msg : & v1.EmptyResponse {}}, nil
79
76
}
80
77
0 commit comments