diff --git a/config/config.go b/config/config.go index 5f8568d8..5817472c 100644 --- a/config/config.go +++ b/config/config.go @@ -277,6 +277,8 @@ type Config struct { PerRequestMetricsReporting bool `yaml:"per_request_metrics_reporting,omitempty"` SendHttpStartStopServerEvent bool `yaml:"send_http_start_stop_server_event,omitempty"` + + SendHttpStartStopClientEvent bool `yaml:"send_http_start_stop_client_event,omitempty"` } var defaultConfig = Config{ @@ -334,6 +336,8 @@ var defaultConfig = Config{ PerRequestMetricsReporting: true, SendHttpStartStopServerEvent: true, + + SendHttpStartStopClientEvent: true, } func DefaultConfig() (*Config, error) { diff --git a/config/config_test.go b/config/config_test.go index e8245845..6d2f0d5d 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -639,6 +639,17 @@ backends: Expect(config.SendHttpStartStopServerEvent).To(BeFalse()) }) + It("defaults SendHttpStartStopClientEvent to true", func() { + Expect(config.SendHttpStartStopClientEvent).To(Equal(true)) + }) + + It("sets SendHttpStartStopClientEvent", func() { + var b = []byte(`send_http_start_stop_client_event: false`) + err := config.Initialize(b) + Expect(err).ToNot(HaveOccurred()) + Expect(config.SendHttpStartStopClientEvent).To(BeFalse()) + }) + }) Describe("Process", func() { diff --git a/proxy/proxy.go b/proxy/proxy.go index a2914304..05dd1dfe 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -125,6 +125,7 @@ func NewProxy( DisableCompression: true, TLSClientConfig: routeServiceTLSConfig, }, + IsInstrumented: cfg.SendHttpStartStopClientEvent, } prt := round_tripper.NewProxyRoundTripper( diff --git a/proxy/round_tripper/dropsonde_round_tripper.go b/proxy/round_tripper/dropsonde_round_tripper.go index 89ac69a1..0b2f2202 100644 --- a/proxy/round_tripper/dropsonde_round_tripper.go +++ b/proxy/round_tripper/dropsonde_round_tripper.go @@ -30,6 +30,7 @@ func (d *dropsondeRoundTripper) CancelRequest(r *http.Request) { type FactoryImpl struct { BackendTemplate *http.Transport RouteServiceTemplate *http.Transport + IsInstrumented bool } func (t *FactoryImpl) New(expectedServerName string, isRouteService bool) ProxyRoundTripper { @@ -52,5 +53,10 @@ func (t *FactoryImpl) New(expectedServerName string, isRouteService bool) ProxyR TLSClientConfig: customTLSConfig, TLSHandshakeTimeout: template.TLSHandshakeTimeout, } - return NewDropsondeRoundTripper(newTransport) + if t.IsInstrumented { + return NewDropsondeRoundTripper(newTransport) + } else { + return newTransport + } + }