Skip to content

Commit 8ca71f1

Browse files
bpmctclaude
andcommitted
docs: add Template Insights documentation (#21138)
Adds comprehensive documentation for the Template Insights feature, which was previously undocumented. The documentation covers: - What Template Insights are and their purpose - How to access and use Template Insights - Available metrics (active users, app usage, user activity, latency, parameters) - Use cases for capacity planning, optimization, and support - Permissions and RBAC considerations - Troubleshooting guidance Also updates: - CLAUDE.md with workflow for reading GitHub issues before starting work - dogfood/coder/main.tf with GitHub CLI authentication in startup script - docs/admin/templates/index.md to link to the new documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 82bb833 commit 8ca71f1

File tree

4 files changed

+213
-0
lines changed

4 files changed

+213
-0
lines changed

CLAUDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ Only pause to ask for confirmation when:
5959

6060
## Critical Patterns
6161

62+
### Working on GitHub Issues (ALWAYS FOLLOW)
63+
64+
1. **Create a branch** for each issue: `git checkout -b feat/short-description-ISSUENUMBER`
65+
2. **Read the issue** using GitHub CLI: `gh issue view ISSUENUMBER`
66+
3. **Understand requirements** before making any changes
67+
4. **Never assume** what an issue is about - always read it first
68+
6269
### Database Changes (ALWAYS FOLLOW)
6370

6471
1. Modify `coderd/database/queries/*.sql` files

docs/admin/templates/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ needs of different teams.
6060
changes are reviewed and tested.
6161
- [Permissions and Policies](./template-permissions.md): Control who may access
6262
and modify your template.
63+
- [Template Insights](./template-insights.md): Monitor template usage, application
64+
metrics, and user activity to optimize your templates.
6365
- [External Workspaces](./managing-templates/external-workspaces.md): Learn how to connect your existing infrastructure to Coder workspaces.
6466

6567
<children></children>
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Template Insights
2+
3+
Template Insights provides detailed analytics and usage metrics for your Coder templates. This feature helps administrators and template owners understand how templates are being used, identify popular applications, and monitor user engagement.
4+
5+
## Overview
6+
7+
Template Insights offers visibility into:
8+
9+
- **Active Users**: Track the number of users actively using workspaces from a template
10+
- **Application Usage**: See which applications (VS Code, JetBrains, SSH, etc.) users are accessing
11+
- **User Activity**: Identify the most active users and their usage patterns
12+
- **Connection Latency**: Monitor workspace connection performance
13+
- **Template Parameters**: Understand which parameter values users are selecting
14+
15+
## Accessing Template Insights
16+
17+
To view Template Insights:
18+
19+
1. Navigate to the **Templates** page in your Coder dashboard
20+
2. Select a template from the list
21+
3. Click the **Insights** tab
22+
23+
> **Note**: Template Insights requires the `view_insights` permission on the template. Template administrators and organization owners have this permission by default.
24+
25+
## Insights Data
26+
27+
### Active Users Chart
28+
29+
The Active Users chart displays the number of unique users who connected to workspaces from this template over time. You can view data by:
30+
31+
- **Daily intervals**: Shows activity for each day (default for templates less than 5 weeks old)
32+
- **Weekly intervals**: Shows activity aggregated by week (default for templates 5 weeks or older)
33+
34+
Use the date range picker to analyze specific time periods.
35+
36+
### Application Usage
37+
38+
The Application Usage section shows which applications users are connecting through:
39+
40+
#### Built-in Applications
41+
42+
- **VS Code**: Includes VS Code web and desktop connections
43+
- **JetBrains**: JetBrains Gateway connections
44+
- **SSH**: Direct SSH connections to workspaces
45+
- **SFTP**: File transfer connections
46+
- **Web Terminal**: Browser-based terminal sessions
47+
48+
#### Custom Applications
49+
50+
If your template includes custom applications (defined via `coder_app` resources), they will appear in this section with their usage statistics.
51+
52+
For each application, you can see:
53+
54+
- Total seconds of usage during the selected period
55+
- Number of times the application was launched (for custom apps)
56+
57+
### User Activity
58+
59+
The User Activity section lists users who have used workspaces from this template, sorted by total usage time. For each user, you can see:
60+
61+
- Username and avatar
62+
- Total seconds of workspace usage
63+
- Which templates they used (when viewing insights across multiple templates)
64+
65+
This helps identify:
66+
67+
- Power users who may benefit from optimized resources
68+
- Users who might need additional support or training
69+
- Overall adoption of the template
70+
71+
### User Latency
72+
73+
The User Latency section displays connection performance metrics:
74+
75+
- **P50 (Median)**: The median connection latency experienced by users
76+
- **P95**: The 95th percentile latency, indicating worst-case performance for most users
77+
78+
Latency is color-coded for quick assessment:
79+
80+
- **Green**: Good performance (< 150ms)
81+
- **Yellow**: Moderate performance (150-300ms)
82+
- **Red**: Poor performance (> 300ms)
83+
84+
High latency may indicate:
85+
86+
- Network issues between users and workspaces
87+
- Resource constraints on workspace hosts
88+
- Geographic distance between users and infrastructure
89+
90+
### Template Parameters
91+
92+
The Template Parameters section shows which parameter values users are selecting when creating workspaces. This helps you:
93+
94+
- Understand common configuration choices
95+
- Identify unused parameter options
96+
- Optimize default values based on actual usage
97+
98+
For each parameter, you can see:
99+
100+
- Parameter name and type
101+
- Distribution of selected values
102+
- Number of workspaces using each value
103+
104+
## Use Cases
105+
106+
### Capacity Planning
107+
108+
Monitor active user trends to:
109+
110+
- Predict infrastructure capacity needs
111+
- Plan for scaling during peak usage periods
112+
- Identify underutilized templates that could be consolidated
113+
114+
### Template Optimization
115+
116+
Use insights to:
117+
118+
- Remove unused applications or features
119+
- Adjust default parameters based on actual usage patterns
120+
- Optimize resource allocations for common use cases
121+
122+
### User Support
123+
124+
Identify users with:
125+
126+
- High latency connections who may need network troubleshooting
127+
- Low usage who might need onboarding help
128+
- Specific application preferences for targeted support
129+
130+
### ROI and Reporting
131+
132+
Generate reports on:
133+
134+
- Developer productivity through usage metrics
135+
- Template adoption rates
136+
- Infrastructure utilization efficiency
137+
138+
## Permissions
139+
140+
Template Insights respects Coder's RBAC (Role-Based Access Control) system:
141+
142+
- **Template Administrators**: Can view insights for templates they manage
143+
- **Organization Owners**: Can view insights for all templates in their organization
144+
- **Regular Users**: Cannot access Template Insights by default
145+
146+
To grant a user access to Template Insights for a specific template, assign them the `view_insights` permission through [template permissions](./template-permissions.md).
147+
148+
## Data Privacy
149+
150+
Template Insights aggregates usage data while respecting user privacy:
151+
152+
- Individual workspace sessions are aggregated
153+
- User activity shows total usage time, not detailed session logs
154+
- No personally identifiable information beyond usernames is exposed
155+
- Connection latency is measured from agent statistics, not network monitoring
156+
157+
## API Access
158+
159+
Template Insights data is also available via the Coder API. See the [API documentation](../../reference/api/insights.md) for details on:
160+
161+
- `/api/v2/insights/templates` - Template usage metrics
162+
- `/api/v2/insights/user-activity` - User activity data
163+
- `/api/v2/insights/user-latency` - Connection latency metrics
164+
165+
## Troubleshooting
166+
167+
### No Data Displayed
168+
169+
If Template Insights shows no data:
170+
171+
1. **Check permissions**: Ensure you have `view_insights` permission on the template
172+
2. **Verify date range**: Make sure the selected date range includes workspace usage
173+
3. **Confirm workspace activity**: Users must have actively connected to workspaces (workspace creation alone doesn't generate insights)
174+
4. **Wait for data collection**: Insights data is collected from workspace agents and may take a few minutes to appear
175+
176+
### Missing Application Usage
177+
178+
If application usage appears incomplete:
179+
180+
- Ensure workspace agents are up-to-date with the latest Coder version
181+
- Verify that workspaces are running and agents are connected
182+
- Check that applications are configured correctly in the template
183+
184+
### Unexpected Latency Values
185+
186+
If latency metrics seem incorrect:
187+
188+
- Verify that workspace agents can reach the Coder server
189+
- Check for network issues between clients and workspaces
190+
- Ensure DERP (relay) servers are functioning if direct connections fail
191+
192+
## Related Documentation
193+
194+
- [Template Permissions](./template-permissions.md) - Learn about template access control
195+
- [Creating Templates](./creating-templates.md) - Build templates with usage tracking in mind
196+
- [Managing Templates](./managing-templates/change-management.md) - Use insights to inform template updates

dogfood/coder/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@ resource "coder_agent" "dev" {
596596
# Allow synchronization between scripts.
597597
trap 'touch /tmp/.coder-startup-script.done' EXIT
598598
599+
# Authenticate GitHub CLI
600+
if ! gh auth status >/dev/null 2>&1; then
601+
echo "Logging into GitHub CLI…"
602+
coder external-auth access-token github | gh auth login --hostname github.com --with-token
603+
else
604+
echo "Already logged into GitHub CLI."
605+
fi
606+
599607
# Increase the shutdown timeout of the docker service for improved cleanup.
600608
# The 240 was picked as it's lower than the 300 seconds we set for the
601609
# container shutdown grace period.

0 commit comments

Comments
 (0)