Loading
Commits on Source 13
-
Igor authored
gitlab-runner consumes docker-machine's stdout and stderr line by line and re-logs each line as an opaque message. With JSON output it can pick up the level and, in a following change, the create phase a line belongs to. The format is selected by --log-format or MACHINE_LOG_FORMAT and applied before cli parsing, like --debug, so the version line logged before app.Run uses the right format too. Driver plugin processes return from main before that point and keep text output, which the main process relays through its own logger.
-
Igor authored
Machine creation is one docker-machine invocation covering pre-create checks, the driver's create call, waiting for the instance to run, waiting for SSH, OS detection, provisioning, and the Docker connection check. Nothing in the output said which of those a given line, or a given stretch of wall clock time, belonged to; during INC-13960 that breakdown had to be reconstructed by hand from log timestamps. log.SetPhase marks the phase; every entry logged afterwards, including relayed driver plugin output, carries it as "phase" in JSON output. The text format ignores it. No durations are computed here: each entry has a timestamp and the phase changes on the first line of the next one, so consumers get durations by diffing, including for a phase that never finished because the process was killed.
-
Igor authored
Global logger state was the wrong tool: a field belongs to the line it describes. log.WithField/WithFields return a logger that attaches the fields to its entries; the JSON format emits them as keys, the text format appends them as "key=value" so nothing is lost when running by hand. The phase now sits on the first line of each create phase only. The variable parts of the create-path messages (provisioner, region, machine type, zone, operation name, attempt counters) move from the message text into fields so they can be filtered on directly.
-
Igor authored
maps.Copy for field merging, slices.Sorted(maps.Keys()) for the text format's key order, and any instead of interface{} throughout the package so the new code and the existing signatures match. -
Igor authored
Certificate bootstrap ran before the first phase line, so its time (about 1.5s per create in the sandbox) was in the total but in no phase. BootstrapCertificates only logs when it has to generate certs, hence the explicit line.
-
Igor authored
It only existed so SetDebug before SetFormat would carry over, and nothing calls them in that order.
-
Igor authored
Drivers run as a re-exec of this binary, which returned from main before the log format was applied, so their output was text and the parent relayed it as "(name) message". In JSON mode the zone and machine type the driver logs as fields ended up inside the message string. The parent now passes its format to the plugin through MACHINE_LOG_FORMAT, the plugin applies it, and the relay parses JSON lines and re-logs them with their fields plus a "machine" field. Text mode and non-JSON lines keep the prefix form. History entries now include fields, rendered as key=value, so the crash report keeps the data that moved out of message text.
-
Igor authored
The log package has no business knowing about MACHINE_LOG_FORMAT. The parent/plugin handshake already uses MACHINE_PLUGIN_* variables declared in localbinary; the format is one more of those.
-
Igor authored
History mirrors output in both formats instead of flattening JSON entries to key=value text.
-
Igor authored
fmt.Sprint is what history always used for these calls, and the key=value rendering has one caller.
-
Igor authored
-
Igor authored
Add JSON log format and create phase tagging See merge request !193 Merged-by:
Igor <iwiedler@gitlab.com>
Approved-by: Tomasz Maczukin <tomasz@maczukin.pl> Reviewed-by:
Tomasz Maczukin <tomasz@maczukin.pl> Reviewed-by:
GitLab Duo <gitlab-duo@gitlab.com>
-
Igor authored