chore(controllers): normalize logging#2382
Merged
Baarsgaard merged 23 commits intomasterfrom Jan 27, 2026
Merged
Conversation
|
This PR hasn't been updated for a while, marking as stale |
3711dbc to
96a326c
Compare
Baarsgaard
commented
Jan 19, 2026
Comment on lines
+56
to
+65
| // Log messages | ||
| ErrMsgNoMatchingInstances = "instanceSelector found no matching Grafana instances" | ||
| ErrMsgGettingCR = "failed to get CR from API Server" | ||
| ErrMsgGettingInstances = "failed to get Grafana instances" | ||
| ErrMsgResolvingFolderUID = "fetching GrafanaFolder to resolve uid" | ||
| ErrMsgRunningFinalizer = "failed to finalize CR" | ||
| ErrMsgRemoveFinalizer = "failed to remove finalizer" | ||
| ErrMsgApplyErrors = "failed to sync CR to all Grafana instances" | ||
|
|
||
| DbgMsgFoundMatchingInstances = "found matching Grafana instances" |
Collaborator
Author
There was a problem hiding this comment.
I would use this chance to align our error messages, but I don't know if there's any preferences?
theSuess
reviewed
Jan 20, 2026
…other controllers
7386059 to
0acfe47
Compare
Collaborator
|
Pushed a commit to go from |
Baarsgaard
commented
Jan 27, 2026
Collaborator
Author
There was a problem hiding this comment.
@theSuess I would approve your changes, but Github won't let me as I opened the PR :D
LGTM
weisdd
approved these changes
Jan 27, 2026
alexlebens
pushed a commit
to alexlebens/infrastructure
that referenced
this pull request
Feb 24, 2026
…4201) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [grafana/grafana-operator](https://github.com/grafana/grafana-operator) | minor | `v5.21.4` → `v5.22.0` | --- ### Release Notes <details> <summary>grafana/grafana-operator (grafana/grafana-operator)</summary> ### [`v5.22.0`](https://github.com/grafana/grafana-operator/releases/tag/v5.22.0) [Compare Source](grafana/grafana-operator@v5.21.4...v5.22.0) <!-- Release notes generated using configuration in .github/release.yml at master --> We're happy to announce version 5.22.0 of the Grafana Operator! This release contains a bunch of new and exciting features like: - The brand new [`GrafanaManifest`](https://grafana.github.io/grafana-operator/docs/examples/manifests/) resource - This allows you to manage resources previously not supported by the operator but available through the new Kuberentes-style Grafana APIs (e.g Playlists, ShortURLs) as well as resources introduced by plugins (e.g. Frontend O11y configuration in Grafana Cloud). - Dynamic resource patching (currently only available to `GrafanaManifest` resources) - Patch resources with arbitrary `jq` scripts before submitting them to the Grafana API! - Alert rule groups have been updated to support more fields exposed by the Grafana API - Service accounts no longer require a name and will default to `metadata.name` #### Upgrade instructions ##### Using Helm ```sh # Upgrade the operator image & deployment helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version 5.22.0 # Upgrading CRDs kubectl apply --server-side --force-conflicts -f https://github.com/grafana/grafana-operator/releases/download/v5.22.0/crds.yaml ``` ##### Using kubectl ```sh # Namespace Scope kubectl replace -f https://github.com/grafana/grafana-operator/releases/download/v5.22.0/kustomize-namespace_scoped.yaml # Cluster Scope kubectl replace -f https://github.com/grafana/grafana-operator/releases/download/v5.22.0/kustomize-cluster_scoped.yaml ``` ##### Using kustomize ```sh flux pull artifact oci://ghcr.io/grafana/kustomize/grafana-operator:v5.22.0 --output ./grafana-operator/ ``` ##### Using OLM Releases are published to [operatorhub.io](https://operatorhub.io/operator/grafana-operator) as well as the OpenShift Operator Catalog. Depending on the installation, existing installations will either upgrade automatically or require approval from an administrator. #### What's Changed ##### Changes that might need your attention - chore(Helm): simplify helm chart by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2463](grafana/grafana-operator#2463) - We changed the default fallback for the cache strategy to `safe` instead of `off`. If you haven't explicitly set `enforceCacheLabels` to null, this does not affect you. ##### Features - feat(controllers): add new GrafanaManifest resource by [@​theSuess](https://github.com/theSuess) in [#​2448](grafana/grafana-operator#2448) - feat(GrafanaAlertRuleGroup): add support for targetDatasourceUid in recording rules by [@​RobertClarke64](https://github.com/RobertClarke64) in [#​2478](grafana/grafana-operator#2478) - feat(GrafanaAlertRuleGroup): add support for `active_time_intervals` in `notificationSettings` by [@​heliapb](https://github.com/heliapb) in [#​2479](grafana/grafana-operator#2479) - feat(GrafanaManifest): add support for dynamic resource patching by [@​theSuess](https://github.com/theSuess) in [#​2470](grafana/grafana-operator#2470) - feat(GrafanaServiceAccount): Make `.spec.name` optional by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2524](grafana/grafana-operator#2524) ##### Fixes - fix(GrafanaDashboard): update Grafana status even when remote state matches by [@​weisdd](https://github.com/weisdd) in [#​2440](grafana/grafana-operator#2440) - fix(AlertRuleGroup): skip reconciliation when there's no drift in remote state by [@​heliapb](https://github.com/heliapb) in [#​2439](grafana/grafana-operator#2439) - fix(GrafanaAlertRuleGroup): allow deprecated fields `dashboardUid` and `panelId` by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2450](grafana/grafana-operator#2450) - fix(logs): Leader election log format by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2466](grafana/grafana-operator#2466) - fix: add CRD validation for URLs in external grafana, dashboards, and library panels by [@​heliapb](https://github.com/heliapb) in [#​2446](grafana/grafana-operator#2446) - fix(GrafanaManifest): consider forbidden error as success when deleting manifests by [@​theSuess](https://github.com/theSuess) in [#​2468](grafana/grafana-operator#2468) - fix(helm): missing list namespaces permission with `watchNamespaceSelector` by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2465](grafana/grafana-operator#2465) - fix(Grafana): missing HTTPRoute backendRefs (alternative solution) by [@​weisdd](https://github.com/weisdd) in [#​2510](grafana/grafana-operator#2510) - fix(GrafanaContactPoint): use list based matching as a workaround for 10.4.0-10.4.5 by [@​theSuess](https://github.com/theSuess) in [#​2507](grafana/grafana-operator#2507) ##### Dependencies - chore(deps): update dependency ko-build/ko to v0.18.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2422](grafana/grafana-operator#2422) - chore(deps): update dependency kubernetes-sigs/controller-tools to v1.35.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2425](grafana/grafana-operator#2425) - chore(deps): update dependency kubernetes-sigs/controller-tools to v0.20.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2424](grafana/grafana-operator#2424) - chore(deps): update docker.io/grafana/grafana docker tag to v12.3.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2423](grafana/grafana-operator#2423) - fix(deps): update kubernetes packages to v0.35.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2427](grafana/grafana-operator#2427) - fix(deps): update module github.com/onsi/ginkgo/v2 to v2.27.4 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2434](grafana/grafana-operator#2434) - fix(deps): update module github.com/onsi/ginkgo/v2 to v2.27.5 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2441](grafana/grafana-operator#2441) - fix(deps): update module github.com/grafana/grafana-plugin-sdk-go to v0.285.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2444](grafana/grafana-operator#2444) - chore: bump go to 1.25.6 by [@​weisdd](https://github.com/weisdd) in [#​2445](grafana/grafana-operator#2445) - chore(deps): update dependency kubernetes-sigs/controller-runtime to v0.22.5 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2454](grafana/grafana-operator#2454) - fix(deps): update module sigs.k8s.io/controller-runtime to v0.22.5 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2455](grafana/grafana-operator#2455) - chore(deps): update dependency kubernetes-sigs/controller-runtime to v0.23.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2458](grafana/grafana-operator#2458) - fix(deps): update module sigs.k8s.io/controller-runtime to v0.23.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2459](grafana/grafana-operator#2459) - fix(deps): update module github.com/grafana/grafana-plugin-sdk-go to v0.286.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2462](grafana/grafana-operator#2462) - chore(deps): update dependency kubernetes-sigs/controller-runtime to v0.23.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2471](grafana/grafana-operator#2471) - fix(deps): update module sigs.k8s.io/controller-runtime to v0.23.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2472](grafana/grafana-operator#2472) - chore(deps): update docker.io/grafana/grafana docker tag to v12.3.2 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2475](grafana/grafana-operator#2475) - fix(deps): update module github.com/onsi/ginkgo/v2 to v2.28.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2477](grafana/grafana-operator#2477) - fix(deps): update module github.com/grafana/grafana-plugin-sdk-go to v0.287.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2487](grafana/grafana-operator#2487) - fix(deps): update module github.com/alecthomas/kong to v1.14.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2488](grafana/grafana-operator#2488) - fix(deps): update module k8s.io/apimachinery to v0.35.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2492](grafana/grafana-operator#2492) - chore(deps): update dependency kubernetes-sigs/kustomize to v5.8.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2496](grafana/grafana-operator#2496) - fix(deps): update kubernetes packages to v0.35.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2498](grafana/grafana-operator#2498) - fix(deps): update module k8s.io/apiextensions-apiserver to v0.35.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2499](grafana/grafana-operator#2499) - fix(deps): update module github.com/grafana/grafana-plugin-sdk-go to v0.288.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2500](grafana/grafana-operator#2500) - chore(deps): update docker.io/grafana/grafana docker tag to v12.3.3 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2502](grafana/grafana-operator#2502) - fix(deps): update module github.com/grafana/grafana-plugin-sdk-go to v0.288.0 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2505](grafana/grafana-operator#2505) - chore(deps): update dependency kubernetes-sigs/controller-tools to v0.20.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2509](grafana/grafana-operator#2509) - chore(deps): update grafana/shared-workflows/get-vault-secrets action to v1.3.1 by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2526](grafana/grafana-operator#2526) - chore(deps): lock file maintenance by [@​renovate-sh-app](https://github.com/renovate-sh-app)\[bot] in [#​2503](grafana/grafana-operator#2503) ##### Documentation - fix(docs): prefix absolute links in docs by [@​theSuess](https://github.com/theSuess) in [#​2421](grafana/grafana-operator#2421) - fix(docs): git URLs by [@​weisdd](https://github.com/weisdd) in [#​2430](grafana/grafana-operator#2430) - proposal: `GrafanaManifest` resource by [@​theSuess](https://github.com/theSuess) in [#​2431](grafana/grafana-operator#2431) - docs(quickstart): Undisturbed editing with `suspend=true` and link to Common Options by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2451](grafana/grafana-operator#2451) - proposal: dynamic patching proposal by [@​theSuess](https://github.com/theSuess) in [#​2436](grafana/grafana-operator#2436) - chore(CRDs): `GrafanaManifest` missing and removal of `GrafanaManifestTemplates` by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2473](grafana/grafana-operator#2473) - docs: document JaaS example by [@​sebhoss](https://github.com/sebhoss) in [#​2370](grafana/grafana-operator#2370) - fix(docs): unified\_alerting.enabled type in multiple replicas example by [@​klinch0](https://github.com/klinch0) in [#​2493](grafana/grafana-operator#2493) - docs: grafana manifest documentation by [@​theSuess](https://github.com/theSuess) in [#​2520](grafana/grafana-operator#2520) - chore: prep-release 5.22.0 by [@​theSuess](https://github.com/theSuess) in [#​2528](grafana/grafana-operator#2528) ##### Other Changes - chore(Makefile): switch deploy target to to its own overlay by [@​weisdd](https://github.com/weisdd) in [#​2419](grafana/grafana-operator#2419) - chore(controllers): move test container creation to tk8s package by [@​weisdd](https://github.com/weisdd) in [#​2443](grafana/grafana-operator#2443) - chore(controllers): Refactor creation of HTTP Clients by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2449](grafana/grafana-operator#2449) - chore(controllers): normalize logging by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2382](grafana/grafana-operator#2382) - chore(helm): reduce the number of RBAC resources by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2464](grafana/grafana-operator#2464) - chore(RBAC Kustomize/OpenShift): Only allow lease management within the operators current namespace by [@​Baarsgaard](https://github.com/Baarsgaard) in [#​2467](grafana/grafana-operator#2467) - chore(api, controllers): modernize code using Go 1.26 features by [@​weisdd](https://github.com/weisdd) in [#​2497](grafana/grafana-operator#2497) - feat(tests): add support for grafana version overrides by [@​weisdd](https://github.com/weisdd) in [#​2490](grafana/grafana-operator#2490) - chore(controllers): embed gtime to cut build time by [@​weisdd](https://github.com/weisdd) in [#​2514](grafana/grafana-operator#2514) - refactor: use kyaml instead of simplejson for fieldpath by [@​theSuess](https://github.com/theSuess) in [#​2519](grafana/grafana-operator#2519) #### New Contributors - [@​heliapb](https://github.com/heliapb) made their first contribution in [#​2439](grafana/grafana-operator#2439) - [@​RobertClarke64](https://github.com/RobertClarke64) made their first contribution in [#​2478](grafana/grafana-operator#2478) - [@​sebhoss](https://github.com/sebhoss) made their first contribution in [#​2370](grafana/grafana-operator#2370) - [@​klinch0](https://github.com/klinch0) made their first contribution in [#​2493](grafana/grafana-operator#2493) **Full Changelog**: <grafana/grafana-operator@v5.21.4...v5.22.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNS43IiwidXBkYXRlZEluVmVyIjoiNDMuMjUuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4201 Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net> Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors all controllers to follow the pattern of explicitly logging using the logger when returning an error.
This means error logs now include variables attached to the current logger, like UIDs, names, etc.
Log messages are now significantly more static resulting in better compatibility with solutions like Elastic/OpenSearch