- Notifications
You must be signed in to change notification settings - Fork928
docs: reorganize template docs#10297
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
f1e03c4
bfee554
80215cf
7119be1
2c84f2e
3279747
89d07ae
9488d6a
4447e68
86bff3f
85cf21b
acc2ea6
92856a5
21eab5f
93b2d38
ac2e51a
30128dd
5be19b5
62b5ef1
65d7aed
bc96319
f86b428
77b0ac4
5469513
d43e370
20bd888
b5b74b0
279ebc8
3762b02
d0c4292
c50b95e
8911200
15bf4a0
c107198
33d6574
27e43a8
882610f
ba152f8
51b80dd
6f84abc
e58588b
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# Agentmetadata | ||
 | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
You can show live operational metrics to workspace users with agent metadata. It | ||
is the dynamic complement of [resource metadata](./resource-metadata.md). | ||
You specify agent metadata in the | ||
[`coder_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent). | ||
## Examples | ||
@@ -16,9 +15,10 @@ All of these examples use | ||
for the script declaration. With heredoc strings, you can script without messy | ||
escape codes, just as if you were working in your terminal. | ||
Some of the examples use the [`coder stat`](../cli/stat.md) command. This is | ||
useful for determining CPU and memory usage of the VM or container that the | ||
workspace is running in, which is more accurate than resource usage about the | ||
workspace's host. | ||
Here's a standard set of metadata snippets for Linux agents: | ||
@@ -86,60 +86,63 @@ resource "coder_agent" "main" { | ||
} | ||
``` | ||
##Useful utilities | ||
You can also show agent metadata for information about the workspace's host. | ||
[top](https://manpages.ubuntu.com/manpages/jammy/en/man1/top.1.html) is | ||
available in most Linux distributions and provides virtual memory, CPU and IO | ||
statistics. Running `top` produces output that looks like: | ||
```text | ||
%Cpu(s): 65.8 us, 4.4 sy, 0.0 ni, 29.3 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st | ||
MiB Mem : 16009.0 total, 493.7 free, 4624.8 used, 10890.5 buff/cache | ||
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 11021.3 avail Mem | ||
``` | ||
[vmstat](https://manpages.ubuntu.com/manpages/jammy/en/man8/vmstat.8.html) is | ||
available in most Linuxdistributions and provides virtual memory, CPU and IO | ||
statistics. Running`vmstat` produces output that looks like: | ||
```text | ||
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- | ||
r b swpd free buff cache si so bi bo in cs us sy id wa st | ||
0 0 19580 4781680 12133692 217646944 0 2 4 32 1 0 1 1 98 0 0 | ||
``` | ||
[dstat](https://manpages.ubuntu.com/manpages/jammy/man1/dstat.1.html) is | ||
considerably more parseable than`vmstat` but often not included in base images. | ||
It is easily installed by mostpackage managers under the name `dstat`. The | ||
output of running `dstat 1 1` lookslike: | ||
```text | ||
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- | ||
usr sys idl wai stl| read writ| recv send| in out | int csw | ||
1 1 98 0 0|3422k 25M| 0 0 | 153k 904k| 123k 174k | ||
``` | ||
##Managing the database load | ||
Agent metadata can generate a significant write load and overwhelm yourCoder | ||
databaseif you're not careful. The approximate writes per second can be | ||
calculated using the formula: | ||
```text | ||
(metadata_count *num_running_agents *2) /metadata_avg_interval | ||
``` | ||
For example, let's say you have | ||
- 10 running agents | ||
- each with 6 metadata snippets | ||
- with an average interval of 4 seconds | ||
You can expect `(10 * 6 * 2) / 4`, or 30 writes per second. | ||
One of the writes is to the `UNLOGGED` `workspace_agent_metadata` table and the | ||
other to the `NOTIFY` query that enables live stats streaming in the UI. | ||
## Next Steps | ||
- [Resource metadata](./resource-metadata.md) | ||
- [Parameters](./parameters.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Template best practices | ||
We recommend a few ways to manage workspace resources, authentication, and | ||
versioning. | ||
<children> | ||
</children> |
Uh oh!
There was an error while loading.Please reload this page.