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
Make aggregationFile an optional setting #485
Conversation
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
for ; t.Token != toki.EOF; t = s.Next() { | ||
switch t.Token { | ||
case optAggregationFile: | ||
t = s.Next() |
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.
Why do you need to do this here?
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.
The value of t.Token
when we enter the for loop will be the name of the optional setting (in this case aggregationFile=
). We need to move to the next token to get the value of the setting.
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.
Overall looks good to me 💪
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's still a couple places that need updating.
e.g. docs/grafana-net.md (make it clear it's optional now), jsonnet (remove the default)
i recommend you grep for aggregations throughout the repo to find what needs updating.
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
This has been done, mainly in these two commits: https://github.com/grafana/carbon-relay-ng/pull/485/files/0379100cd31a361bbf0fcb3b7da04e9f7219d88a..414da429ba9bd73f696938cf7c843d8b0faa0db3
I decided to keep the aggregation file config in the jsonnet, but only add the file to the config map if carbon-relay-ng/jsonnet/lib/carbon-relay-ng/crng.libsonnet Lines 14 to 32 in 414da42
The reasoning was that having the aggregation file and configmap set up is a useful reference if you want to configure your aggregations, but there are also simple and clear steps you can take if you don't want to send an aggregation file. |
ok. does the default match what we have in cloud v5? |
@@ -163,7 +171,7 @@ func NewGrafanaNet(key string, matcher matcher.Matcher, cfg GrafanaNetConfig) (R | |||
if cfg.AggregationFile != "" { | |||
aggregation, err = conf.ReadAggregations(cfg.AggregationFile) | |||
if err != nil { | |||
return nil, fmt.Errorf("NewGrafanaNet: could not read aggregationFile %q: %s", cfg.AggregationFile, err.Error()) | |||
return nil, err |
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.
why? and why do we do it differently here than in NewGrafanaNetConfig() ?
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 just wraps the original (pre-PR) ReadAggregations(...)
call in an if-else because it's possible that no file will be supplied.
I see you're commenting against a diff within two commits of the PR though:
In an earlier commit, I added the "NewGrafanaNet:..."
error since I'd removed the aggregation file parameter from NewGrafanaNetConfig()
. After the suggestion to keep the aggregation file parameter, I reverted that change and then reverted the error in this method back to what it was originally - just returning the error from reading the aggregations.
Signed-off-by: Fiona Liao <fiona.y.liao@gmail.com>
It didn't, but I updated the examples to match in e4294f0 |
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 work, fiona. thanks!
aggregationFile is currently a mandatory setting for configuring a GrafanaNet route. This PR updates it to be optional. Making this optional simplifies the process of migrating to Grafana Cloud Graphite V5.
If aggregationFile is not set, the most recent aggregation file uploaded to Grafana Cloud will be used instead. If no aggregation files have been uploaded, the default Grafana Cloud aggregations will be applied.
This is a breaking change for the
addRoute grafanaNet ...
command, asaggregationFile=
needs to be prepended to the aggregation file value since it's now an optional parameter.Testing
Built a local Docker image for my branch and configured it to push to Grafana Cloud. Checked that ignoring
aggregationFile
doesn't error, and also checked that settingaggregationFile
causes the config to be pushed to Grafana Cloud.