-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat: LoggingLogMetric now logs changed fields #1770
Conversation
} | ||
log.Info("updating logMetric", "diffs", diffs) | ||
|
||
//") | ||
// DANGER: this is an upsert; it will create the LogMetric if it doesn't exists |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
||
import api "google.golang.org/api/logging/v2" | ||
|
||
func LogMetric_RemoveOutputFields(o *api.LogMetric) { |
There was a problem hiding this comment.
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.
I think they're complementary, i.e. there's a case for both. Let me rebase / clean this up, and then we can decide! |
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) |
This should make it easier to understand why re-reconciliation is happening.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)?
[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 |
/hold cancel |
bc706c0
into
GoogleCloudPlatform:master
This should make it easier to understand why re-reconciliation is happening.