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

Use logging consistently #430

Closed
3 tasks done
andreasgerstmayr opened this issue May 30, 2023 · 2 comments · Fixed by #472
Closed
3 tasks done

Use logging consistently #430

andreasgerstmayr opened this issue May 30, 2023 · 2 comments · Fixed by #472

Comments

@andreasgerstmayr
Copy link
Collaborator

andreasgerstmayr commented May 30, 2023

{"level":"info","ts":"2023-05-30T16:06:33.314811295Z","msg":"Starting EventSource","controller":"tempostack","controllerGroup":"tempo.grafana.com","controllerKind":"TempoStack","source":"kind source: *v1.Route"}
{"level":"info","ts":"2023-05-30T16:06:33.314827535Z","msg":"Starting EventSource","controller":"tempostack","controllerGroup":"tempo.grafana.com","controllerKind":"TempoStack","source":"kind source: *v1.Secret"}
{"level":"info","ts":"2023-05-30T16:06:33.314885107Z","msg":"Starting Controller","controller":"tempostack","controllerGroup":"tempo.grafana.com","controllerKind":"TempoStack"}
{"level":"info","ts":"2023-05-30T16:06:34.124201867Z","msg":"Starting workers","controller":"tempostack","controllerGroup":"tempo.grafana.com","controllerKind":"TempoStack","worker count":1}
W0530 16:08:21.838587 1 reflector.go:424] pkg/mod/k8s.io/client-go@v0.25.0/tools/cache/reflector.go:169: failed to list *v1.PrometheusRule: prometheusrules.monitoring.coreos.com is forbidden: User "system:serviceaccount:openshift-operators:tempo-operator-controller-manager" cannot list resource "prometheusrules" in API group "monitoring.coreos.com" at the cluster scope
E0530 16:08:21.838661 1 reflector.go:140] pkg/mod/k8s.io/client-go@v0.25.0/tools/cache/reflector.go:169: Failed to watch *v1.PrometheusRule: failed to list *v1.PrometheusRule: prometheusrules.monitoring.coreos.com is forbidden: User "system:serviceaccount:openshift-operators:tempo-operator-controller-manager" cannot list resource "prometheusrules" in API group "monitoring.coreos.com" at the cluster scope
W0530 16:08:22.989190 1 reflector.go:424] pkg/mod/k8s.io/client-go@v0.25.0/tools/cache/reflector.go:169: failed to list *v1.PrometheusRule: prometheusrules.monitoring.coreos.com is forbidden: User "system:serviceaccount:openshift-operators:tempo-operator-controller-manager" cannot list resource "prometheusrules" in API group "monitoring.coreos.com" at the cluster scope
E0530 16:08:22.989244 1 reflector.go:140] pkg/mod/k8s.io/client-go@v0.25.0/tools/cache/reflector.go:169: Failed to watch *v1.PrometheusRule: failed to list *v1.PrometheusRule: prometheusrules.monitoring.coreos.com is forbidden: User "system:serviceaccount:openshift-operators:tempo-operator-controller-manager" cannot list resource "prometheusrules" in API group "monitoring.coreos.com" at the cluster scope

The last error messages don't have the proper formatting.

Tasks

@iblancasa
Copy link
Collaborator

Those logging messages are generated by the client-go library. It seems we're not the only ones having some problems with those error/warning messages: kubernetes/client-go#1247

@andreasgerstmayr
Copy link
Collaborator Author

I think this happens if we return an error in the Reconcile() function, but I didn't debug it much yet.

reflector.go calls HandleError (https://github.com/kubernetes/client-go/blob/bbdc95deee6fdda42bba28a631130978a67163bd/tools/cache/reflector.go#L148), which is defined here: https://github.com/kubernetes/apimachinery/blob/v0.27.2/pkg/util/runtime/runtime.go#L102 - maybe there is a way to add a custom ErrorHandler which uses our logger instead of the default one.

andreasgerstmayr added a commit to andreasgerstmayr/tempo-operator that referenced this issue Jun 20, 2023
…ty levels of reconcile logs

Resolves: grafana#430
Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
andreasgerstmayr added a commit that referenced this issue Jun 21, 2023
…ty levels of reconcile logs (#472)

* Use consistent log format, specify logger names and update log severity levels of reconcile logs

Resolves: #430
Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>

* move logging setup to new package

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>

---------

Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants