Retain Grafana Cloud/GEM schema fields #502
Merged
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.
For #501
Grafana Cloud and Grafana Enterprise Metrics adds two additional fields to the Graphite storage-schemas.conf:
intervals
andrelativeToQuery
. Documentation for these two fields: https://grafana.com/docs/enterprise-metrics/latest/graphite/schemas/#storage-schemas. Currently, the storage-schemas parser in CRNG drops these fields before uploading to Grafana Cloud/GEM. This PR fixes this - if either of these two fields are supplied for a rule, they will be uploaded as part of the storage-schemas.conf.No validation is done on the
intervals
andrelativeToQuery
; we just copy over the string values from the input schemas file. This is because CRNG and Grafana Cloud/GEM have different storage-schemas.conf parsers. I didn't want to copy over the Grafana Cloud/GEM validation logic as we'd have to maintain two versions of the validation, and I wanted to implement something simple first to fix not being able to submit these fields at all. If there is a problem withintervals
andrelativeToQuery
, the server-side validation will detect this and return a 400 error.Ideally we should unify the schemas parsers in the future. That might cause some breaking changes though, so we'd have to be careful with how we approach that.
Testing
Tested this version of CRNG successfully uploads schemas with the
intervals
andrelativeToQuery
fields to Grafana Cloud