Skip to content

Conversation

MattAlp
Copy link

@MattAlp MattAlp commented Oct 17, 2025

Prints output of all telemetry signals (logs, metrics, traces) nicely with colour in the terminal. Beats having to pipe everything into jq solely for readability.

@MattAlp MattAlp requested a review from a team as a code owner October 17, 2025 21:05
@MattAlp MattAlp requested review from mosche and removed request for a team October 17, 2025 21:06
@elasticsearchmachine elasticsearchmachine added v9.3.0 needs:triage Requires assignment of a team area label labels Oct 17, 2025
@prdoyle prdoyle added >non-issue :Core/Infra/Core Core issues without another label >test Issues or PRs that are addressing/adding tests and removed >enhancement >non-issue labels Oct 17, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Oct 17, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Oct 17, 2025
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all outputs will support ANSI escape sequences, but I don't see anything which checks for that. In particular, this will mean you cannot simply take the raw output and process it with jq or jless any more. I expect it'll make it much harder to read logs captured in build scans too. Could you check we're logging to a terminal before enabling this?

@MattAlp
Copy link
Author

MattAlp commented Oct 20, 2025

I don't believe this is used for anything other than local sanity-testing / debugging telemetry emitted by ES during the dev cycle. It also explicitly does not get "logged", using Gradle's logging directly to print alongside the logging captured via ./gradlew run.

Previously, you'd have to grep ^{ | jq or something along those lines in order to catch the events and make them readable. However, making this opt-in and/or checking for terminal compatibility is a good idea.

@rjernst
Copy link
Member

rjernst commented Oct 20, 2025

@MattAlp I think the point is the output might not being going to a terminal, it could be redirected to a file, as in ./gradlew run --witih-apm-server &> myrunlog.txt and searched later.

Unfortunately the JDK made this a little more difficult to detect starting in JDK 22. It used to be that System.console() == null was enough to detect a terminal, but with JDK 22+ System.console() always returns non-null. There is a method, Console.isTerminal(), but that's only available in JDK 22+. You can see logic for reflective logic to figure this out in Terminal.ConsoleTerminal.detectTerminal().

@MattAlp
Copy link
Author

MattAlp commented Oct 20, 2025

After speaking with David, it actually sounds like we don't want to rely on the mock server anyways & would prefer to have test-driven checks for tracing. I may re-open this PR later depending on the timeline to getting that functionality in.

@MattAlp MattAlp closed this Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team >test Issues or PRs that are addressing/adding tests v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants