Repository navigation
Conversation
Guard the module query slice in the reverse proxy rewrite. Requests without a module query parameter and a configured default module no longer panic and exit the agent. The first module value selects the exporter. Any additional values are forwarded to the exporter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix a remote crash in the
exporter_exporter/proxyendpoint.If a default module is configured and a request has no
modulequery parameter, the reverse proxy rewrite sliced a nil slice:This panicked with
slice bounds out of range [1:0]. The listener'slogPanicExitrecover then stopped the whole agent with exit code 2.Fix
Remove the first
modulevalue only when at least one value exists. An absent key stays absent, and the request reaches the configured default exporter.Maintainer decision
The first
modulequery value is the SNClient routing parameter. Additionalmodulevalues belong to the exporter and must be kept. The[1:]behavior therefore stays. This change only guards the absent-key case.Test
Add
TestExporterExporterProxyDefaultModuleWithoutModuleQuery. It starts a local backend, configures a default HTTP module, sendsGET /proxywithout?module=, and checks that the backend receives/metricswith nomoduleparameter.Validation
make testmake golangcimake fmtcheckmake citestreacheddocscheck. That stage needs to write the Go module cache and start Docker, which this sandbox blocks. All earlier stages passed.AI disclaimer
This PR contains AI-generated code. A human reviewed the implementation and the test before submission.