Commit Graph

36 Commits

Author SHA1 Message Date
Zach 81e2be69e9 test: use typed atomics in test files (#25071)
Use typed atomics (atomic.Int64, atomic.Int32, etc.) in test files to prevent
mixing atomic and non-atomic access on the same value, guarantee 64-bit
alignment on 32-bit platforms, and provide a cleaner API.
2026-05-11 08:41:17 -06:00
Mathias Fredriksson 4aa94fcd4c fix: StatusWriter Unwrap and process output error recovery (#23383)
Add Unwrap() to StatusWriter so http.ResponseController.SetWriteDeadline
can reach the underlying net.Conn through the middleware wrapper. Without
this, the agent's 20s WriteTimeout killed blocking process output
connections.

Also add 30s headroom to the write deadline in handleProcessOutput so
the response can be written after a full-duration blocking wait.

On the tool layer, waitForProcess and the process_output tool now try a
non-blocking snapshot on any error, not just context timeout. Transport
errors (like the WriteTimeout EOF) previously returned with no process
ID and no recovery path. Now if the process finished, the result is
returned transparently. If still running, the error includes the process
ID and tells the agent to use process_output.
2026-03-20 20:00:55 +00:00
Spike Curtis bddb808b25 chore: arrange imports in a standard way (#21452)
Fixes all our Go file imports to match the preferred spec that we've _mostly_ been using. For example:

```
import (
	"context"
	"time"

	"github.com/prometheus/client_golang/prometheus"
	"golang.org/x/xerrors"
	"gopkg.in/natefinch/lumberjack.v2"

	"cdr.dev/slog/v3"
	"github.com/coder/coder/v2/codersdk/agentsdk"
	"github.com/coder/serpent"
)
```

3 groups: standard library, 3rd partly libs, Coder libs.

This PR makes the change across the codebase. The PR in the stack above modifies our formatting to maintain this state of affairs, and is a separate PR so it's possible to review that one in detail.
2026-01-08 15:24:11 +04:00
Spike Curtis 49b34a716a fix: fix slog to always use array of Fields (#21426)
Upgrades to slog v3 which includes a small, but backward incompatible API change to the acceptible call arguments when logging. This change allows us to verify via compile time type checking that arguments are correct and won't cause a panic, as was possible in slog v1, which this replaces (v2 was tagged but never used in coder/coder).

It also updates dependencies that also use slog and were updated.

I've left the `aibridge` dependency as a commit SHA, under the assumption that the team there (cc @pawbana @dannykopping ) will tag and update the dependency soon and on their own schedule.

Other dependencies, I pushed new tags.
2026-01-08 10:29:41 +04:00
ケイラ fae30a00fd chore: remove unnecessary redeclarations in for loops (#18440) 2025-06-20 13:16:55 -06:00
Jon Ayers 17ddee05e5 chore: update golang to 1.24.1 (#17035)
- Update go.mod to use Go 1.24.1
- Update GitHub Actions setup-go action to use Go 1.24.1
- Fix linting issues with golangci-lint by:
  - Updating to golangci-lint v1.57.1 (more compatible with Go 1.24.1)

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <claude@anthropic.com>
2025-03-26 01:56:39 -05:00
Mathias Fredriksson de41bd6b95 feat: add support for workspace app audit (#16801)
This change adds support for workspace app auditing.

To avoid audit log spam, we introduce the concept of app audit sessions.
An audit session is unique per workspace app, user, ip, user agent and
http status code. The sessions are stored in a separate table from audit
logs to allow use-case specific optimizations. Sessions are ephemeral
and the table does not function as a log.

The logic for auditing is placed in the DBTokenProvider for workspace
apps so that wsproxies are included.

This is the final change affecting the API fo #15139.

Updates #15139
2025-03-18 13:50:52 +02:00
Ethan a252d13724 chore: exclude otlp trace provider from slim builds (#16140)
This adds a build flag to `exporter.go` in `coderd/tracing` that skips
compiling the file in slim builds. This file brings in some relatively
hefty dependencies that were growing the size of the slim binary a few
megabytes. All files that import `exporter.go` also aren't included in
slim builds, so this is safe.

We end up saving 5.4MB on the Linux slim binary.
2025-01-15 20:51:32 +11:00
Steven Masley c189cc93e4 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.57.0 to 1.61.0 (#12610)
* chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.57.0 to 1.61.0

* Fix tracer implementation
* Use alias vs 2 structs
2024-03-17 22:08:32 -05:00
Kyle Carberry 45b53c285f feat: allow external services to be authable (#9996)
* feat: allow external services to be authable

* Refactor external auth config structure for defaults

* Add support for new config properties

* Change the name of external auth

* Move externalauth -> external-auth

* Run gen

* Fix tests

* Fix MW tests

* Fix git auth redirect

* Fix lint

* Fix name

* Allow any ID

* Fix invalid type test

* Fix e2e tests

* Fix comments

* Fix colors

* Allow accepting any type as string

* Run gen

* Fix href
2023-10-03 14:04:39 +00:00
Kyle Carberry 5596fb20b5 chore: move /gitauth to /externalauth on the frontend (#9954)
* chore: move `/gitauth` to `/externalauth` on the frontend

This actually took a lot more jank than anticipated,
so I wanted to split this up before adding the ability
to embed new providers.

* Rename FE

* Fix em' up

* Fix linting error

* Fix e2e tests

* chore: update helm golden files
2023-09-30 14:30:01 -05:00
Colin Adler 38560dd922 chore: remove coder trace telemetry (#9677) 2023-09-14 02:20:28 -04:00
Ammar Bandukwala 16ef97a061 feat(cli): add DataDog Go tracer (#9411) 2023-08-29 22:14:28 +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
Dean Sheather 2f0a9996e7 chore: add derpserver to wsproxy, add proxies to derpmap (#7311) 2023-07-27 02:21:04 +10:00
Colin Adler 8bd9f9c351 feat: unified tracing between coderd<->provisionerd (#7370) 2023-05-03 23:02:35 +00:00
Colin Adler a29fc7dd6f chore: update otel to v1.14.0 (#6963) 2023-04-03 00:31:39 -05:00
Ammar Bandukwala f05609b4da chore: format Go more aggressively 2023-02-18 18:32:09 -06:00
Dean Sheather 15f8967a8a feat: tracing improvements (#4988) 2022-11-29 07:22:10 +10:00
Dean Sheather ffc24dcbe0 feat: create tracing.SlogSink for storing logs as span events (#4962) 2022-11-09 12:58:23 -06:00
Dean Sheather d82364b9b5 feat: make trace provider in loadtest, add tracing to sdk (#4939) 2022-11-09 08:10:48 +10:00
Colin Adler 4c5bf42355 feat: add option for exporting traces to a provided Honeycomb team (#4816) 2022-11-01 09:15:41 -05:00
Colin Adler dde9a43b7e chore: fix otel dependency versions (#4813) 2022-10-31 19:16:16 +00:00
Kyle Carberry c5afaffa7e fix: Tidy up closes for nicer output (#4605)
* fix: Tidy up closes for nicer output

There was a context canceled message that would appear
because of traces, and this was using the wrong close.

I don't think it was causing any specific problems, but
it could make a replica warning appear on restart.

* Fix migration and experimental
2022-10-17 18:36:23 -05:00
Steven Masley 028a4edbd4 chore: Add flusher to make implement http.Flusher interface (#4255) 2022-09-29 01:16:11 +00:00
Colin Adler 95aea104c7 chore: ignore traces from (*API).workspaceAgentCoordinate after accept (#4178) 2022-09-23 15:21:44 -05:00
Colin Adler 67230babc0 fix: properly shutdown tracers (#4127) 2022-09-19 23:35:18 -05:00
Colin Adler 153e96f574 fix: use consistent tracer name (#4117) 2022-09-19 13:46:26 -05:00
Garrett Delfosse 63fd4945a2 chore: watch workspace endpoint (#4060) 2022-09-16 18:54:23 +00:00
Colin Adler b340634aaa feat: add rbac tracing (#4093) 2022-09-16 18:32:15 +00:00
Colin Adler 77acf0c340 feat: provisionerd tracing, add public trace ingestion (#4070) 2022-09-16 11:43:22 -05:00
Jon Ayers 053fe6ff61 feat: add panic recovery middleware (#3687) 2022-08-29 17:00:52 -05:00
Garrett Delfosse ccabec6dd1 fi stop tracing 4xx http status codes as errors (#3707) 2022-08-26 15:18:42 +00:00
Garrett Delfosse b412cc1a4b fix: use correct response writer for tracing middle (#3693) 2022-08-25 11:24:43 -05:00
Garrett Delfosse 0effb71f43 feat: add tracing for sql (#1610) 2022-05-20 10:51:06 -05:00
Garrett Delfosse 376c6819e0 feat: Move from datadog to generic otel (#1567) 2022-05-19 17:43:07 -05:00