-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Currently the context is added to the log message as follows:
log := c.LogConstructor(&req)
log = log.WithValues("reconcileID", uuid.NewUUID())
ctx = logf.IntoContext(ctx, log)There is no easy way to get the reconcileID.
Sometimes it would be great when you have access to the reconcile ID. For example: when communicating with third party services, it would be nice if we could send the corresponding reconsileID in order to add the possibility to match a request with a specific reconcileID.
I propose to introduce method like:
func ReconcileID(ctx context.Context) string {
...
}to get the reconcileID from the current context. In order that this works, we had to change the above code to something like:
log := c.LogConstructor(&req)
reconcileID := uuid.NewUUID()
log = log.WithValues("reconcileID", reconcileID)
reconcileIDToContext(ctx, reconcileID)
ctx = logf.IntoContext(ctx, log)Metadata
Metadata
Assignees
Labels
No labels