Blackfire CLI client offers the possibility to output the profile data in JSON, using the
blackfire curl --json https://localhost/foo/bar
When using this option, both
STDERR are leveraged:
JSON formatted output is displayed on STDOUT
Regular output (e.g. progress, summary, profile URL)
Issue with Docker Compose
Docker Compose has a long-standing known issue with
STDERR. Long story short, it mixes both outputs up, which leads to JSON parse errors, since the output then contains regular unformatted text along with JSON formatted data.
For example, using jq on the output can lead to the following error:
$ docker-compose exec bf blackfire curl --json https://localhost/foo/bar | jq
parse error: Invalid numeric literal
This is due to the Docker pseudo TTY which is allocated by default.
To workaround this issue, you need to disable the pseudo TTY with docker-compose
$ docker-compose exec -T bf blackfire curl --json https://localhost/foo/bar