Skip to content

feat: add 'config validate' command to diagnose config issues without other checks #232

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

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

obs-gh-mattcotter
Copy link
Collaborator

Description

Add 'config validate' command to diagnose config issues without other checks. This can be used by our helm chart to check all of the config maps.

Examples:

$ ./observe-agent config validate 
❌ invalid config
Error: service::pipelines::metrics/agent-filestats: references exporter "otlphttp/observemetrics2" which is not configured

# after fixing my config
$ ./observe-agent config validate 
✅ configuration is valid

This also adds a hidden config-mode flag so you can (e.g.) validate the bundled docker config from a mac build:

$ ./observe-agent config --render-otel | grep eventlog

$ ./observe-agent --config-mode windows config --render-otel | grep eventlog
    windowseventlog/host_monitoring-application:
    windowseventlog/host_monitoring-security:
    windowseventlog/host_monitoring-system:
                - windowseventlog/host_monitoring-application
                - windowseventlog/host_monitoring-security
                - windowseventlog/host_monitoring-system

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

fmt.Fprintln(os.Stderr, "❌ failed to generate config")
return err
}
err = col.DryRun(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a built in command? that's cool

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is! The vanilla otelcol has this validate command. We have this exact same call in diagnose as well, but I figured having a simple config check was valuable in addition to the full suite (especially for the helm chart case).

@obs-gh-mattcotter obs-gh-mattcotter merged commit c432a65 into main Jul 8, 2025
12 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the mc/config-validate branch July 8, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants