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

feat(cwl): Add LiveTail StatusBarItems #5894

Closed
wants to merge 0 commits into from

Conversation

keeganirby
Copy link
Contributor

Problem

As LiveTail session is running, we want to display to the user metadata about their session.

Solution

While a livetail session is the active editor, in the bottom status bar, we will display the duration the session has been running for, how many events per/s, and if the log data is being sampled or not.


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@keeganirby keeganirby requested a review from a team as a code owner October 29, 2024 19:20
Copy link

This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions.

Copy link
Contributor

@jpinkney-aws jpinkney-aws left a comment

Choose a reason for hiding this comment

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

Has this idea been floated by @jparkhurst3 ? I think we already have 2+ status bar items and this adds 2 more to that

@keeganirby
Copy link
Contributor Author

Has this idea been floated by @jparkhurst3 ? I think we already have 2+ status bar items and this adds 2 more to that

Started thread offline

Comment on lines 100 to 102
} catch (err) {
globals.clock.clearInterval(timer)
throw err
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (err) {
globals.clock.clearInterval(timer)
throw err
} finally {
globals.clock.clearInterval(timer)

@@ -162,12 +220,13 @@ function trimOldestLines(
function registerTabChangeCallback(
session: LiveTailSession,
registry: LiveTailSessionRegistry,
document: vscode.TextDocument
document: vscode.TextDocument,
timer: NodeJS.Timer
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check if our Timeout module is useful?

It supports cancellations and other features, so mentioning it in case your needs expand later.

Comment on lines 194 to 197
if (editor?.document === document) {
session.showStatusBarItem()
} else {
session.hideStatusBarItem()
Copy link
Contributor

@justinmk3 justinmk3 Nov 5, 2024

Choose a reason for hiding this comment

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

Could just be a parameter. Separate functions are usually not needed for "toggle".

Suggested change
if (editor?.document === document) {
session.showStatusBarItem()
} else {
session.hideStatusBarItem()
session.showStatusBarItem(editor?.document === document)

Comment on lines 183 to 188
let numEvents
if (event.sessionResults === undefined) {
numEvents = 0
} else {
numEvents = event.sessionResults.length
}
Copy link
Contributor

Choose a reason for hiding this comment

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

use a ternary. it's clearer, more readable, and allows const.

Comment on lines 172 to 179
let isSampled: boolean
//sessionMetadata is expected to always be present on a LiveTail stream update
if (event.sessionMetadata === undefined || event.sessionMetadata.sampled === undefined) {
isSampled = false
} else {
isSampled = event.sessionMetadata.sampled
}
session.isSampled = isSampled
Copy link
Contributor

Choose a reason for hiding this comment

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

could be a ternary.

@justinmk3
Copy link
Contributor

Started thread offline

what was the conclusion?

@keeganirby
Copy link
Contributor Author

Started thread offline

what was the conclusion?

Having a LiveTail statusbar item is ok given that its only visible when its respective session is the active editor. UX would prefer a single status bar item that groups the three pieces of information together (eventRate, timer, isSampled), as opposed to the original implementation with three separate items.

Copy link

github-actions bot commented Nov 6, 2024

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants