Skip to content

Add agent metadata statusbar to monitor resource usage #555

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

Merged
merged 4 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review comment: return a disposables array when creating the statusbar
  • Loading branch information
EhabY committed Jul 22, 2025
commit 9d0d6104e67b19badfe2927dbb3f67b98cbc19c6
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
update notifications.
- Coder output panel enhancements: All log entries now include timestamps, and you
can filter messages by log level in the panel.
- Added an agent metadata monitor status bar item, so you can view your active
agent metadata at a glance.

## [v1.9.2](https://github.com/coder/vscode-coder/releases/tag/v1.9.2) 2025-06-25

Expand Down
47 changes: 22 additions & 25 deletions src/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ export class Remote {
}),
);

this.createAgentMetadataStatusBar(agent, workspaceRestClient, disposables);
disposables.push(
...this.createAgentMetadataStatusBar(agent, workspaceRestClient),
);

this.storage.output.info("Remote setup complete");

Expand Down Expand Up @@ -982,38 +984,33 @@ export class Remote {
private createAgentMetadataStatusBar(
agent: WorkspaceAgent,
restClient: Api,
disposables: vscode.Disposable[],
): void {
): vscode.Disposable[] {
const statusBarItem = vscode.window.createStatusBarItem(
"agentMetadata",
vscode.StatusBarAlignment.Left,
);
disposables.push(statusBarItem);

const agentWatcher = createAgentMetadataWatcher(agent.id, restClient);
disposables.push(agentWatcher);

agentWatcher.onChange(
() => {
if (agentWatcher.error) {
this.storage.output.warn(formatMetadataError(agentWatcher.error));
statusBarItem.hide();
return;
}
const onChangeDisposable = agentWatcher.onChange(() => {
if (agentWatcher.error) {
this.storage.output.warn(formatMetadataError(agentWatcher.error));
statusBarItem.hide();
return;
}

if (agentWatcher.metadata && agentWatcher.metadata.length > 0) {
statusBarItem.text = getEventValue(agentWatcher.metadata[0]);
statusBarItem.tooltip = agentWatcher.metadata
.map((metadata) => formatEventLabel(metadata))
.join("\n");
statusBarItem.show();
} else {
statusBarItem.hide();
}
},
undefined,
disposables,
);
if (agentWatcher.metadata && agentWatcher.metadata.length > 0) {
statusBarItem.text = getEventValue(agentWatcher.metadata[0]);
statusBarItem.tooltip = agentWatcher.metadata
.map((metadata) => formatEventLabel(metadata))
.join("\n");
statusBarItem.show();
} else {
statusBarItem.hide();
}
});

return [statusBarItem, agentWatcher, onChangeDisposable];
}

// closeRemote ends the current remote session.
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy