-
Notifications
You must be signed in to change notification settings - Fork 254
Build metrics #2104
Build metrics #2104
Conversation
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
af82c55 to
a33a718
Compare
0039c73 to
8758a65
Compare
|
Putting in draft. I will add additional tests in the |
8758a65 to
3c99253
Compare
3c99253 to
9c9d3e0
Compare
a92acaf to
4517b2a
Compare
|
Sorry I didn't comment in earlier on this ; adding what we just discussed on zoom with @crazy-max Or we need to set another specific metrics field and also separate metrics based on that field in pinata (more bucketting than just based on status, context, cmd) |
|
@gtardif Thanks for your feedback! Using the existing |
4517b2a to
6c20a48
Compare
|
Removed {"command":"build","context":"moby","source":"cli-docker;buildkit","status":"success"}
{"command":"buildx build","context":"moby","source":"cli-buildx;docker-container","status":"success"}
{"command":"buildx --builder build","context":"moby","source":"cli-buildx;docker-container","status":"success"} |
Signed-off-by: CrazyMax <[email protected]>
6c20a48 to
535fb93
Compare
This PR handles metrics for build commands. It also adds a new field
Metadatato theCommandstruct for extensibility. It could be used for other commands in the future.Detecting build backend used by buildx is a bit tedious in the current release because no formatter is available to handle a proper output with
buildx ls. Thelscommand locks the buildx store and that can take some time (top 20s) to complete because it needs to check the liveliness of the nodes so user cannot use buildx during this time (docker/buildx#764). That will cause some bad user experience if we rely on this command for metrics. I opened a pull request to start make things easier for us in the future (docker/buildx#830).So for our purpose we directly read from the store without using an actual command which is more effective:
The step above is valid only if user doesn't provide the
--builderflag to the build command (orBUILDX_BUILDERenv var). If the builder is provided, we only have to read from the store in~/.docker/buildx/instances/<builder>.For the
docker buildcommand it's easier. We just need to read the cli config and checkDOCKER_BUILDKITenv var as well as daemon config:{ "features": { "buildkit": true } }There is also a special case if a builder alias is being used:
The following metadata will be send along the command:
{ "build": { "cli": "docker | buildx | <alias>", "builder": "legacy | buildkit | <driver>" } }build.cli.docker: user typedocker build ....build.cli.buildx: user typedocker buildx build ...ordocker buildx bake ....build.cli.<alias>: user typedocker build ...but an alias is used in~/.docker/config.jsonso set this one instead.build.builder.legacy: legacy builder is used withdocker buildcommand.build.server.buildkit: backend buildkit builder is used withdocker buildcommand.build.server.<driver>: a driver is used (can bedocker,docker-containerorkubernetesatm). Only for buildx.Metrics commands have also been regenerated and sorted in separate commits.
cc @chris-crone @tonistiigi @mat007 @gtardif