@@ -71,8 +71,8 @@ type skaffoldMeter struct {
71
71
}
72
72
73
73
type devIteration struct {
74
- intent string
75
- errorCode proto.StatusCode
74
+ Intent string
75
+ ErrorCode proto.StatusCode
76
76
}
77
77
78
78
var (
92
92
meteredCommands = util .NewStringSet ()
93
93
doesBuild = util .NewStringSet ()
94
94
doesDeploy = util .NewStringSet ()
95
+ initExporter = initCloudMonitoringExporterMetrics
95
96
isOnline bool
96
97
)
97
98
@@ -113,11 +114,7 @@ func init() {
113
114
func InitMeterFromConfig (config * latest.SkaffoldConfig ) {
114
115
meter .PlatformType = yamltags .GetYamlTag (config .Build .BuildType )
115
116
for _ , artifact := range config .Pipeline .Build .Artifacts {
116
- if _ , ok := meter .Builders [yamltags .GetYamlTag (artifact .ArtifactType )]; ok {
117
- meter .Builders [yamltags .GetYamlTag (artifact .ArtifactType )]++
118
- } else {
119
- meter .Builders [yamltags .GetYamlTag (artifact .ArtifactType )] = 1
120
- }
117
+ meter .Builders [yamltags .GetYamlTag (artifact .ArtifactType )]++
121
118
if artifact .Sync != nil {
122
119
meter .SyncType [yamltags .GetYamlTag (artifact .Sync )] = true
123
120
}
@@ -137,14 +134,14 @@ func SetErrorCode(errorCode proto.StatusCode) {
137
134
}
138
135
139
136
func AddDevIteration (intent string ) {
140
- meter .DevIterations = append (meter .DevIterations , devIteration {intent : intent })
137
+ meter .DevIterations = append (meter .DevIterations , devIteration {Intent : intent })
141
138
}
142
139
143
140
func AddDevIterationErr (i int , errorCode proto.StatusCode ) {
144
141
if len (meter .DevIterations ) == i {
145
- meter .DevIterations = append (meter .DevIterations , devIteration {intent : "error" })
142
+ meter .DevIterations = append (meter .DevIterations , devIteration {Intent : "error" })
146
143
}
147
- meter .DevIterations [i ].errorCode = errorCode
144
+ meter .DevIterations [i ].ErrorCode = errorCode
148
145
}
149
146
150
147
func AddFlag (flag * flag.Flag ) {
@@ -170,7 +167,7 @@ func ExportMetrics(exitCode int) error {
170
167
171
168
func exportMetrics (ctx context.Context , filename string , meter skaffoldMeter ) error {
172
169
logrus .Debug ("exporting metrics" )
173
- p , err := initCloudMonitoringExporterMetrics ()
170
+ p , err := initExporter ()
174
171
if p == nil {
175
172
return err
176
173
}
@@ -297,14 +294,14 @@ func commandMetrics(ctx context.Context, meter skaffoldMeter, m metric.Meter, ra
297
294
counts := make (map [string ]map [proto.StatusCode ]int )
298
295
299
296
for _ , iteration := range meter .DevIterations {
300
- if _ , ok := counts [iteration .intent ]; ! ok {
301
- counts [iteration .intent ] = make (map [proto.StatusCode ]int )
297
+ if _ , ok := counts [iteration .Intent ]; ! ok {
298
+ counts [iteration .Intent ] = make (map [proto.StatusCode ]int )
302
299
}
303
- m := counts [iteration .intent ]
304
- if _ , ok := m [iteration .errorCode ]; ! ok {
305
- m [iteration .errorCode ] = 0
300
+ m := counts [iteration .Intent ]
301
+ if _ , ok := m [iteration .ErrorCode ]; ! ok {
302
+ m [iteration .ErrorCode ] = 0
306
303
}
307
- m [iteration .errorCode ]++
304
+ m [iteration .ErrorCode ]++
308
305
}
309
306
for intention , errorCounts := range counts {
310
307
for errorCode , count := range errorCounts {
0 commit comments