Skip to content

feat: support otelcol flags (config, set, feature-gates) in all sub commands #216

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 3 commits into from
Jun 10, 2025

Conversation

obs-gh-mattcotter
Copy link
Collaborator

@obs-gh-mattcotter obs-gh-mattcotter commented Jun 5, 2025

Description

OB-40550: Support otelcol flags (config, set, and feature-gates) in all sub commands. Substitutes of the listed otel flags are now configured at the root command level on the observe-agent and are applied to all subcommands.

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

)

// TODO enable this test once the agent bundled configs don't depend on the host filesystem having the templates.
func XTest_RenderOtelConfig(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we should have some sort of unit test mode that looks for the templates somewhere relative to current path vs. somewhere specific on the FS. im fine with just looking at linux and not adding yet another copy of everything

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated! It was a pretty small change to the connections package. I had it use mac since that's how I do my dev work, but this is super easy to configure. I added a TODO to replace our snapshot tests with this new method; it will speed up the loop considerably.

var otelSets []string

func AddConfigFlags(flags *pflag.FlagSet) {
flags.StringSliceVar(&otelConfigs, configFlag, []string{}, configFlagDescription)
Copy link
Collaborator

@obs-gh-alexlew obs-gh-alexlew Jun 9, 2025

Choose a reason for hiding this comment

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

what does this actually do? does it just register these flags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it registers the flags and provides storage for their values somewhere accessible to this package. I couldn't add them in root without introducing a circular dependency, and I think it's also a pro to have them scoped only to here so they don't get referenced elsewhere.

@obs-gh-mattcotter obs-gh-mattcotter merged commit b364e4a into main Jun 10, 2025
12 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the mc/config-flag branch June 10, 2025 22:12
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