Commit Graph

55 Commits

Author SHA1 Message Date
Garrett Delfosse c550d0641d
feat: move shared ports out of experiment (#13120) 2024-05-02 14:11:33 -04:00
Pavel Aseev 4682355eed
chore: deprecate gauge metrics with _total suffix (#12744) (#12976)
* chore: deprecate gauge metrics with _total suffix (#12744)

Deprecated metrics:
- coderd_oauth2_external_requests_rate_limit_total
- coderd_api_workspace_latest_build_total

* Apply suggestions from code review

add link to follow-up issue

Co-authored-by: Cian Johnston <public@cianjohnston.ie>

---------

Co-authored-by: Cian Johnston <public@cianjohnston.ie>
2024-04-24 11:23:24 +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
Danny Kopping 79fb8e43c5
feat: expose workspace statuses (with details) as a prometheus metric (#12762)
Implements #12462
2024-04-02 09:57:36 +02:00
Mathias Fredriksson b183236482
feat(coderd/database): use `template_usage_stats` in `*ByTemplate` insights queries (#12668)
This PR updates the `*ByTempalte` insights queries used for generating Prometheus metrics to behave the same way as the new rollup query and re-written insights queries that utilize the rolled up data.
2024-03-25 17:42:02 +02:00
Danny Kopping 9cfd5baa91
feat(coderd): export metric indicating each experiment's status (#12657) 2024-03-19 14:11:27 +02:00
Steven Masley f0f9569d51
chore: enforce that provisioners can only acquire jobs in their own organization (#12600)
* chore: add org ID as optional param to AcquireJob
* chore: plumb through organization id to provisioner daemons
* add org id to provisioner domain key
* enforce org id argument
* dbgen provisioner jobs defaults to default org
2024-03-18 12:48:13 -05:00
Danny Kopping da54c8a51f
fix: fix data race in TestLabelsAggregation tests (#12578) 2024-03-13 13:47:22 +02:00
Danny Kopping 7a7105ad66
feat: make agent stats' cardinality configurable (#12535) 2024-03-13 12:03:36 +02:00
Cian Johnston 8f40ee3465
Revert "feat: make agent stats' cardinality configurable (#12468)" (#12533)
This reverts commit 21d1873d97.
2024-03-11 14:33:36 +00:00
Danny Kopping 21d1873d97
feat: make agent stats' cardinality configurable (#12468)
Closes #12221
2024-03-11 16:04:08 +02:00
Marcin Tojek aacb4a2b4c
feat: use map instead of slice in metrics aggregator (#11815) 2024-01-29 09:12:41 +01:00
Spike Curtis fdd60d316e
fix: fix MetricsAggregator check for metric sameness (#11508)
Fixes #11451

A refactor of the Agent API passes metrics as protobufs, which include pointers to label name/value pairs.  The aggregator tested for sameness by doing a shallow compare of label values, which for different stats reports would compare unequal because the pointers would be different.

This fix does a deep compare.

While testing I also noted that we neglect to compare template names. This is unlikely to have caused any issue in practice, since the combination of username/workspace is unique, but in the context of comparing metric labels we should do the comparison.

If a user creates a workspace, deletes it, then recreates from a different template, we could in principle have reported incorrect stats for the old template.
2024-01-09 15:21:30 +04:00
Steven Masley fe867d02e0
fix: correct perms for forbidden error in TemplateScheduleStore.Load (#11286)
* chore: TemplateScheduleStore.Load() throwing forbidden error
* fix: workspace agent scope to include template
2023-12-20 11:38:49 -06:00
Dean Sheather e46431078c
feat: add AgentAPI using DRPC (#10811)
Co-authored-by: Spike Curtis <spike@coder.com>
2023-12-18 22:53:28 +10:00
Steven Masley b7bdb17460
feat: add metrics to workspace agent scripts (#11132)
* push startup script metrics to agent
2023-12-13 11:45:43 -06:00
Marcin Tojek ef4d1b68e1
test: insights metrics: verify plugin usage (#11156) 2023-12-13 10:46:52 +01:00
Marcin Tojek d8df87d5ae
fix: insights metrics comparison (#10800)
* fix: insights metrics comparison

* links
2023-11-20 18:37:46 +01:00
Marcin Tojek fc249fab1e
skip TestCollectInsights (#10749) 2023-11-17 10:57:53 +01:00
Marcin Tojek 0e5eecd7da
feat: add more logging around echo tar (#10731) 2023-11-16 16:52:04 +01:00
Marcin Tojek ed7e43b54c
feat: expose parameter insights as Prometheus metrics (#10574) 2023-11-09 10:30:40 +01:00
Marcin Tojek 0a550815e9
feat: expose app insights as Prometheus metrics (#10346) 2023-11-07 17:14:59 +01:00
Kyle Carberry 5abfe5afd0
chore: rename dbfake to dbmem (#10432) 2023-10-30 17:42:20 +00:00
Marcin Tojek c4f590581e
feat: expose template insights as Prometheus metrics (#10325) 2023-10-19 08:45:12 +00:00
Steven Masley 5021e23105
chore: compute job status as column (#10024)
* chore: provisioner job status as column
* use provisioner job status for workspace searching
2023-10-04 20:57:46 -05:00
Kayla Washburn c194119689
chore: rename `AwaitTemplateVersionJobCompleted` and `AwaitWorkspaceBuildJobCompleted` (#10003) 2023-10-03 11:02:56 -06: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
Cian Johnston 22f31e721c
fix(coderd/prometheusmetrics): close batcher to force flush before asserting agent stats (#9465) 2023-08-31 11:40:57 +01:00
Spike Curtis 60d5002eb6
refactor: change template archive extraction to be on provisioner (#9264)
* refactor provisionersdk protocol

Signed-off-by: Spike Curtis <spike@coder.com>

* refactor provisioners to use new protocol

Signed-off-by: Spike Curtis <spike@coder.com>

* refactor provisionerd to use new protocol

Signed-off-by: Spike Curtis <spike@coder.com>

* refactor tests & proto renames

* Fixes from self-review

Signed-off-by: Spike Curtis <spike@coder.com>

* appease fmt & link

Signed-off-by: Spike Curtis <spike@coder.com>

* code review fixes & e2e fixes

Signed-off-by: Spike Curtis <spike@coder.com>

* More fmt

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review fixes

Signed-off-by: Spike Curtis <spike@coder.com>

* new gen; use uuid for session workdir

Signed-off-by: Spike Curtis <spike@coder.com>

* Revert nix-based gen CI task until dogfood is on nix

Signed-off-by: Spike Curtis <spike@coder.com>

* revert deleting dogfood Docker stuff

Signed-off-by: Spike Curtis <spike@coder.com>

* Revert "revert deleting dogfood Docker stuff"

This reverts commit 9762158167.

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-25 06:10:15 +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
Cian Johnston 9fb18f3ae5
feat(coderd): batch agent stats inserts (#8875)
This PR adds support for batching inserts to the workspace_agents_stats table.
Up to 1024 stats are batched, and flushed every second in a batch.
2023-08-04 17:00:42 +01:00
Dean Sheather 2f0a9996e7
chore: add derpserver to wsproxy, add proxies to derpmap (#7311) 2023-07-27 02:21:04 +10: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
Colin Adler c47b78c44b
chore: replace wsconncache with a single tailnet (#8176) 2023-07-12 17:37:31 -05:00
goodspark dd4aafb350
feat: add template info tags to `coderd_agents_up` metric (#7942)
Co-authored-by: Colin Adler <colin1adler@gmail.com>
2023-07-11 12:39:14 -05:00
Marcin Tojek 8e2422d42c
feat: use named loggers in `coderd` (#8148) 2023-06-22 20:09:33 +02:00
Marcin Tojek b1d1b63113
chore: ensure logs consistency across Coder (#8083) 2023-06-20 12:30:45 +02:00
Cian Johnston 751c0505bf
chore: add benchmark for prometheusmetrics.MetricsAggregator (#8066)
* add benchmark for prom metrics aggregator

* fixup! add benchmark for prom metrics aggregator

* make fmt
2023-06-16 14:04:28 +01:00
Colin Adler 8f736fe5f5
fix(prometheusmetrics): ensure periodic metrics tick on startup (#7585) 2023-06-02 11:56:37 -05:00
Marcin Tojek 14efdadd3c
feat: Collect agent SSH metrics (#7584) 2023-05-25 12:52:36 +02:00
Spike Curtis cd416c86dd
refactor: workspace builds (#7541)
* refactor workspace builds

Signed-off-by: Spike Curtis <spike@coder.com>

* make gen

Signed-off-by: Spike Curtis <spike@coder.com>

* Remove ParameterResolver from typescript

Signed-off-by: Spike Curtis <spike@coder.com>

* rename conversion -> database/db2sdk

Signed-off-by: Spike Curtis <spike@coder.com>

* tests for db2sdk

Signed-off-by: Spike Curtis <spike@coder.com>

* Tests for ParameterResolver

Signed-off-by: Spike Curtis <spike@coder.com>

* wsbuilder tests

Signed-off-by: Spike Curtis <spike@coder.com>

* Move parameter validation tests to richparameters_test.go

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix CI generation; rename mock->dbmock

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix test imports

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-23 12:06:33 +04:00
Marcin Tojek bb0a38b161
feat: Implement aggregator for agent metrics (#7259) 2023-04-27 12:34:00 +02:00
Spike Curtis b6666cf1cf
chore: tailnet debug logging (#7260)
* Enable discovery (disco) debug

Signed-off-by: Spike Curtis <spike@coder.com>

* Better debug on reconnectingPTY

Signed-off-by: Spike Curtis <spike@coder.com>

* Agent logging in appstest

Signed-off-by: Spike Curtis <spike@coder.com>

* More reconnectingPTY logging

Signed-off-by: Spike Curtis <spike@coder.com>

* Add logging to coordinator

Signed-off-by: Spike Curtis <spike@coder.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Clarify logs; remove unrelated changes

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-04-27 13:59:01 +04:00
Marcin Tojek 942aba3a66
feat: expose agent stats via Prometheus endpoint (#7115)
* WIP

* WIP

* WIP

* Agents

* fix

* 1min

* fix

* WIP

* Test

* docs

* fmt

* Add timer to measure the metrics collection

* Use CachedGaugeVec

* Unit tests

* WIP

* WIP

* db: GetWorkspaceAgentStatsAndLabels

* fmt

* WIP

* gauges

* feat: collect

* fix

* fmt

* minor fixes

* Prometheus flag

* fix

* WIP

* fix tests

* WIP

* fix json

* Rx Tx bytes

* CloseFunc

* fix

* fix

* Fixes

* fix

* fix: IgnoreErrors

* Fix: Windows

* fix

* reflect.DeepEquals
2023-04-14 16:14:52 +02:00
Marcin Tojek ad2353c3d8
chore: improve syntax in metrics collector (#7085) 2023-04-11 13:50:34 +00:00
Marcin Tojek 0347231bb8
feat: expose agent metrics via Prometheus endpoint (#7011)
* WIP

* WIP

* WIP

* Agents

* fix

* 1min

* fix

* WIP

* Test

* docs

* fmt

* Add timer to measure the metrics collection

* Use CachedGaugeVec

* Unit tests

* Address PR comments
2023-04-07 17:48:52 +02:00
Steven Masley 8b424f03c2
chore: Rename databasefake --> dbfake (#6011) 2023-02-02 19:28:55 -06:00
Steven Masley 4a6fc40949
feat: Add database data generator to make fakedbs easier to populate (#5922)
* feat: Add database data generator to make fakedbs easier to populate
2023-01-31 15:10:03 -06: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