Skip to content

Commit

Permalink
Introduce httpcommon package in libbeat (add support for Proxy) (#25219)
Browse files Browse the repository at this point in the history
(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
  • Loading branch information
Steffen Siering authored and mergify-bot committed Jul 19, 2021
1 parent 72faf0e commit 3ed5a1c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

- Bundle synthetics deps with heartbeat docker image. {pull}23274[23274]
- Add support for `copytruncate` method when rotating input logs with an external tool in `filestream` input. {pull}23457[23457]
- Add mime type detection for http responses. {pull}22976[22976]
- Add `proxy_headers` to HTTP monitor. {pull}25219[25219]

*Heartbeat*
Expand Down
3 changes: 3 additions & 0 deletions libbeat/monitoring/report/elasticsearch/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import (
"time"

"github.com/elastic/beats/v7/libbeat/common/transport/httpcommon"
<<<<<<< HEAD
"github.com/elastic/beats/v7/libbeat/monitoring/report"
=======
>>>>>>> 4accfa821 (Introduce httpcommon package in libbeat (add support for Proxy) (#25219))
)

// config is subset of libbeat/outputs/elasticsearch config tailored
Expand Down
31 changes: 31 additions & 0 deletions metricbeat/module/elasticsearch/index/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import (

"github.com/stretchr/testify/require"

<<<<<<< HEAD
=======
"github.com/elastic/beats/v7/libbeat/common/transport/httpcommon"
"github.com/elastic/beats/v7/metricbeat/helper"
"github.com/elastic/beats/v7/metricbeat/mb"
>>>>>>> 4accfa821 (Introduce httpcommon package in libbeat (add support for Proxy) (#25219))
mbtest "github.com/elastic/beats/v7/metricbeat/mb/testing"
"github.com/elastic/beats/v7/metricbeat/module/elasticsearch"
)
Expand All @@ -35,7 +41,32 @@ var info = elasticsearch.Info{
}

func TestMapper(t *testing.T) {
<<<<<<< HEAD
elasticsearch.TestMapperWithInfo(t, "../index/_meta/test/stats.*.json", eventsMapping)
=======
t.Skip("Skipping to fix in a follow up")

mux := createEsMuxer("7.6.0", "platinum", false)

server := httptest.NewServer(mux)
defer server.Close()

httpClient, err := helper.NewHTTPFromConfig(helper.Config{
ConnectTimeout: 30 * time.Second,
Transport: httpcommon.HTTPTransportSettings{
Timeout: 30 * time.Second,
},
}, mb.HostData{
URI: server.URL,
SanitizedURI: server.URL,
Host: server.URL,
})
if err != nil {
t.Fatal(err)
}

elasticsearch.TestMapperWithHttpHelper(t, "../index/_meta/test/stats.*.json", httpClient, eventsMapping)
>>>>>>> 4accfa821 (Introduce httpcommon package in libbeat (add support for Proxy) (#25219))
}

func TestEmpty(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@
- Set `agent.id` to the Fleet Agent ID in events published from inputs backed by Beats. {issue}21121[21121] {pull}26394[26394] {pull}26548[26548]
- Add proxy support to artifact downloader and communication with fleet server. {pull}25219[25219]
- Add proxy support to enroll command. {pull}26514[26514]
- Set `agent.id` to the Fleet Agent ID in events published from inputs backed by Beats. {issue}21121[21121] {pull}26394[26394]
- Add proxy support to artifact downloader and communication with fleet server. {pull}25219[25219]
- Enable configuring monitoring namespace {issue}26439[26439]
- Communicate with Fleet Server over HTTP2. {pull}26474[26474]
6 changes: 6 additions & 0 deletions x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (e *enrollCmdOption) remoteConfig() (remote.Config, error) {
}
if e.Insecure {
tlsCfg.VerificationMode = tlscommon.VerifyNone
<<<<<<< HEAD
}

cfg.Transport.TLS = &tlsCfg
Expand All @@ -146,6 +147,11 @@ func (e *enrollCmdOption) remoteConfig() (remote.Config, error) {
Headers: headers,
}

=======
}

cfg.Transport.TLS = &tlsCfg
>>>>>>> 4accfa821 (Introduce httpcommon package in libbeat (add support for Proxy) (#25219))
return cfg, nil
}

Expand Down

0 comments on commit 3ed5a1c

Please sign in to comment.