-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Introduce httpcommon package in libbeat (add support for Proxy) #25219
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
This is a super great start! cc @mostlyjason @alvarolobato |
Argh... I forgot to adapt legacy Central Managent support and broke the build :( |
http2 change with fallback looks good |
/test |
@@ -142,7 +139,7 @@ func NewWithConfig(log *logger.Logger, cfg Config, wrapper wrapperFunc) (*Client | |||
|
|||
httpClient := http.Client{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be http2.Client
? Or will the httpcommon.WithForceAttepmtHTTP2(true)
switch it to http2 transparently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the net/http package can upgrade to http2. HTTP 1 or 2 is handled by the transport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
(cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go
* master: (25 commits) fix: Force PLATFORMS environment variable when we build Elastic Agent dependencies on arm64 (elastic#26415) macos for metricbeat to run in the extended meta-stage (elastic#26573) Packaging: add arm7 platform in the main pipeline (elastic#26575) [Heartbeat] Skip flakey timer queue test (elastic#26592) Update to "read_pipeline" permission (elastic#26465) (elastic#26580) API keys do not reflect the need for read_pipeline (elastic#26466) (elastic#26582) Add Fleet agent.id to Agent monitoring data (elastic#26548) Add kinesis metricset (elastic#25989) Refactor of system/memory metricset (elastic#26334) Introduce httpcommon package in libbeat (add support for Proxy) (elastic#25219) [Filebeat] change multiline configuration in awss3 input to parsers (elastic#25873) docs: Hint for the error "Error extracting container id" (elastic#25824) [Docs] Fixed metricbeat redis exported field CPU descriptions (elastic#25846) (elastic#26496) Update urllib to 1.26.5. (elastic#26380) Update golang.org/x/crypto (elastic#26448) [Filebeat] Update Fortinet Ingest Pipeline (elastic#24816) Move parsers outside of filestream input so others can use them as well (elastic#26541) [Filebeat] Fix `threatintel.indicator.url.full` field not populating (elastic#26508) [Filebeat] Add network direction processor to Zeek and Suricata modules (elastic#24620) Logging code cleanup related to Nomad auto-discovery (elastic#26498) ...
…upport for Proxy) (#26587) * Introduce httpcommon package in libbeat (add support for Proxy) (#25219) (cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go * Fix issues with backport. * Fix changelog. * FIx integration tests for ml-importer. Co-authored-by: Steffen Siering <[email protected]> Co-authored-by: Blake Rouse <[email protected]>
…upport for Proxy) (#26587) * Introduce httpcommon package in libbeat (add support for Proxy) (#25219) (cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go * Fix issues with backport. * Fix changelog. * FIx integration tests for ml-importer. Co-authored-by: Steffen Siering <[email protected]> Co-authored-by: Blake Rouse <[email protected]> (cherry picked from commit 37e37f1)
… (add support for Proxy) (elastic#26587) * Introduce httpcommon package in libbeat (add support for Proxy) (elastic#25219) (cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go * Fix issues with backport. * Fix changelog. * FIx integration tests for ml-importer. Co-authored-by: Steffen Siering <[email protected]> Co-authored-by: Blake Rouse <[email protected]>
…upport for Proxy) (#26587) (#26626) * Introduce httpcommon package in libbeat (add support for Proxy) (#25219) (cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go * Fix issues with backport. * Fix changelog. * FIx integration tests for ml-importer. Co-authored-by: Steffen Siering <[email protected]> Co-authored-by: Blake Rouse <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Steffen Siering <[email protected]>
* Revert "[7.x] Update to elastic/beats@2871d29be93a (backport #5454) (#5589)" This reverts commit 4269aee. * Update go version to 1.16.5 * Update to elastic/beats@9361be46ebf2 * update tests to new ecs version * fix broken test due to elastic/beats#25219 * update python tests to new ecs version * make update Co-authored-by: Andrew Wilkins <[email protected]>
(cherry picked from commit 4accfa8) # Conflicts: # libbeat/monitoring/report/elasticsearch/config.go # metricbeat/module/elasticsearch/index/data_test.go # x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go
What does this PR do?
We introduces a libbeat/common/transport/httpcommon package. The package provides structures that can be used to extract common http settings from a configuration object and construct a
http.RoundTripper
or ahttp.Client
. Currently the types configure:The
HTTPTransportSettings
andHTTPClientProxySettings
implement Unpack, which will be used automatically when a configuration is unpacked into a configuration structure. TheUnpacker
implemetnations directly initialize TLS and parse URLs and other settings that can fail. If some setting is missconfigured, Beats will fail early, reporting the full path of the setting (input, output, ...) that was missconfigured. Initializing the proxy URL and TLS, also reduces the responsiblities for the inputs/outputs to provide copy and paste code to do so.Example usage:
Features already provided by httpcommon:
http.DefaultTransport
. This initializes the idle connection limit and idle connection timeout (don't leak connections).By default (can be disabled via functional options), proxy support defaults to the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables. The environment variables are automatically ignored if the URLs host is localhost or the loopback device (by IP).
Many features that use an
http.Client
have been update to use thehttpcommon
package in order to extract "common" setting (this list only documents changes on existing features):http
monitor:setup.kibana.*
namespace):httpjson
input:cloudfoundry
:remote.Config
, which is also used fleet server config namespaceMissing (left over for follow up PRs):
httpcommon
packageWhy is it important?
The change improves consistency between different features that use HTTP. Plus the common copy and past boilerplate is removed and concentrated in a single place.
All Features that use HTTP will gain proxy support.
More APM HTTP instrumentation for HTTP based features.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Setup an HTTP proxy and try to connect via said proxy:
Related issues
HTTP_PROXY
#25021 [Fleet] Add support for proxy in Elastic Agent #25319proxy_url
to the dashboard setup task #8276