Skip to content

Commit

Permalink
[Agent] Rename the User-Agent string from Beats Agent to Elastic Agent (
Browse files Browse the repository at this point in the history
#17765)

* Rename the User-Agent string from Beats Agent to Elastic Agent

When we changed the name of the agent to Elastic Agent we forgot to
update the User-Agent string send on every request.
  • Loading branch information
ph authored Apr 17, 2020
1 parent 6866def commit d826dee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
- Fixed merge of config {pull}17399[17399]
- Handle abs paths on windows correctly {pull}17461[17461]
- Improved cancellation of agent {pull}17318[17318]
- Rename the User-Agent string from Beats Agent to Elastic Agent. {pull}17765[17765]
- Fix issues when running `mage package` for all the platforms. {pull}17767[17767]
- Remove the kbn-version on each request to the Kibana API. {pull}17764[17764]
- Fixed process spawning on Windows {pull}17751[17751]


==== New features

- Generate index name in a format type-dataset-namespace {pull}16903[16903]
Expand Down
4 changes: 2 additions & 2 deletions x-pack/elastic-agent/pkg/fleetapi/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func TestHTTPClient(t *testing.T) {
},
))

t.Run("Fleet user agent", withServer(
t.Run("Elastic Agent User-Agent string", withServer(
func(t *testing.T) *http.ServeMux {
msg := `{ message: "hello" }`
mux := http.NewServeMux()
mux.HandleFunc("/echo-hello", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, msg)
require.Equal(t, r.Header.Get("User-Agent"), "Beat Agent v8.0.0")
require.Equal(t, r.Header.Get("User-Agent"), "Elastic Agent v8.0.0")
})
return mux
}, func(t *testing.T, host string) {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/fleetapi/round_trippers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (r *FleetUserAgentRoundTripper) RoundTrip(req *http.Request) (*http.Respons
// NewFleetUserAgentRoundTripper returns a FleetUserAgentRoundTripper that actually wrap the
// existing UserAgentRoundTripper with a specific string.
func NewFleetUserAgentRoundTripper(wrapped http.RoundTripper, version string) http.RoundTripper {
const name = "Beat Agent"
const name = "Elastic Agent"
return &FleetUserAgentRoundTripper{
rt: kibana.NewUserAgentRoundTripper(wrapped, name+" v"+version),
}
Expand Down

0 comments on commit d826dee

Please sign in to comment.