-
Notifications
You must be signed in to change notification settings - Fork 820
Add /config handler which exposes the current YAML config of cortex. #2165
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
Conversation
575e91e
to
961ffa0
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.
Nice, We need this in Loki too and also add overrides via /config/{tenant_id}/overrides
.
LGTM
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 think we need to mask passwords.
Good point, although I think the usage is meant to be internal. |
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.
Thanks Tom for this! I would love to have it as well.
I gave it a try and unfortunately the generated config doesn't work if you try to use it (ie. you get cannot unmarshal !!map into string
) because the marshalling of some custom data types is missing or incorrect. I personally would expect to be able to copy-paste the config and get it working.
Few examples of data types with this issue:
flagext.URLValue
:
externalurl:
url:
scheme: ""
opaque: ""
user: null
host: ""
path: ""
rawpath: ""
forcequery: false
rawquery: ""
fragment: ""
url.URL
:
externalurl:
url: null
In this regards, an integration test which runs a component (ie. distributor), gets the /config
, save the config to file and re-run the same component with the store config could help to spot regressions over the time.
I think we need to mask passwords.
What if we add a config option to enable this API while keeping it disabled by default?
54e4757
to
b2f26ac
Compare
Signed-off-by: Tom Wilkie <tom@grafana.com> Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Signed-off-by: Tom Wilkie <tom@grafana.com> Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Signed-off-by: Tom Wilkie <tom@grafana.com> Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Signed-off-by: Tom Wilkie <tom@grafana.com> Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
b2f26ac
to
a12f841
Compare
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
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.
@tomwilkie I've pushed some commits. Please take a look.
In particular, the omitempty
across the config structs causes some troubles with this API. For example, if in the config you set min_ready_duration: 0s
, given 0s
is the zero value, the min_ready_duration
will not be included in the exported config and loading the exported config will load the default value (1m
). I think it could be worth to get rid of all omitempty
. What's your take?
Thanks @pracucci! Your commits LGTM. Good catch re:omitempty, yes I think these should all be removed - and there are a lot of them. |
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.
re:omitempty, yes I think these should all be removed - and there are a lot of them.
Yes, but we can postpone it to a separate PR.
Signed-off-by: Tom Wilkie tom@grafana.com
Fixes #1886
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]