1
0
mirror of https://github.com/docker/compose-cli.git synced 2026-10-25 06:19:18 +03:00

74 Commits

Author SHA1 Message Date
Milas Bowman
784377898f metrics: track and report non-aggregated events
Currently, "usage" reports are sent, which are aggregated.
Add "event" variant, which won't be aggregated.

For compatibility, the "usage" events remain and nothing has
changed in terms of how they parse the command args, for example.
This will ensure continued functioning of anything that relies
on these metrics.

For the "event" variants, the CLI parsing is slightly different
in an attempt to improve data analysis capabilities while still
being respectful of user privacy (i.e. only known values of Docker
CLI commands/flags are ever recorded). Additionally, execution
duration information is now reported with these events.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-08 14:17:04 -05:00
Milas Bowman
e7d8d05d99 metrics: initial logic for command execution duration
Add a timer around command invocations to be reported with metrics.
This isn't actually sent anywhere currently, as it's meant for
evented data which is forthcoming. (We could report it with the
current events, but it's not clear that there's any value in doing
so.)

The signature for `Track()` has been changed to take an object with
all the fields. This is both for sanity to keep the method from
getting ridiculously long, and to make it easier to unify the usage
(heartbeat) and event code paths by ensuring we have all the data
for both.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-06 17:08:27 -05:00
Milas Bowman
16482c0611 metrics: move helper code from Compose
Compose doesn't actually currently use this code, it's only used
here. Moving it inline so that we can drop it from Compose in the
future or make changes as needed without worrying about this as a
dependency.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-06 16:50:29 -05:00
Milas Bowman
3f6822e196 metrics: add debug implementation
Refactor the metrics client slightly to add the concept of a
"reporter" that actually sends the metrics.

The primary implementation is HTTP-based as before, but a key
difference now is that there's another variant that writes to
a file for simplified debugging. This is activated by setting
the `DOCKER_METRICS_DEBUG_LOG` environment variable to a file
path to write events to as JSON lines.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-02 09:20:32 -05:00
Milas Bowman
020489241f lint: update for Go 1.19 / golangci-lint 1.50.1
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-01 16:04:49 -05:00
Sebastiaan van Stijn
f1aa070b81 cli/mobycli: Exec(): simplify output
The command now was showing 2 informational messages (about PAT and
Scan); the scan one had been there for a while so most users will
know about it by now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-06 21:48:43 +01:00
CrazyMax
668b262605 build metrics compatibility for next 22.06
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-07-27 17:03:03 +02:00
Nick Sieger
4678a3e780 mobycli: add test for comDockerCli
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-27 09:07:27 -05:00
Nick Sieger
22d68602ae mobycli: append .exe to com.docker.cli on windows
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-27 09:00:11 -05:00
Nick Sieger
fc215287b5 mobycli: update approach for finding cli command to use
1. Use path from env variable `$DOCKER_COM_DOCKER_CLI`
2. Use path formed from parent directory of current process joined with
   `com.docker.cli`
3. Look for `com.docker.cli` on $PATH

Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-26 15:12:11 -05:00
Nick Sieger
d8b9310e03 Merge commit '48c999679165e8f0355f32092063ab4f0ceeee42' of https://github.com/crazy-max/compose-cli into cli-binary-path-handling
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-07-26 14:54:13 -05:00
Guillaume Lours
1a01d2f198 update gotest.tools to v3.3.0 which support golang 1.18
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-07-25 12:20:42 +02:00
CrazyMax
1dce98712a Go 1.18
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-07-24 00:49:08 +02:00
CrazyMax
48c9996791 Allow to override classic cli binary via env var
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-31 07:25:16 +02:00
Mathieu Champlon
48ad1486ac Revert "signals"
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-11-04 17:14:28 +01:00
Mathieu Champlon
8b76602054 Merge pull request #1879 from ndeloof/signals
signals
2021-09-21 12:09:52 +02:00
Nicolas De Loof
bd5def8454 use docker/compose/v2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-08-31 19:19:32 +02:00
Mathieu Champlon
f09336e519 Merge pull request #1953 from amineck/no_pass
Post-login msg: Ignore if password is empty
2021-07-28 07:46:17 +02:00
Amine Chouki
3f59e9a3ad Ignore if password is empty
Signed-off-by: Amine Chouki <amine.chouki@docker.com>
2021-07-26 10:37:58 -04:00
Amine Chouki
33454c6ebd Update personal access token url
Signed-off-by: Amine Chouki <amine.chouki@docker.com>
2021-07-26 10:33:57 -04:00
Amine Chouki
5c427ef702 Move pat_suggest.go into cli package
Signed-off-by: Amine Chouki <amine.chouki@docker.com>
2021-07-23 10:55:31 -04:00
Amine Chouki
906e1b4305 Add a post-login message to promote personal access tokens
Signed-off-by: Amine Chouki <amine.chouki@docker.com>
2021-07-22 16:58:00 -04:00
Nicolas De Loof
9215d68428 signals
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-07-13 10:02:48 +02:00
Mathieu Champlon
313de1de4a Look for docker cli next to the current executable
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-06-22 10:39:04 +02:00
Nicolas De Loof
49e7f2d45d Move compose v2 implementation under pkg/compose with dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-06-15 15:52:48 +02:00
Sebastiaan van Stijn
b4c8a9dc5f mobycli: ignore SIGURG on Linux and Darwin
Equivalent of fff164c22e
and cedaf44ea2

