-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
nixos/grafana: refactor for RFC42 #191768
Conversation
53d27dd
to
0fa27c0
Compare
0fa27c0
to
0caa969
Compare
Everything major except for Grafana refactoring is done. Some minor things are (not all of which I have it in me to do):
|
717893c
to
b852126
Compare
08de85a
to
cf13ce9
Compare
The Grafana Some things still left to do:
|
cf13ce9
to
2e057c6
Compare
2e057c6
to
6629015
Compare
All in all it looks pretty nice, just left a few minor comments :) Will test it later, but that's a bit more effort because I have to cherry-pick it to my 22.05-based tracking-branch and it has a bunch of conflicts because |
ccb9e60
to
a2a9a3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just deployed my local Grafana with this. All in all, it looks good. I'd like to give others a chance to review. As soon as the remaining things are resolved, I'd merge then.
Thanks a lot!
This commit refactors `services.grafana.provision.dashboards` towards the RFC42 style. To preserve backwards compatibility, we have to jump through a ton of hoops, introducing esoteric type signatures and bizarre structs. The Grafana module definition should hopefully become a lot cleaner after a release cycle or two once the old configuration style is completely deprecated.
@KFearsoff Great, thank you ;-) |
New PR open at #197585
It actually isn't used anywhere. But I think using |
Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/c485669ca529e01c1505429fa9017c9a93f15559' (2022-10-20) → 'github:nix-community/home-manager/7dc4e4ebd71280842b4d30975439980baaac9db8' (2022-10-24) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/301aada7a64812853f2e2634a530ef5d34505048' (2022-10-21) → 'github:nixos/nixpkgs/f994293d1eb8812f032e8919e10a594567cf6ef7' (2022-10-25) Includes Grafana module refactoring from <NixOS/nixpkgs#191768>. Had to fix the following warnings: trace: warning: The option `services.grafana.domain' defined in `hosts/azazel/ogion.cz/monitor' has been renamed to `services.grafana.settings.server.domain'. trace: warning: Provisioning Grafana datasources with options has been deprecated. Use `services.grafana.provision.datasources.settings` or `services.grafana.provision.datasources.path` instead. trace: warning: Provisioning Grafana dashboards with options has been deprecated. Use `services.grafana.provision.dashboards.settings` or `services.grafana.provision.dashboards.path` instead. trace: Obsolete option `services.grafana.domain' is used. It was renamed to `services.grafana.settings.server.domain'. trace: Obsolete option `services.grafana.port' is used. It was renamed to `services.grafana.settings.server.http_port'.
Going to add the default value for |
default = []; | ||
apply = x: if (builtins.isList x) then map _filter x else x; | ||
type = with types; either (listOf grafanaTypes.dashboardConfig) (submodule { | ||
options.settings = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option does not show up in search.nixos.org which makes migration really hard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Apparently, datasources also don't show up. Same for man configuration.nix
. Might be due to the really weird type. I don't even know where to approach the issue, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's basically what we discussed in #191768 (comment).
Don't have a strong opinion whether this should be fixed in the module-system or whether we should just drop the either and force the submodule here. (If I had to guess I'd say that mkRenamedOptionModule
doesn't work here because one is a sub-option of another option, but we could probably create a custom submodule
-type which throws a more intuitive warning when a list is used for dashboards
/datasources
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how specific of an issue it is to either
, exactly. Is it possible to use oneOf
here instead?
I still don't exactly see a different data type here, unfortunately. Is there an existing issue for the either
problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is now: #207962
I appreciate the effort and support the idea of moving to RFC42-style configuration across the board, but between dropping whole sections of previously-supported configuration without a migration strategy (e.g., |
Correct me if I'm wrong, but I think the
Yeah, that was... bad. I didn't even consider that INI might not support nested attrs, nor do I think that many people thought that it wouldn't. The misleading warning certainly doesn't help either.
I agree. There was quite a number of bugs (and there still are bugs, and pretty nasty ones that can't be fixed easily, like the fact that there's no more documentation, yikes). I've put in effort to fix them ASAP, but the damage is already done. I hope I've done as good of a job of salvaging the situation as I think I did, though. Frankly, I'm unsure of how to handle the situation better next time. Doing more reviews would certainly help, but the scope of the PR is pretty gigantic, so people aren't too keen on doing that (can you blame them?). The manual and automatic testing that I've done didn't prevent the problems from leaking (once again, due to the gigantic scope). I'm also unsure if doing it in multiple PRs would help: the starting point looked very different from what we ended up with, the fact that I could edit the history freely helped a lot. |
@@ -272,6 +272,12 @@ Available as [services.patroni](options.html#opt-services.patroni.enable). | |||
|
|||
- The `services.matrix-synapse` systemd unit has been hardened. | |||
|
|||
- The `services.grafana` options were converted to a [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md) configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changelog entry is pretty much useless. The changelog should help users updating to figure out what they need to change. This technical justification is completely irrelevant – it should much rather tell people what they can expect to change and ideally how they need to change what in order to be able to update.
You shouldn't need to read an RFC just to get a vague idea what you need to change in your grafana configuration.
}; | ||
}; | ||
|
||
extraOptions = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very frustrated at the moment at how this was removed – the error message you get is as unhelpful as possible. There should at least be an error message informing users how to migrate to the new style and ideally a compatibility shim (maybe with a deprecation warning) since adapting seems nontrivial.
Reverting would also have been an option (although it seems people have already started migrating their configuration), this would also have alleviated the pressure on you to get this done in time for the 22.11 release which is coming up relatively quickly. |
Frankly, I was very surprised the merge happened before 22.11 release, I was assuming it will be there later (apparently, it hasn't landed in the stable branch yet, which I hope will continue to be the case). Perhaps it is my own misunderstanding of "Added a release notes entry if the change is significant" line: I considered that to be a hard requirement, not a sign of the readniess to merge. As for the documentation part, can you please share the pain points you've encountered? I am very bad at writing documentation (and I don't particularly like the process), so I mostly just copy-pasted the release note from some other module. I don't think I've seen RFC42 migrations describing the exact details on how to do them, even though I do agree that this is not a good UX. I will try to make the most out of it. As a side note: over half of the actual documentation vanished completely due to the bug with how documentation is rendered when As another side note: oh God. With the half of the documentation gone due to a bug, and the release notes not being rendered because they aren't even up, the migration path really is horrific. I might have picked a wrong "good first issue", huh. |
It won't land in 22.05, but it will be part of 22.11 when it is branched off.
I have never used the module, but happened to upgrade a machine where this module was used. The error I ran into was the removal of
The release notes are quite big, you can't give a step by step guide of course, but I think taking a few paragraphs to give an outline of what was removed in favor of what should be fine. It is also easier to remove superfluous information during release note editing than adding missing information…
These things happen and we can sort them out! In this instance it seems to be a case of unfortunate timing, sadly. |
Yeah sorry, I underestimated the impact of the documentation problems, apologies for that! |
Oof.
Oh, the
That's fair. Okay, I'll try to outline how the migration should be done in a separate PR. |
Well, it would've landed in a release sooner or later anyways and we still have a month until it's actually released, that should be enough to fix documentation and resolve remaining regressions. Wait, are you planning to take care of it, not that we duplicate work now. |
I was going to start later today, feeling 8 hours from now. I don't mind you starting earlier and me reviewing the PR, though! |
OK, summary of what's problematic:
First of all, I'd like to apologize, I missed a few parts upon reviewing this and I'll do my best to not let this happen again. I'll start a PR to fix up the documentation stuff now. |
OK, my friends' cat is telling me that I've done enough work today and wants to cuddle now, so expect a PR by tomorrow. I'm currently fixing the missing options in the docs issue. |
Fix for the missing opts is on the following branch: https://github.com/Ma27/nixpkgs/tree/grafana-fixup As soon as I've taken care of the releas-enotes I'll file a PR. |
I guess |
As far as I can tell, the option should be pretty harmless since it only polls if there's an update, never tries to update anything, as stated in the docs: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#check_for_updates . |
nixos/grafana: documentation/warning improvements after #191768
* //ops/machines/whitby: Disable grafana, since the grafana module was changed upstream in a way that our configuration no longer works. Since the OpenSSL security update is relatively pressing, adapting the grafana configuration beforehand is not a hard requirement. See NixOS/nixpkgs#191768. * //tools/depotfmt: keep Go at version 1.18 to forgo a reformat of the tree. * //nix/buildGo: keep Go at version 1.18, as 1.19 changed the CLI interface (?) in a way that breaks buildGo. * //3p/overlays/tvl: drop upstreamed tdlib upgrade. * //3p/overlays/tvl: patch buf to work around breakage due to git 2.38.1 TODO items for Go are tracked in b/215. Change-Id: Ie08fef49cf3db12e6b5225a8b992a990ddc5b642 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7141 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su>
This PR aims to refactor Grafana towards the RFC42 style, solving #191464 and #144575, while preserving backwards compatibility.
Description of changes
Grafana notifier provisioning is refactoredDecided against it, as notifiers will be deprecated in Grafana 10Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes