From b2fce6569d9a1a5b2844435fe901e019de285b2f Mon Sep 17 00:00:00 2001 From: Colleen McGinnis Date: Wed, 29 Nov 2023 15:51:14 -0600 Subject: [PATCH 1/4] attempt to address #11574 --- docs/source-map-how-to.asciidoc | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/source-map-how-to.asciidoc b/docs/source-map-how-to.asciidoc index a0bc2a4675b..76d178fbf73 100644 --- a/docs/source-map-how-to.asciidoc +++ b/docs/source-map-how-to.asciidoc @@ -95,19 +95,21 @@ module.exports = { [float] [[source-map-rum-upload]] -=== Upload the source map to {kib} +=== Upload the source map + +TIP: Before uploading a source map, ensure that RUM support is enabled in the APM integration. {kib} exposes a {kibana-ref}/rum-sourcemap-api.html[source map endpoint] for uploading source maps. Source maps can be uploaded as a string, or as a file upload. -Before uploading a source map, ensure that RUM support is enabled in the APM integration Let's look at two different ways to upload a source map: curl and a custom application. Each example includes the four fields necessary for APM Server to later map minified code to its source: -* `service_name` - Should match the `serviceName` from step one -* `service_version` - Should match the `serviceVersion` from step one -* `bundle_filepath` - The absolute path of the final bundle as used in the web application -* `sourcemap` - The location of the source map. +* `service_name`: Should match the `serviceName` from step one. +* `service_version`: Should match the `serviceVersion` from step one. +* `bundle_filepath`: The absolute path of the final bundle as used in the web application. +* `sourcemap`: The location of the source map. + If you have multiple source maps, you'll need to upload each individually. [float] @@ -164,3 +166,15 @@ request.post({url: 'http://localhost:5601/api/apm/sourcemaps',formData: formData } }) ---- + +// Not sure what to call this section... +[float] +[[source-map-next]] +=== What happens next + +Source maps are stored in {es}. When you upload a source map, a new {es} index is created +containing the contents of the source map. + +Then APM Server will periodically poll those documents to maintain a map of in-memory metadata. +When stack traces match the in-memory metadata, the corresponding source map is fetched, +parsed, and cached on demand. From 316ab52b264133fe7519b1a55f0dab2874f3e9f9 Mon Sep 17 00:00:00 2001 From: Colleen McGinnis Date: Wed, 29 Nov 2023 17:22:30 -0600 Subject: [PATCH 2/4] attempt to address #11568 --- apm-server.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/apm-server.yml b/apm-server.yml index 590624c9724..35800aafd13 100644 --- a/apm-server.yml +++ b/apm-server.yml @@ -170,14 +170,10 @@ apm-server: # Note that values configured without a time unit will be interpreted as seconds. #cache.expiration: 5m - # Source maps may be fetched from Elasticsearch by using the output.elasticsearch configuration, - # and running apm-server standalone. + # Source map retrieval location. # - # Note: fetching source maps from Elasticsearch is not supported if apm-server is being managed by - # Fleet. This configuration is only applicable to standalone apm-servers, for backwards compatibility - # with source maps stored in Elasticsearch by older versions of apm-server. New source maps must now - # be uploaded via Kibana, and `apm-server.kibana` configured in standalone apm-servers for fetching - # them. + # If using an output other than Elasticsearch that is writing to Elasticsearch, you must + # set this option. If not set, the standard output elasticsearch configuration is used. #elasticsearch: # Array of hosts to connect to. # Scheme and port can be left out and will be set to the default (`http` and `9200`). From 310324d2a2b370d60b0bf0e21be331d1e6a74fcd Mon Sep 17 00:00:00 2001 From: Colleen McGinnis Date: Thu, 30 Nov 2023 16:55:59 -0600 Subject: [PATCH 3/4] address feedback from @simitt --- docs/source-map-how-to.asciidoc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/source-map-how-to.asciidoc b/docs/source-map-how-to.asciidoc index 76d178fbf73..430803cc13f 100644 --- a/docs/source-map-how-to.asciidoc +++ b/docs/source-map-how-to.asciidoc @@ -97,7 +97,7 @@ module.exports = { [[source-map-rum-upload]] === Upload the source map -TIP: Before uploading a source map, ensure that RUM support is enabled in the APM integration. +TIP: When uploading a source map, ensure that RUM support is enabled in the APM integration. {kib} exposes a {kibana-ref}/rum-sourcemap-api.html[source map endpoint] for uploading source maps. Source maps can be uploaded as a string, or as a file upload. @@ -172,9 +172,7 @@ request.post({url: 'http://localhost:5601/api/apm/sourcemaps',formData: formData [[source-map-next]] === What happens next -Source maps are stored in {es}. When you upload a source map, a new {es} index is created +Source maps are stored in {es}. When you upload a source map, a new {es} document is created containing the contents of the source map. - -Then APM Server will periodically poll those documents to maintain a map of in-memory metadata. -When stack traces match the in-memory metadata, the corresponding source map is fetched, -parsed, and cached on demand. +When a RUM request comes in, APM Server will make use of these source map documents to apply the +source map logic to the event's stack traces. From fbfb15097785f7550bea9b834c83fd35d96672ef Mon Sep 17 00:00:00 2001 From: Colleen McGinnis Date: Mon, 4 Dec 2023 11:44:20 -0600 Subject: [PATCH 4/4] Update docs/source-map-how-to.asciidoc --- docs/source-map-how-to.asciidoc | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source-map-how-to.asciidoc b/docs/source-map-how-to.asciidoc index 430803cc13f..c8b03a785d2 100644 --- a/docs/source-map-how-to.asciidoc +++ b/docs/source-map-how-to.asciidoc @@ -167,7 +167,6 @@ request.post({url: 'http://localhost:5601/api/apm/sourcemaps',formData: formData }) ---- -// Not sure what to call this section... [float] [[source-map-next]] === What happens next