Commit Graph

37 Commits

Author SHA1 Message Date
Mathias Fredriksson 92190443ff
fix(coderd/metricscache): avoid logging error for no rows (#12988)
Fixes #12938
2024-04-17 20:43:13 +03:00
Steven Masley 0a8c8ce5cc
chore: remove InsertWorkspaceAgentStat query (#12869)
* chore: remove InsertWorkspaceAgentStat query

InsertWorkspaceAgentStats (batch) exists. We only used the singular in
a single unit test place. Removing the single for the batch, reducing
the interface size.
2024-04-09 12:35:27 -05:00
Mathias Fredriksson 421bf7e785
fix(coderd): use insights for DAUs, simplify metricscache (#12775)
Fixes #12134
Fixes https://github.com/coder/customers/issues/384
Refs #12122
2024-03-27 18:10:14 +02:00
Garrett Delfosse 3ab3a62bef
feat: add port-sharing backend (#11939) 2024-02-13 09:31:20 -05:00
Steven Masley ac64155282
fix: strip timezone information from a date in dau response (#11962)
* fix: strip timezone information from a date in dau response

Timezone information is lost, so do not forward it to the client.

* fix: timezone offset should be flipped
* Make tests deterministic
2024-01-31 16:01:50 -06:00
Colin Adler eb81fcf1e1
fix: lower amount of cached timezones for deployment daus (#11196)
Updates https://github.com/coder/customers/issues/384

This should help alleviate some pressure, but doesn't really fix the
root cause. See above issue for more details.
2023-12-13 16:50:29 -06:00
Cian Johnston 197cd935cf
chore(Makefile): use linter version from dogfood Dockerfile (#11147)
* chore(Makefile): use golangci-lint version from dogfood Dockerfile

* chore(dogfood/Dockerfile): update golangci-lint to latest version

* chore(coderd): address linter complaints
2023-12-12 10:02:32 +00:00
Garrett Delfosse 8aea6040c8
fix: use unique workspace owners over unique users (#11044) 2023-12-07 10:53:15 -05:00
Kyle Carberry 5abfe5afd0
chore: rename dbfake to dbmem (#10432) 2023-10-30 17:42:20 +00:00
Mathias Fredriksson 19d7da3d24
refactor(coderd/database): split `Time` and `Now` into `dbtime` package (#9482)
Ref: #9380
2023-09-01 16:50:12 +00:00
Kyle Carberry 22e781eced
chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00
Colin Adler bc862fa493
chore: upgrade tailscale to v1.46.1 (#8913) 2023-08-09 19:50:26 +00:00
Steven Masley de1a7a9210
chore: join user information to workspace_build and template_version (#8625)
* include minimial user on template version and build
* Add unit test to ensure join is superset
2023-07-25 09:14:38 -04:00
Steven Masley aceedefce3
chore: add `template_with_user` view to include user contextual data (#8568)
* chore: Refactor template sql queries to use new view
* TemplateWithUser -> Template
* Add unit test to enforce good view
2023-07-19 16:07:33 -04:00
Mathias Fredriksson 51226c55ab
test(coderd): close metricscache and avoid background context (#7996) 2023-06-13 20:18:31 +03:00
Steven Masley cf8d2bc096
feat: use tz_offset when doing deployment dau query (#7736)
* Have FE query correct tz_offset data
2023-06-01 09:23:50 -04:00
Steven Masley 73d795f426
chore: Revert to only using 1 timezone support for template DAUs (#7721)
* chore: Revert to only using 1 timezone support for template DAUs

Keeping the logic to support more in case we optimize later
2023-05-30 15:37:07 -04:00
Steven Masley c795a0e500
feat: Fix Deployment DAUs to work with local timezones (#7647)
* chore: Add timezone param to DAU SQL query
* Merge DAUs response
* Pass time offsets to metricscache
2023-05-30 13:18:27 -04:00
Kyle Carberry cb7375450b
feat: add startup script logs to the ui (#6558)
* Add startup script logs to the database

* Add coderd endpoints for startup script logs

* Push startup script logs from agent

* Pull startup script logs on frontend

* Rename queries

* Add constraint

* Start creating log sending loop

* Add log sending to the agent

* Add tests for streaming logs

* Shorten notify channel name

* Add FE

* Improve bulk log performance

* Finish UI display

* Fix startup log visibility

* Add warning for overflow

* Fix agent queue logs overflow

* Display staartup logs in a virtual DOM for performance

* Fix agent queue with loads of logs

* Fix authorize test

* Remove faulty test

* Fix startup and shutdown reporting error

* Fix gen

* Fix comments

* Periodically purge old database entries

* Add test fixture for migration

* Add Storybook

* Check if there are logs when displaying features

* Fix startup component overflow gap

* Fix startup log wrapping

---------

Co-authored-by: Asher <ash@coder.com>
2023-03-23 14:09:13 -05:00
Kyle Carberry 5304b4e483
feat: add connection statistics for workspace agents (#6469)
* fix: don't make session counts cumulative

This made for some weird tracking... we want the point-in-time
number of counts!

* Add databasefake query for getting agent stats

* Add deployment stats endpoint

* The query... works?!?

* Fix aggregation query

* Select from multiple tables instead

* Fix continuous stats

* Increase period of stat refreshes

* Add workspace counts to deployment stats

* fmt

* Add a slight bit of responsiveness

* Fix template version editor overflow

* Add refresh button

* Fix font family on button

* Fix latest stat being reported

* Revert agent conn stats

* Fix linting error

* Fix tests

* Fix gen

* Fix migrations

* Block on sending stat updates

* Add test fixtures

* Fix response structure

* make gen
2023-03-08 21:05:45 -06:00
Kyle Carberry 87ed7a7dba
chore: use nil map on agent stats to check if report interval should be returned (#6479)
See https://github.com/coder/coder/actions/runs/4350638262/jobs/7601537088
2023-03-07 14:25:04 +00:00
Kyle Carberry 09f87d1df1
chore: remove empty case for metricscache (#6473)
This wasn't necessary to test and just caused flakes.
See: https://github.com/coder/coder/actions/runs/4350034299/jobs/7600340648
2023-03-06 21:13:08 -06:00
Kyle Carberry 05e449943d
chore: convert agent stats to use a table (#6374)
* chore: convert workspace agent stats from json to table

* chore: convert agent stats to use a table

Backwards compatibility becomes hard when all agent stats are in a JSON blob.
We also want to query this table for new agents that are failing health checks
so we can display it in the UI.

* Fix migration using default values
2023-02-28 13:33:33 -06:00
Ammar Bandukwala f05609b4da
chore: format Go more aggressively 2023-02-18 18:32:09 -06:00
Cian Johnston f0f39b4892
chore: break down dbauthz.System into smaller roles (#6218)
- rbac: export rbac.Permissions
- dbauthz: move GetDeploymentDAUs, GetTemplateDAUs,
  GetTemplateAverageBuildTime from querier.go to system.go
  and removes auth checks
- dbauthz: remove AsSystem(), add individual roles for
  autostart, provisionerd, add restricted system role for 
  everything else
2023-02-15 16:14:37 +00:00
Steven Masley 6fb8aff6d0
feat: Add initial AuthzQuerier implementation (#5919)
feat: Add initial AuthzQuerier implementation
- Adds package database/dbauthz that adds a database.Store implementation where each method goes through AuthZ checks
- Implements all database.Store methods on AuthzQuerier
- Updates and fixes unit tests where required
- Updates coderd initialization to use AuthzQuerier if codersdk.ExperimentAuthzQuerier is enabled
2023-02-14 14:27:06 +00:00
Steven Masley 8dba66c535
chore: Use dbgen in unit test (#6111)
* chore: Use dbgen in unit test

- organizationparam_test
- templateparam_test

* Use dbgen in all unit tests vs insert methods

* fixup! Use dbgen in all unit tests vs insert methods

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2023-02-08 13:47:05 -06:00
Steven Masley 8b424f03c2
chore: Rename databasefake --> dbfake (#6011) 2023-02-02 19:28:55 -06:00
Presley Pizzo 16d8cc4176
feat(site): Add deployment-wide DAU chart (#5810) 2023-01-25 22:03:47 -03:00
Mathias Fredriksson 8afdf24d10
chore: Update sqlc to v1.16.0 (#5788)
* chore: Update sqlc to v1.16.0

* chore: Fix cases where types became Null-types

* chore: Set parameter_schemas default_destination_scheme and default_source_scheme to NOT NULL

* chore: Add enum validation to database fake

* chore: Fix all tests that skipping enum values

* fix: Use correct err in providionerdserver audit log failure log
2023-01-23 13:14:47 +02:00
Ammar Bandukwala acf34d4295
site: support high build time variation in progress bar (#4941) 2022-11-17 16:56:56 +00:00
Ammar Bandukwala fa49ccd058
coderd/metricscache: fix test race (#4662) 2022-10-20 02:36:00 +00:00
Ammar Bandukwala 1984932dc9
coderd/metricscache: attempt to fix macOS race (#4622) 2022-10-18 17:28:40 +00:00
Ammar Bandukwala dc3519e973
Support all transitions in build progress bar (#4575)
* Use null types instead of -1 for simplicity

* Fix pgcrypto bug in migration 59

* Add stories

* Fix visual stutter
2022-10-16 23:34:03 -05:00
Ammar Bandukwala e456799f1a
Add template build time stats (#4557)
- Expose time in Template pages
- Show progress bar when building a workspace
2022-10-15 20:36:50 +00:00
Ammar Bandukwala f6aa025a01
feat: use active users instead of total users in Template views (#3900) 2022-09-09 19:30:31 +00:00
Ammar Bandukwala 30f8fd9b95
Daily Active User Metrics (#3735)
* agent: add StatsReporter

* Stabilize protoc
2022-09-01 14:58:23 -05:00