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

Feature request: Configuration validation #329

Closed
exFalso opened this issue Jan 13, 2021 · 4 comments · Fixed by #336
Closed

Feature request: Configuration validation #329

exFalso opened this issue Jan 13, 2021 · 4 comments · Fixed by #336
Assignees
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Comments

@exFalso
Copy link

exFalso commented Jan 13, 2021

Hi, it would be great if the agent could load and validate its configuration without actually starting. This would enable a static check of the configuration before deployment.

@rfratto
Copy link
Member

rfratto commented Jan 13, 2021

Hey! I agree this would be nice, but it could be pretty difficult to implement generally. For example, there's not a standard remote_write URL that can be used to validate credentials. Other validations might only be possible to check at runtime, such as if your relabel_rules are valid.

What types of validations are you interested in specifically?

@exFalso
Copy link
Author

exFalso commented Jan 14, 2021

(Wow fast response!)

The reason I thought of this is that I got an "unmarshall" error for my yaml (I think it was the server http_listen_port setting) because I used a = instead of a :. I added a yamllint pass but that doesn't catch this error, it's specific to grafana agent.
So I think perhaps a good tradeoff for validation is to simply deserialize the config to make sure the types align.

@rfratto
Copy link
Member

rfratto commented Jan 14, 2021

Ahh, I see now. We can totally do this! Would you care if it's a part of agentctl as a check-config command? Or would you prefer it to be some kind of a flag on the main Agent binary?

(FWIW, today, agentctl isn't included in the main agent image, but we can change this too)

@exFalso
Copy link
Author

exFalso commented Jan 14, 2021

Both would make sense. We actually build/package the agent from source and include the agentctl binary, so either works for us.

56quarters added a commit that referenced this issue Jan 19, 2021
Perform basic YAML and type checking for an Agent configuration file
and exit with `1` if there any errors loading, parsing, or validating
the file.

Fixes #329
56quarters added a commit that referenced this issue Jan 19, 2021
Perform basic YAML and type checking for an Agent configuration file
and exit with `1` if there any errors loading, parsing, or validating
the file.

Fixes #329
56quarters added a commit that referenced this issue Jan 19, 2021
Perform basic YAML and type checking for an Agent configuration file
and exit with `1` if there are any errors loading, parsing, or validating
the file.

Fixes #329
@56quarters 56quarters self-assigned this Jan 19, 2021
rfratto pushed a commit that referenced this issue Jan 20, 2021
* Configuration file validation subcommand for agentctl

Perform basic YAML and type checking for an Agent configuration file
and exit with `1` if there are any errors loading, parsing, or validating
the file.

Fixes #329

* CR feedback
mattdurham pushed a commit that referenced this issue Nov 11, 2021
* Configuration file validation subcommand for agentctl

Perform basic YAML and type checking for an Agent configuration file
and exit with `1` if there are any errors loading, parsing, or validating
the file.

Fixes #329

* CR feedback
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants