Skip to content

Commit d656208

Browse files
committed
upkeep: mise r fmt
1 parent fa8ae01 commit d656208

5 files changed

Lines changed: 56 additions & 45 deletions

File tree

pkg/deployd/strategy/deploymentwatch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ func (d deployment) Watch(op *operation.Operation, resource unstructured.Unstruc
9191
// Copied verbatim from
9292
// https://github.com/kubernetes/kubernetes/blob/74bcefc8b2bf88a2f5816336999b524cc48cf6c0/pkg/controller/deployment/util/deployment_util.go#L745
9393
func deploymentComplete(deployment *apps.Deployment, newStatus *apps.DeploymentStatus) bool {
94-
return newStatus.UpdatedReplicas == *(deployment.Spec.Replicas) &&
95-
newStatus.Replicas == *(deployment.Spec.Replicas) &&
96-
newStatus.AvailableReplicas == *(deployment.Spec.Replicas) &&
94+
return newStatus.UpdatedReplicas == *deployment.Spec.Replicas &&
95+
newStatus.Replicas == *deployment.Spec.Replicas &&
96+
newStatus.AvailableReplicas == *deployment.Spec.Replicas &&
9797
newStatus.ObservedGeneration >= deployment.Generation
9898
}

pkg/grpc/interceptor/auth/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func (g *GitHubTokenInterceptor) Token(ctx context.Context) (string, error) {
112112

113113
// Skip signature verification; we only care about the expiration time here.
114114
// The receiving party (i.e., server) must verify the token anyway.
115-
j, err := jwt.ParseString(tokenResponse.Token,
115+
j, err := jwt.ParseString(
116+
tokenResponse.Token,
116117
jwt.WithVerify(false),
117118
jwt.WithAcceptableSkew(10*time.Second),
118119
)

pkg/hookd/database/deployment.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ VALUES ($1, $2, $3, $4, $5, $6)
146146
ON CONFLICT (id) DO UPDATE
147147
SET github_id = EXCLUDED.github_id, github_repository = EXCLUDED.github_repository;
148148
`
149-
_, err := db.conn.Exec(ctx, query,
149+
_, err := db.conn.Exec(
150+
ctx, query,
150151
deployment.ID,
151152
deployment.Team,
152153
deployment.Created,
@@ -200,7 +201,8 @@ func (db *Database) WriteDeploymentStatus(ctx context.Context, status Deployment
200201
INSERT INTO deployment_status (id, deployment_id, status, message, created)
201202
VALUES ($1, $2, $3, $4, $5);
202203
`
203-
_, err := db.conn.Exec(ctx, query,
204+
_, err := db.conn.Exec(
205+
ctx, query,
204206
status.ID,
205207
status.DeploymentID,
206208
status.Status,
@@ -212,7 +214,8 @@ VALUES ($1, $2, $3, $4, $5);
212214
}
213215

214216
query = `UPDATE deployment SET state = $1 WHERE id = $2;`
215-
_, err = db.conn.Exec(ctx, query,
217+
_, err = db.conn.Exec(
218+
ctx, query,
216219
status.Status,
217220
status.DeploymentID,
218221
)
@@ -259,7 +262,8 @@ func (db *Database) WriteDeploymentResource(ctx context.Context, resource Deploy
259262
INSERT INTO deployment_resource (id, deployment_id, index, "group", version, kind, name, namespace)
260263
VALUES ($1, $2, $3, $4, $5, $6, $7, $8);
261264
`
262-
_, err := db.conn.Exec(ctx, query,
265+
_, err := db.conn.Exec(
266+
ctx, query,
263267
resource.ID,
264268
resource.DeploymentID,
265269
resource.Index,

pkg/hookd/metrics/metrics.go

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,26 @@ var (
3333
)
3434

3535
var (
36-
databaseQueries = prometheus.NewHistogramVec(prometheus.HistogramOpts{
37-
Name: "database_queries",
38-
Help: "time to execute database queries",
39-
Namespace: namespace,
40-
Subsystem: subsystem,
41-
Buckets: prometheus.LinearBuckets(0.005, 0.005, 20),
42-
},
36+
databaseQueries = prometheus.NewHistogramVec(
37+
prometheus.HistogramOpts{
38+
Name: "database_queries",
39+
Help: "time to execute database queries",
40+
Namespace: namespace,
41+
Subsystem: subsystem,
42+
Buckets: prometheus.LinearBuckets(0.005, 0.005, 20),
43+
},
4344
[]string{
4445
LabelStatus,
4546
},
4647
)
4748

48-
stateTransitions = prometheus.NewCounterVec(prometheus.CounterOpts{
49-
Name: "state_transition",
50-
Help: "deployment state transitions",
51-
Namespace: namespace,
52-
Subsystem: subsystem,
53-
},
49+
stateTransitions = prometheus.NewCounterVec(
50+
prometheus.CounterOpts{
51+
Name: "state_transition",
52+
Help: "deployment state transitions",
53+
Namespace: namespace,
54+
Subsystem: subsystem,
55+
},
5456
[]string{
5557
LabelDeploymentState,
5658
Repository,
@@ -66,23 +68,25 @@ var (
6668
Subsystem: subsystem,
6769
})
6870

69-
clusterStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
70-
Name: "cluster_status",
71-
Help: "0 if cluster is down, 1 if cluster is up",
72-
Namespace: namespace,
73-
Subsystem: subsystem,
74-
},
71+
clusterStatus = prometheus.NewGaugeVec(
72+
prometheus.GaugeOpts{
73+
Name: "cluster_status",
74+
Help: "0 if cluster is down, 1 if cluster is up",
75+
Namespace: namespace,
76+
Subsystem: subsystem,
77+
},
7578
[]string{
7679
Cluster,
7780
},
7881
)
7982

80-
leadTime = prometheus.NewSummaryVec(prometheus.SummaryOpts{
81-
Name: "lead_time_seconds",
82-
Help: "the time it takes from a deploy is made to it is running in the cluster",
83-
Namespace: namespace,
84-
Subsystem: subsystem,
85-
},
83+
leadTime = prometheus.NewSummaryVec(
84+
prometheus.SummaryOpts{
85+
Name: "lead_time_seconds",
86+
Help: "the time it takes from a deploy is made to it is running in the cluster",
87+
Namespace: namespace,
88+
Subsystem: subsystem,
89+
},
8690
[]string{
8791
LabelDeploymentState,
8892
Repository,
@@ -91,12 +95,13 @@ var (
9195
},
9296
)
9397

94-
interceptorRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
95-
Name: "auth_interceptor_requests",
96-
Help: "Number of requests by type in auth interceptor",
97-
Namespace: namespace,
98-
Subsystem: subsystem,
99-
},
98+
interceptorRequests = prometheus.NewCounterVec(
99+
prometheus.CounterOpts{
100+
Name: "auth_interceptor_requests",
101+
Help: "Number of requests by type in auth interceptor",
102+
Namespace: namespace,
103+
Subsystem: subsystem,
104+
},
100105
[]string{LabelType, LabelError},
101106
)
102107
)

pkg/hookd/middleware/prometheus.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ func PrometheusMiddleware(name string, buckets ...float64) *Middleware {
4343
if len(buckets) == 0 {
4444
buckets = defaultBuckets
4545
}
46-
m.latency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
47-
Name: latencyName,
48-
Help: "How long it took to process the request, partitioned by status code, method and HTTP path.",
49-
ConstLabels: prometheus.Labels{"service": name},
50-
Buckets: buckets,
51-
},
46+
m.latency = prometheus.NewHistogramVec(
47+
prometheus.HistogramOpts{
48+
Name: latencyName,
49+
Help: "How long it took to process the request, partitioned by status code, method and HTTP path.",
50+
ConstLabels: prometheus.Labels{"service": name},
51+
Buckets: buckets,
52+
},
5253
[]string{"code", "method", "path"},
5354
)
5455

0 commit comments

Comments
 (0)