Minor Improvements: Log Level and Metrics Documentation#84
Merged
Conversation
Signed-off-by: Eric Pickard <piceri@github.com>
…d_unknown_artifact Signed-off-by: Eric Pickard <piceri@github.com>
Signed-off-by: Eric Pickard <piceri@github.com>
Signed-off-by: Eric Pickard <piceri@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes small operational and observability updates to deployment-tracker by adding env-configurable logging and adjusting Prometheus metric naming/documentation around unknown artifacts and caching.
Changes:
- Add
LOG_LEVELenvironment variable support for controlling slog handler level. - Rename the “no attestation” post counter metric to “unknown artifact” and update code/tests to use the new name.
- Document the unknown-artifact cache hit metric in the README.
Show a summary per file
| File | Description |
|---|---|
| pkg/dtmetrics/prom.go | Renames the exported counter and Prometheus metric name for unknown-artifact post outcomes. |
| pkg/deploymentrecord/client.go | Updates the 404-path metric increment to use the renamed counter. |
| pkg/deploymentrecord/client_test.go | Updates metric assertions and test struct fields to match the renamed counter. |
| cmd/deployment-tracker/main.go | Adds LOG_LEVEL parsing and configures slog handler level from env var. |
| README.md | Documents LOG_LEVEL and updates/extends metrics documentation for unknown-artifact behavior and cache hits. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
pkg/deploymentrecord/client.go:276
- The 404 branch currently treats any 404 as a
NoArtifactErrorand increments the...unknown_artifactmetric. That contradicts theNoArtifactErrortype comment/tests implying it’s specifically for 404s whose body indicates"no artifacts found", and it risks caching/suppressing posts for other 404 causes (bad org/base URL, endpoint changes, etc.). Consider validating the response body/message before returningNoArtifactError(and only then incrementing the unknown-artifact metric); otherwise treat other 404s as client errors.
case resp.StatusCode == 404:
// No artifact found - do not retry
dtmetrics.PostDeploymentRecordUnknownArtifact.Inc()
slog.Debug("no artifact attestation found, no record created",
"attempt", attempt,
"status_code", resp.StatusCode,
"container_name", record.Name,
"resp_msg", string(respBody),
"digest", record.Digest,
)
return &NoArtifactError{err: fmt.Errorf("no attestation found for %s", record.Digest)}
- Files reviewed: 5/5 changed files
- Comments generated: 4
tingx2wang
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change contains the following minor changes:
deptracker_post_record_no_attestationtodeptracker_post_record_unknown_artifactdeptracker_post_record_unknown_artifact_cache_hitto README