Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log metadata diffs on upserts #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Log metadata diffs on upserts #208

wants to merge 1 commit into from

Conversation

ScottGarman
Copy link
Contributor

Before performing an upsert, log the differences between the existing metadata and the new metadata. This will help us understand what is happening when we see unexpected changes in the metadata.

@ScottGarman ScottGarman requested a review from a team as a code owner February 9, 2024 01:00
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (065e355) 72.46% compared to head (c10f7a0) 72.27%.

Files Patch % Lines
pkg/api/v1/router_instance_metadata.go 67.64% 6 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #208      +/-   ##
==========================================
- Coverage   72.46%   72.27%   -0.20%     
==========================================
  Files          10       10              
  Lines         810      844      +34     
==========================================
+ Hits          587      610      +23     
- Misses        163      169       +6     
- Partials       60       65       +5     
Flag Coverage Δ
unittests 72.27% <67.64%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ScottGarman ScottGarman force-pushed the log-upsert-diffs branch 3 times, most recently from f3e32ed to d8d36e3 Compare February 15, 2024 05:01
Before performing an upsert, log the differences between the existing
metadata and the new metadata. This will help us understand what is
happening when we see unexpected changes in the metadata.

existingMetadata, err := models.FindInstanceMetadatum(c.Request.Context(), r.DB, instanceID)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
r.Logger.Sugar().Info("Upsert metadata diff for instance ", instanceID, ": this is the first metadata for this instance (sql.ErrNoRows)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is going to be really noisy and not very helpful to have to weed out, doesn't feel necessary to log this condition.

}

if existingMetadata == nil {
r.Logger.Sugar().Info("Upsert metadata diff for instance ", instanceID, ": this is the first metadata for this instance")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants