grafana / grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
https://grafana.github.io/grafana-operator/
Apache License 2.0
863 stars 384 forks source link

Improve logging of resource sync #1570

Open arminfelder opened 3 months ago

arminfelder commented 3 months ago

Is your feature request related to a problem? Please describe.

  1. if a resource e.g. GrafanaDashboard, is skipped, because it lacks
    spec.allowCrossNamespaceImport: true

    no information hinting at the missing setting is logged.

I would like to see, an INFO line e.g.:

GrafanaDashboard skipped, because it is not in namespace xyz, and allowCrossNamespaceImport is not set or false
  1. I would like to see an INFO line, informing about the sync status, e.g.:
    GrafanaDashboard xyz updated in Grafana-x
    GrafanaDashboard zzz created in Grafana-x
    GrafanaDashboad nnn removed from Grafana-x
    GrafanaDashboard sss uptodate in Grafana-x
NissesSenap commented 3 months ago

@arminfelder we are happy to take a PR around this.

Sheikh-Abubaker commented 2 months ago

@NissesSenap I would like to work on this, can you please tell me which file should I look into ?

NissesSenap commented 2 months ago

@Sheikh-Abubaker that is great. In this case it's probably in https://github.com/grafana/grafana-operator/blob/master/controllers/dashboard_controller.go, but this is something that needs to be improved in all the controllers.

But if you take a look in sure you will find a good row to add this info log.