diff --git a/beater/route_config.go b/beater/route_config.go index ffbab716a1a..6682e83deed 100644 --- a/beater/route_config.go +++ b/beater/route_config.go @@ -36,20 +36,26 @@ import ( ) var ( - rootURL = "/" - BackendTransactionsURL = "/v1/transactions" - ClientSideTransactionsURL = "/v1/client-side/transactions" - RumTransactionsURL = "/v1/rum/transactions" - BackendErrorsURL = "/v1/errors" - ClientSideErrorsURL = "/v1/client-side/errors" - RumErrorsURL = "/v1/rum/errors" - MetricsURL = "/v1/metrics" - SourcemapsClientSideURL = "/v1/client-side/sourcemaps" - SourcemapsURL = "/v1/rum/sourcemaps" - V2BackendURL = "/v2/intake" - V2RumURL = "/v2/rum/intake" - - HealthCheckURL = "/healthcheck" + rootURL = "/" + + // intake v2 + V2BackendURL = "/intake/v2/events" + V2RumURL = "/intake/v2/rum/events" + + // assets + SourcemapsURL = "/assets/v1/sourcemaps" + + // deprecated + SourcemapsClientSideURLDeprecated = "/v1/client-side/sourcemaps" + SourcemapsURLDeprecated = "/v1/rum/sourcemaps" + BackendTransactionsURL = "/v1/transactions" + ClientSideTransactionsURL = "/v1/client-side/transactions" + RumTransactionsURL = "/v1/rum/transactions" + BackendErrorsURL = "/v1/errors" + ClientSideErrorsURL = "/v1/client-side/errors" + RumErrorsURL = "/v1/rum/errors" + MetricsURL = "/v1/metrics" + HealthCheckURL = "/healthcheck" ) type routeType struct { @@ -59,15 +65,16 @@ type routeType struct { } var V1Routes = map[string]v1Route{ - BackendTransactionsURL: {backendRouteType, transaction.Processor, v1RequestDecoder}, - ClientSideTransactionsURL: {rumRouteType, transaction.Processor, v1RequestDecoder}, - RumTransactionsURL: {rumRouteType, transaction.Processor, v1RequestDecoder}, - BackendErrorsURL: {backendRouteType, perr.Processor, v1RequestDecoder}, - ClientSideErrorsURL: {rumRouteType, perr.Processor, v1RequestDecoder}, - RumErrorsURL: {rumRouteType, perr.Processor, v1RequestDecoder}, - MetricsURL: {metricsRouteType, metric.Processor, v1RequestDecoder}, - SourcemapsClientSideURL: {sourcemapRouteType, sourcemap.Processor, sourcemapUploadDecoder}, - SourcemapsURL: {sourcemapRouteType, sourcemap.Processor, sourcemapUploadDecoder}, + BackendTransactionsURL: {backendRouteType, transaction.Processor, v1RequestDecoder}, + ClientSideTransactionsURL: {rumRouteType, transaction.Processor, v1RequestDecoder}, + RumTransactionsURL: {rumRouteType, transaction.Processor, v1RequestDecoder}, + BackendErrorsURL: {backendRouteType, perr.Processor, v1RequestDecoder}, + ClientSideErrorsURL: {rumRouteType, perr.Processor, v1RequestDecoder}, + RumErrorsURL: {rumRouteType, perr.Processor, v1RequestDecoder}, + MetricsURL: {metricsRouteType, metric.Processor, v1RequestDecoder}, + SourcemapsURL: {sourcemapRouteType, sourcemap.Processor, sourcemapUploadDecoder}, + SourcemapsClientSideURLDeprecated: {sourcemapRouteType, sourcemap.Processor, sourcemapUploadDecoder}, + SourcemapsURLDeprecated: {sourcemapRouteType, sourcemap.Processor, sourcemapUploadDecoder}, } var V2Routes = map[string]v2Route{ diff --git a/beater/v2_handler_test.go b/beater/v2_handler_test.go index 1854b84aae3..916dc67280f 100644 --- a/beater/v2_handler_test.go +++ b/beater/v2_handler_test.go @@ -37,7 +37,7 @@ import ( ) func TestInvalidContentType(t *testing.T) { - req := httptest.NewRequest("POST", "/v2/intake", nil) + req := httptest.NewRequest("POST", V2BackendURL, nil) w := httptest.NewRecorder() c := defaultConfig("7.0.0") @@ -49,7 +49,7 @@ func TestInvalidContentType(t *testing.T) { } func TestEmptyRequest(t *testing.T) { - req := httptest.NewRequest("POST", "/v2/intake", nil) + req := httptest.NewRequest("POST", V2BackendURL, nil) req.Header.Add("Content-Type", "application/x-ndjson") w := httptest.NewRecorder() @@ -63,7 +63,7 @@ func TestEmptyRequest(t *testing.T) { } func TestRequestDecoderError(t *testing.T) { - req := httptest.NewRequest("POST", "/v2/intake", bytes.NewBufferString(`asdasd`)) + req := httptest.NewRequest("POST", V2BackendURL, bytes.NewBufferString(`asdasd`)) req.Header.Add("Content-Type", "application/x-ndjson") w := httptest.NewRecorder() @@ -111,7 +111,7 @@ func TestRequestIntegration(t *testing.T) { require.NoError(t, err) bodyReader := bytes.NewBuffer(b) - req := httptest.NewRequest("POST", "/v2/intake", bodyReader) + req := httptest.NewRequest("POST", V2BackendURL, bodyReader) req.Header.Add("Content-Type", "application/x-ndjson") w := httptest.NewRecorder() diff --git a/docs/sourcemap-api.asciidoc b/docs/sourcemap-api.asciidoc index f69d647ad75..74eaa8d8aa6 100644 --- a/docs/sourcemap-api.asciidoc +++ b/docs/sourcemap-api.asciidoc @@ -10,9 +10,11 @@ Send a `HTTP POST` request with the `Content-Type` header set to `multipart/form [source,bash] ------------------------------------------------------------ -http(s)://{hostname}:{port}/v1/rum/sourcemaps +http(s)://{hostname}:{port}/assets/v1/sourcemaps ------------------------------------------------------------ +NOTE: The URL for uploading sourcemaps was previously `/v1/sourcemaps`. It still works, but is being deprecated in favor of `/assets/v1/sourcemaps`. + [[sourcemap-request-fields]] [float] ==== Request Fields @@ -35,7 +37,7 @@ Example source map request ["source","sh",subs="attributes"] --------------------------------------------------------------------------- -curl -X POST http://127.0.0.1:8200/v1/rum/sourcemaps \ +curl -X POST http://127.0.0.1:8200/assets/v1/sourcemaps \ -F service_name="test-service" \ -F service_version="1.0" \ -F bundle_filepath="http://localhost/static/js/bundle.js" \ diff --git a/tests/system/apmserver.py b/tests/system/apmserver.py index 07211ebf029..511450a6e92 100644 --- a/tests/system/apmserver.py +++ b/tests/system/apmserver.py @@ -274,7 +274,7 @@ def check_for_no_smap(self, doc): class ClientSideBaseTest(ServerBaseTest): transactions_url = 'http://localhost:8200/v1/rum/transactions' errors_url = 'http://localhost:8200/v1/rum/errors' - sourcemap_url = 'http://localhost:8200/v1/rum/sourcemaps' + sourcemap_url = 'http://localhost:8200/assets/v1/sourcemaps' @classmethod def setUpClass(cls): diff --git a/tests/system/test_access.py b/tests/system/test_access.py index 93e114379a6..273f4f221ab 100644 --- a/tests/system/test_access.py +++ b/tests/system/test_access.py @@ -38,7 +38,7 @@ def test_with_token_v2(self): Test that access works with token """ - url = 'http://localhost:8200/v2/intake' + url = 'http://localhost:8200/intake/v2/events' transactions = self.get_transaction_v2_payload() headers = {'content-type': 'application/x-ndjson'} diff --git a/tests/system/test_requests.py b/tests/system/test_requests.py index 24e6d4aa417..a65cb2b298d 100644 --- a/tests/system/test_requests.py +++ b/tests/system/test_requests.py @@ -66,7 +66,7 @@ def test_rum_default_disabled(self): 'http://localhost:8200/v1/client-side/transactions', json=transactions) assert r.status_code == 403, r.status_code - def test_rum_default_disabled(self): + def test_rum_default_disabled_2(self): transactions = self.get_transaction_payload() r = requests.post( 'http://localhost:8200/v1/rum/transactions', json=transactions)