In go1.14+, SIGURG is used by the runtime to handle preemtable system calls.
In practice this signal is caught *frequently*.

For reference:

https://go.googlesource.com/proposal/+/master/design/24543-non-cooperative-preemption.md
golang/go#37942

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-07 12:44:55 +02:00
Guillaume Tardif
0496f29a53 Display PATH when not finding com.docker.cli, to help debugging
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-05-03 14:55:41 +02:00
Nicolas De Loof
db38d1244c Retrieve compose failure category by exit code
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-04-22 18:01:28 +02:00
Nicolas De loof
0b968395dd Merge pull request #1516 from docker/version_json
don't include stderr in moby exec output
2021-04-13 15:43:27 +02:00
Nicolas De Loof
4916b36b99 don't include stderr in moby exec output
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-04-13 15:35:26 +02:00
Chris Crone
411612ed8d Fix scan message with quiet flag
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2021-04-13 14:30:27 +02:00
Guillaume Tardif
6a0269f7b9 Merge pull request #1483 from docker/windows_sucks
make windows "kill children process" code simpler
2021-04-07 10:55:22 +02:00
Guillaume Tardif
6465bfec82 track cancel exit code from docker cli shellout to report correct status in metrics
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-04-06 10:19:27 +02:00
Nicolas De Loof
a691cc98e7 make windows "kill children process" code simpler
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-03-31 15:24:50 +02:00
Guillaume Tardif
2b1158f4c2 Adapt cli/mobycli to avoid duplicating shellout code
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-03-30 13:45:05 +02:00
Guillaume Tardif
435a51f9e4 Add scan message after docker build, add e2e tests
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-03-29 19:12:06 +02:00
Nicolas De Loof
48402585fd replace passing parameters by context with singletons
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-03-12 15:28:17 +01:00
Guillaume Tardif
0ea97920c1 Move Context & context/store => api/context & api/context/store
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 16:31:59 +01:00
Guillaume Tardif
65f53dff43 move metrics => cli
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 15:26:35 +01:00
Guillaume Tardif
f55823b70f Make Moby command detection (based on help output) more robust. It seems some tabs have been replaced by spaces in CLI 20.10. Covered with e2e test TestUnsupportedCommand.
We need to install docker CLI ourselves in Github actions nodes.

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-15 12:32:13 +01:00
Guillaume Tardif
66a1263342 No specific case for windows, always resolve binary name before executing command
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-11-05 17:38:03 +01:00
Guillaume Tardif
41a1553dab No specific case for windows, always resolve binary name before executing command
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-11-05 17:31:26 +01:00
Guillaume Tardif
3936826673 Keep original license in windows lp_windows.go
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-11-05 17:12:03 +01:00
guillaume.tardif
4489f39e5d duplicate windows os/exec.LookPath() and do not resolve files in current working dir if CWD is not explicitly in PATH.
Signed-off-by: guillaume.tardif <guillaume.tardif@gmail.com>
2020-11-05 16:43:17 +01:00
Guillaume Tardif
0d3f7186c5 Hardcoded list of commands and simplified metrics gathering.
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-10-08 11:59:12 +02:00
Ulysses Souza
8961805412 Add json output format to several commands
- docker context ls
- docker ps
- docker compose ls
- docker compose ps
- docker secret ls
- docker volume ls
- docker version

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-10-01 15:41:18 +02:00
Guillaume Tardif
8302266212 In metrics, send context type, not context name (metrics for Moby calls)
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-09-23 16:12:09 +02:00
Chris Crone
d154c41586 Update copyright
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-09-22 12:13:00 +02:00
Guillaume Tardif
a71b2a39bd Add status field in API metrics
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-09-18 15:22:34 +02:00
Guillaume Tardif
3ccc603461 Add status field in CLI metrics : success, failure, cancelled
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
2020-09-18 10:47:50 +02:00