Skip to content
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

Ruler: improve control over marshaling relabel.Config #4364

Merged

Conversation

dannykopping
Copy link
Contributor

Signed-off-by: Danny Kopping danny.kopping@grafana.com

What this PR does / why we need it:
This PR introduces a custom struct that eases json/yaml unmarshaling of complex relabel.Config struct.
Since we use json to marshal our per-tenant limits in entitlements, and prometheus doesn't have a custom JSON unmarshaler, we need to introduce our own.

I also opted to only accept primitive types and push the responsibility of using the correct types down to the createRelabelConfigs function.

Which issue(s) this PR fixes:
N/A

Special notes for your reviewer:
We do the YAML marshal/unmarshal dance because prometheus only validates the configuration in its UnmarshalYAML function.

Checklist

  • Documentation added
  • Tests updated

…abel.Config struct

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
@dannykopping dannykopping marked this pull request as ready for review September 22, 2021 10:56
@dannykopping dannykopping requested a review from a team as a code owner September 22, 2021 10:56
Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!. Thanks @dannykopping

@dannykopping dannykopping merged commit a1aaec1 into grafana:main Sep 22, 2021
@dannykopping dannykopping deleted the dannykopping/ruler-wal-unmarshal branch September 22, 2021 12:03
dannykopping pushed a commit that referenced this pull request Sep 27, 2021
…abel.Config struct (#4364)

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants