Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Improve debug output #58467

Merged
merged 1 commit into from
Feb 26, 2020
Merged

Conversation

sorenlouv
Copy link
Member

  • Ensure that ES query can easily be copy/pasted into Dev Tools
  • Improve readability with formatting 🎨
  • Add debugging to all ES endpoints (not just search!)

Highlight errors

Debugging for non-search requests
image

@sorenlouv sorenlouv requested a review from a team as a code owner February 25, 2020 12:59
@sorenlouv sorenlouv added release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support labels Feb 25, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

This works great and looks very nice.

I think we should be using the built-in logger provided on the server context instead of console.log.

@sorenlouv
Copy link
Member Author

I think we should be using the built-in logger provided on the server context instead of console.log.

I agree. I think we use console.log a bunch of places where we should be using context.logger.info.
In this cause I think we should do an exception though. The built-in logger will append a bunch of information, which will make the output a lot less clean and much harder to copy/paste:

image

@smith
Copy link
Contributor

smith commented Feb 25, 2020

In this cause I think we should do an exception though. The built-in logger will append a bunch of information, which will make the output a lot less clean and much harder to copy/paste

I agree that it's easier to copy/paste, but I disagree that we should make an exception, unless there's agreement from the platform team.

Most terminals also support rectangular selection. In VSCode's I can hold option.

@sorenlouv
Copy link
Member Author

Most terminals also support rectangular selection. In VSCode's I can hold option.

How will that help in the above case where it's not a rectangle?

I disagree that we should make an exception, unless there's agreement from the platform team.

I agree it makes sense for actual logging to use the official logger. But in this case we don't care about logging as such - we want to output something to stdout for debugging purposes.

@dgieselaar
Copy link
Member

I'll +1 the current approach, given that this is a debugging feature not intended for users, and is explicitly opt-in, I can't quite see the benefit of using the platform logger, and there are clear cons (AFAICT).

@smith
Copy link
Contributor

smith commented Feb 25, 2020

I agree it makes sense for actual logging to use the official logger. But in this case we don't care about logging as such - we want to output something to stdout for debugging purposes.

I still disagree, but not strongly enough to block merging this.

@sorenlouv
Copy link
Member Author

@dgieselaar and I had a discussion earlier whether we should send the debug info to the client. This would make it much easier for users who don't have access to Kibana logs - but could also pose security threats.

@smith WDYT about that idea?

@smith
Copy link
Contributor

smith commented Feb 25, 2020

@smith WDYT about that idea?

I like it, since half the time I turn the debug mode on and am confused when there's nothing in my devtools console. As long as it doesn't make the code too complicated. I'd rather have the hassle of having to look in kibana logs than adding unneeded complexity to our code base.

@sorenlouv sorenlouv merged commit 0e0f114 into elastic:master Feb 26, 2020
@sorenlouv sorenlouv deleted the improve-debug-output branch February 26, 2020 06:40
@sorenlouv
Copy link
Member Author

Okay, I'm merging this now, and then we can look into sending it to the client in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants