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

update to telem work #588

Closed
wants to merge 41 commits into from
Closed

update to telem work #588

wants to merge 41 commits into from

Conversation

frodopwns
Copy link
Contributor

@frodopwns frodopwns commented Jan 22, 2020

closes #489
closes #432

  • expose ASOStatus to generic controller
  • capture full provisioning times
  • remove mocks

@WilliamMortlMicrosoft WilliamMortlMicrosoft added enhancement high-priority Issues we intend to prioritize (security, outage, blocking bug) labels Jan 27, 2020
@@ -35,36 +36,30 @@ type AsyncReconciler struct {
Telemetry telemetry.PrometheusTelemetry
Recorder record.EventRecorder
Scheme *runtime.Scheme
Log logr.Logger
Copy link
Contributor

Choose a reason for hiding this comment

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

logr.Logger is already contained within the Telemetry library in PrometheusClient::Logger... all events that are logged at any level are sent to logr as well as to Prometheus. This isn't needed. If you want to just log to logr, just use r.Telemetry.LogTrace() (that doesn't log to Prometheus, just to logr)

Or we can expose the Logger as part of the Telemetry

// r.Telemetry.LogSuccess()
// }
// }()
log := r.Log.WithValues("instance", req.String())
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't needed. If you want to just log to logr, just use r.Telemetry.LogTrace()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I was struggling to find a way to get the instance name into the logger because it was being instantiated in main.go, maybe we can fork that client with the new value here


if err := r.Get(ctx, req.NamespacedName, local); err != nil {
r.Telemetry.LogInfo("ignorable error", "error during fetch from api server")
log.Info("error during fetch from api server")
Copy link
Contributor

Choose a reason for hiding this comment

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

r.Telemetry.LogInfo

res, err := meta.Accessor(local)
if err != nil {
r.Telemetry.LogError("accessor fail", err)
log.Info("failed getting meta accessor", "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

r.Telemetry.LogInfo

@@ -79,7 +74,8 @@ func (r *AsyncReconciler) Reconcile(req ctrl.Request, local runtime.Object) (res
found, deleteErr := r.AzureClient.Delete(ctx, local)
final := multierror.Append(deleteErr)
if err := final.ErrorOrNil(); err != nil {
r.Telemetry.LogError("error deleting object", err)
log.Info("error deleting object", "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

r.Telemetry.LogInfo or LogWarning


if pAccessor, err := meta.Accessor(p.Target); err == nil {
if err := controllerutil.SetControllerReference(pAccessor, res, r.Scheme); err == nil {
r.Telemetry.LogInfo("status", "setting parent reference to object: "+pAccessor.GetName())
log.Info("setting parent reference", "target", pAccessor.GetName())
Copy link
Contributor

Choose a reason for hiding this comment

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

r.Telemetry.LogInfo

}
break
}
}
}
}

r.Telemetry.LogInfo("status", "reconciling object")
log.Info("reconciling object")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not going to add any more comments regarding this, but all log.* should use the Telemetry LogTrace instead

Comment on lines +25 to +26
RequestedAt *metav1.Time `json:"requested,omitempty"`
CompletedAt *metav1.Time `json:"completed,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!


// log that operator is running
client.Logger.Info("Component has started", "Component", client.Component)
activeGuage.WithLabelValues(client.Component).Inc()
//client.Logger.Info("Component has started", "Component", client.Component)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these commented out? Are these lines needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high-priority Issues we intend to prioritize (security, outage, blocking bug)
Projects
None yet
4 participants