Skip to content

Commit fc6301a

Browse files
committed
rename deptracker_post_record_no_attestation to deptracker_post_record_unknown_artifact
Signed-off-by: Eric Pickard <piceri@github.com>
1 parent d1e1d6c commit fc6301a

4 files changed

Lines changed: 24 additions & 24 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ The metrics exposed beyond the default Prometheus metrics are:
193193
record uploads.
194194
* `deptracker_post_record_rate_limited`: the number of post attempts
195195
that were rate limited.
196-
* `deptracker_post_record_no_attestation`: the number of attempts
196+
* `deptracker_post_record_unknown_artifact`: the number of attempts
197197
that resulted in no matching attestation for the container digest
198198
(404 "no artifacts found" responses).
199199
* `deptracker_post_record_soft_fail`: the number of recoverable failed

pkg/deploymentrecord/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func (c *Client) PostOne(ctx context.Context, record *DeploymentRecord) error {
265265
switch {
266266
case resp.StatusCode == 404:
267267
// No artifact found - do not retry
268-
dtmetrics.PostDeploymentRecordNoAttestation.Inc()
268+
dtmetrics.PostDeploymentRecordUnknownArtifact.Inc()
269269
slog.Debug("no artifact attestation found, no record created",
270270
"attempt", attempt,
271271
"status_code", resp.StatusCode,

pkg/deploymentrecord/client_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func testRecord() *DeploymentRecord {
298298
func allCounters() []prometheus.Counter {
299299
return []prometheus.Counter{
300300
dtmetrics.PostDeploymentRecordOk,
301-
dtmetrics.PostDeploymentRecordNoAttestation,
301+
dtmetrics.PostDeploymentRecordUnknownArtifact,
302302
dtmetrics.PostDeploymentRecordRateLimited,
303303
dtmetrics.PostDeploymentRecordSoftFail,
304304
dtmetrics.PostDeploymentRecordHardFail,
@@ -308,19 +308,19 @@ func allCounters() []prometheus.Counter {
308308

309309
func TestPostOne(t *testing.T) {
310310
tests := []struct {
311-
name string
312-
record *DeploymentRecord
313-
retries int
314-
handler http.HandlerFunc
315-
wantErr bool
316-
errType any // expected error type for errors.As
317-
errContain string
318-
wantOk float64
319-
wantNoAttestation float64
320-
wantRateLimited float64
321-
wantSoftFail float64
322-
wantHardFail float64
323-
wantClientError float64
311+
name string
312+
record *DeploymentRecord
313+
retries int
314+
handler http.HandlerFunc
315+
wantErr bool
316+
errType any // expected error type for errors.As
317+
errContain string
318+
wantOk float64
319+
wantUnknownArtifact float64
320+
wantRateLimited float64
321+
wantSoftFail float64
322+
wantHardFail float64
323+
wantClientError float64
324324
}{
325325
{
326326
name: "success on 200",
@@ -354,10 +354,10 @@ func TestPostOne(t *testing.T) {
354354
w.WriteHeader(http.StatusNotFound)
355355
_, _ = w.Write([]byte(`{"message":"no artifacts found"}`))
356356
},
357-
wantErr: true,
358-
errType: &NoArtifactError{},
359-
errContain: "sha256:abc123",
360-
wantNoAttestation: 1,
357+
wantErr: true,
358+
errType: &NoArtifactError{},
359+
errContain: "sha256:abc123",
360+
wantUnknownArtifact: 1,
361361
},
362362
{
363363
name: "400 returns ClientError",
@@ -555,15 +555,15 @@ func TestPostOne(t *testing.T) {
555555
// Assert all metric deltas
556556
wantDeltas := []float64{
557557
tt.wantOk,
558-
tt.wantNoAttestation,
558+
tt.wantUnknownArtifact,
559559
tt.wantRateLimited,
560560
tt.wantSoftFail,
561561
tt.wantHardFail,
562562
tt.wantClientError,
563563
}
564564
names := []string{
565565
"PostDeploymentRecordOk",
566-
"PostDeploymentRecordNoAttestation",
566+
"PostDeploymentRecordUnknownArtifact",
567567
"PostDeploymentRecordRateLimited",
568568
"PostDeploymentRecordSoftFail",
569569
"PostDeploymentRecordHardFail",

pkg/dtmetrics/prom.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ var (
5050
)
5151

5252
//nolint: revive
53-
PostDeploymentRecordNoAttestation = promauto.NewCounter(
53+
PostDeploymentRecordUnknownArtifact = promauto.NewCounter(
5454
prometheus.CounterOpts{
55-
Name: "deptracker_post_record_no_attestation",
55+
Name: "deptracker_post_record_unknown_artifact",
5656
Help: "The total number of post attempts that resulted in no matching attestation for the container digest (404 'no artifacts found' responses)",
5757
},
5858
)

0 commit comments

Comments
 (0)