@@ -63,19 +63,19 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
6363
6464 pm := commands .GetPackageManager (req .GetInstance ().GetId ())
6565 if pm == nil {
66- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
66+ stats .Incr ("compile" , stats .M (tags )... )
6767 return nil , errors .New ("invalid instance" )
6868 }
6969
7070 logrus .Tracef ("Compile %s for %s started" , req .GetSketchPath (), req .GetFqbn ())
7171 if req .GetSketchPath () == "" {
72- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
72+ stats .Incr ("compile" , stats .M (tags )... )
7373 return nil , fmt .Errorf ("missing sketchPath" )
7474 }
7575 sketchPath := paths .New (req .GetSketchPath ())
7676 sketch , err := sketches .NewSketchFromPath (sketchPath )
7777 if err != nil {
78- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
78+ stats .Incr ("compile" , stats .M (tags )... )
7979 return nil , fmt .Errorf ("opening sketch: %s" , err )
8080 }
8181
@@ -84,12 +84,12 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
8484 fqbnIn = sketch .Metadata .CPU .Fqbn
8585 }
8686 if fqbnIn == "" {
87- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
87+ stats .Incr ("compile" , stats .M (tags )... )
8888 return nil , fmt .Errorf ("no FQBN provided" )
8989 }
9090 fqbn , err := cores .ParseFQBN (fqbnIn )
9191 if err != nil {
92- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
92+ stats .Incr ("compile" , stats .M (tags )... )
9393 return nil , fmt .Errorf ("incorrect FQBN: %s" , err )
9494 }
9595
@@ -103,7 +103,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
103103 // "\"%[1]s:%[2]s\" platform is not installed, please install it by running \""+
104104 // version.GetAppName()+" core install %[1]s:%[2]s\".", fqbn.Package, fqbn.PlatformArch)
105105 // feedback.Error(errorMessage)
106- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
106+ stats .Incr ("compile" , stats .M (tags )... )
107107 return nil , fmt .Errorf ("platform not installed" )
108108 }
109109
@@ -123,7 +123,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
123123 builderCtx .BuildPath = paths .New (req .GetBuildPath ())
124124 err = builderCtx .BuildPath .MkdirAll ()
125125 if err != nil {
126- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
126+ stats .Incr ("compile" , stats .M (tags )... )
127127 return nil , fmt .Errorf ("cannot create build directory: %s" , err )
128128 }
129129 }
@@ -152,7 +152,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
152152 builderCtx .BuildCachePath = paths .New (req .GetBuildCachePath ())
153153 err = builderCtx .BuildCachePath .MkdirAll ()
154154 if err != nil {
155- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
155+ stats .Incr ("compile" , stats .M (tags )... )
156156 return nil , fmt .Errorf ("cannot create build cache directory: %s" , err )
157157 }
158158 }
@@ -186,17 +186,17 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
186186 // if --preprocess or --show-properties were passed, we can stop here
187187 if req .GetShowProperties () {
188188 tags ["success" ] = "true"
189- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
189+ stats .Incr ("compile" , stats .M (tags )... )
190190 return & rpc.CompileResp {}, builder .RunParseHardwareAndDumpBuildProperties (builderCtx )
191191 } else if req .GetPreprocess () {
192192 tags ["success" ] = "true"
193- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
193+ stats .Incr ("compile" , stats .M (tags )... )
194194 return & rpc.CompileResp {}, builder .RunPreprocess (builderCtx )
195195 }
196196
197197 // if it's a regular build, go on...
198198 if err := builder .RunBuilder (builderCtx ); err != nil {
199- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
199+ stats .Incr ("compile" , stats .M (tags )... )
200200 return nil , err
201201 }
202202
@@ -232,7 +232,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
232232 // Copy "sketch.ino.*.hex" / "sketch.ino.*.bin" artifacts to sketch directory
233233 srcDir , err := outputPath .Parent ().ReadDir () // read "/build/path/*"
234234 if err != nil {
235- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
235+ stats .Incr ("compile" , stats .M (tags )... )
236236 return nil , fmt .Errorf ("reading build directory: %s" , err )
237237 }
238238 srcDir .FilterPrefix (base + "." )
@@ -243,7 +243,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
243243 dstOutput := exportPath .Join (exportFile + srcFilename )
244244 logrus .WithField ("from" , srcOutput ).WithField ("to" , dstOutput ).Debug ("copying sketch build output" )
245245 if err = srcOutput .CopyTo (dstOutput ); err != nil {
246- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
246+ stats .Incr ("compile" , stats .M (tags )... )
247247 return nil , fmt .Errorf ("copying output file: %s" , err )
248248 }
249249 }
@@ -254,13 +254,13 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
254254 dstElf := exportPath .Join (exportFile + ".elf" )
255255 logrus .WithField ("from" , srcElf ).WithField ("to" , dstElf ).Debug ("copying sketch build output" )
256256 if err = srcElf .CopyTo (dstElf ); err != nil {
257- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
257+ stats .Incr ("compile" , stats .M (tags )... )
258258 return nil , fmt .Errorf ("copying elf file: %s" , err )
259259 }
260260 }
261261
262262 logrus .Tracef ("Compile %s for %s successful" , sketch .Name , fqbnIn )
263263 tags ["success" ] = "true"
264- telemetry . Engine .Incr ("compile" , stats .M (tags )... )
264+ stats .Incr ("compile" , stats .M (tags )... )
265265 return & rpc.CompileResp {}, nil
266266}
0 commit comments