Skip to content

Commit 29a5cda

Browse files
committed
Dismissed property
1 parent 55e6100 commit 29a5cda

File tree

5 files changed

+30
-23
lines changed

5 files changed

+30
-23
lines changed

coderd/healthcheck/accessurl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ func (r *AccessURLReport) Run(ctx context.Context, opts *AccessURLReportOptions)
4141

4242
r.Severity = health.SeverityOK
4343
r.Warnings = []string{}
44+
r.Dismissed = opts.Dismissed
45+
4446
if opts.AccessURL == nil {
4547
r.Error = ptr.Ref("access URL is nil")
4648
r.Severity = health.SeverityError

coderd/healthcheck/database.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ type DatabaseReportOptions struct {
4040
func (r *DatabaseReport) Run(ctx context.Context, opts *DatabaseReportOptions) {
4141
r.Warnings = []string{}
4242
r.Severity = health.SeverityOK
43+
r.Dismissed = opts.Dismissed
44+
4345
r.ThresholdMS = opts.Threshold.Milliseconds()
4446
if r.ThresholdMS == 0 {
4547
r.ThresholdMS = DatabaseDefaultThreshold.Milliseconds()

coderd/healthcheck/derphealth/derp.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ const (
3636
// @typescript-generate Report
3737
type Report struct {
3838
// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
39-
Healthy bool `json:"healthy"`
40-
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
41-
Warnings []string `json:"warnings"`
39+
Healthy bool `json:"healthy"`
40+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
41+
Warnings []string `json:"warnings"`
42+
Dismissed bool `json:"dismissed`
4243

4344
Regions map[int]*RegionReport `json:"regions"`
4445

@@ -47,8 +48,6 @@ type Report struct {
4748
NetcheckLogs []string `json:"netcheck_logs"`
4849

4950
Error *string `json:"error"`
50-
51-
Dismissed bool `json:"dismissed`
5251
}
5352

5453
// @typescript-generate RegionReport
@@ -105,9 +104,10 @@ type ReportOptions struct {
105104
func (r *Report) Run(ctx context.Context, opts *ReportOptions) {
106105
r.Healthy = true
107106
r.Severity = health.SeverityOK
107+
r.Warnings = []string{}
108+
r.Dismissed = opts.Dismissed
108109

109110
r.Regions = map[int]*RegionReport{}
110-
r.Warnings = []string{}
111111

112112
wg := &sync.WaitGroup{}
113113
mu := sync.Mutex{}

coderd/healthcheck/websocket.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ import (
1515
"github.com/coder/coder/v2/coderd/healthcheck/health"
1616
)
1717

18-
type WebsocketReportOptions struct {
19-
APIKey string
20-
AccessURL *url.URL
21-
HTTPClient *http.Client
22-
23-
Dismissed bool
24-
}
25-
2618
// @typescript-generate WebsocketReport
2719
type WebsocketReport struct {
2820
// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
@@ -36,12 +28,22 @@ type WebsocketReport struct {
3628
Error *string `json:"error"`
3729
}
3830

31+
type WebsocketReportOptions struct {
32+
APIKey string
33+
AccessURL *url.URL
34+
HTTPClient *http.Client
35+
36+
Dismissed bool
37+
}
38+
3939
func (r *WebsocketReport) Run(ctx context.Context, opts *WebsocketReportOptions) {
4040
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
4141
defer cancel()
4242

4343
r.Severity = health.SeverityOK
4444
r.Warnings = []string{}
45+
r.Dismissed = opts.Dismissed
46+
4547
u, err := opts.AccessURL.Parse("/api/v2/debug/ws")
4648
if err != nil {
4749
r.Error = convertError(xerrors.Errorf("parse access url: %w", err))

coderd/healthcheck/workspaceproxy.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ import (
1414
"github.com/coder/coder/v2/codersdk"
1515
)
1616

17-
type WorkspaceProxyReportOptions struct {
18-
// CurrentVersion is the current server version.
19-
// We pass this in to make it easier to test.
20-
CurrentVersion string
21-
WorkspaceProxiesFetchUpdater WorkspaceProxiesFetchUpdater
22-
23-
Dismissed bool
24-
}
25-
2617
// @typescript-generate WorkspaceProxyReport
2718
type WorkspaceProxyReport struct {
2819
Healthy bool `json:"healthy"`
@@ -34,6 +25,15 @@ type WorkspaceProxyReport struct {
3425
WorkspaceProxies codersdk.RegionsResponse[codersdk.WorkspaceProxy] `json:"workspace_proxies"`
3526
}
3627

28+
type WorkspaceProxyReportOptions struct {
29+
// CurrentVersion is the current server version.
30+
// We pass this in to make it easier to test.
31+
CurrentVersion string
32+
WorkspaceProxiesFetchUpdater WorkspaceProxiesFetchUpdater
33+
34+
Dismissed bool
35+
}
36+
3737
type WorkspaceProxiesFetchUpdater interface {
3838
Fetch(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error)
3939
Update(context.Context) error
@@ -55,6 +55,7 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
5555
r.Healthy = true
5656
r.Severity = health.SeverityOK
5757
r.Warnings = []string{}
58+
r.Dismissed = opts.Dismissed
5859

5960
if opts.WorkspaceProxiesFetchUpdater == nil {
6061
opts.WorkspaceProxiesFetchUpdater = &AGPLWorkspaceProxiesFetchUpdater{}

0 commit comments

Comments
 (0)