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

feat: LoggingLogMetric now logs changed fields #1770

Merged
merged 1 commit into from
May 24, 2024

Conversation

justinsb
Copy link
Collaborator

@justinsb justinsb commented May 10, 2024

This should make it easier to understand why re-reconciliation is happening.

}
log.Info("updating logMetric", "diffs", diffs)

//")
// DANGER: this is an upsert; it will create the LogMetric if it doesn't exists
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not related to this PR. But are we calling Update API in every reconciliation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We call Update on every reconciliation, but the controller is expected to skip GCP calls if it can figure it out. That's actually pretty tricky for LoggingLogMetric because of some mutable-but-unreadable fields, so I proposed #1772 which is a cute trick if we can apply it more generally

@justinsb justinsb added this to the 1.118 milestone May 13, 2024

import api "google.golang.org/api/logging/v2"

func LogMetric_RemoveOutputFields(o *api.LogMetric) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function seems to be not called in this PR.

@yuwenma
Copy link
Collaborator

yuwenma commented May 14, 2024

@justinsb do we want to put this in 1.118 or #1772 ?

@justinsb
Copy link
Collaborator Author

do we want to put this in 1.118 or #1772 ?

I think they're complementary, i.e. there's a case for both. Let me rebase / clean this up, and then we can decide!

@justinsb
Copy link
Collaborator Author

Ah, looking at this again, I think I see your point ... if we check updateTime, we aren't reliant on the diff computation. Maybe we punt this one to 1.119 (or we merge this, but not #1772)

@justinsb justinsb changed the title WIP: log diffs in LoggingLogMetric feat: log diffs in LoggingLogMetric May 14, 2024
@justinsb justinsb changed the title feat: log diffs in LoggingLogMetric feat: LoggingLogMetric now logs changed fields May 14, 2024
This should make it easier to understand why re-reconciliation is happening.
Copy link
Collaborator

@acpana acpana left a comment

Choose a reason for hiding this comment

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

/hold

in case you want feedback from anyone else. feel free to cancel otherwise

/approve
/lgtm

// See the License for the specific language governing permissions and
// limitations under the License.

package logging
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not technically need to live here, right? We can move it out of the logging package as a follow on maybe? I'd also like to add some units to it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's leave it in logging, and once another controller needs this, we can better understand how to adjust this lib.

// Don't return an error as we're only logging
log.Error(err, "computing changed field paths (for logging)")
}
log.Info("updating logMetric", "diffs", diffs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

part nit/ part me learning: do we want to keep these at V(2)?

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acpana

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yuwenma
Copy link
Collaborator

yuwenma commented May 24, 2024

/hold cancel

@google-oss-prow google-oss-prow bot merged commit bc706c0 into GoogleCloudPlatform:master May 24, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants