SourceMap のアップロード

この記事では、コントローラ UI と REST API を使用して SourceMap をアップロードする方法について説明します。

コントローラ UI でのソースマップのアップロード

  1. 左側のパネルで、[Configuration] をクリックします。
  2. ProGuard Mapping & NDK Symbol Files & Source Maps をクリックします。
  3. [Upload Missing ProGuard Mapping] ダイアログで、次の操作を実行します。
    1. パッケージのバージョン名を入力します。これは、このマッピングファイルが生成されたアプリケーションの AndroidManifest.xml ファイルまたは build.gradle ファイルのいずれかで指定された versionName プロパティです。
    2. [Choose File.] をクリックします。アップローダは.txt 拡張子を持つファイルを想定します。ファイルの名前は mapping.txt です。
    3. ファイルブラウザでマッピングファイルを見つけて選択し、Open をクリックします。
    4. Upload をクリックします。

Upload Source Maps with the REST API

The API uses HTTP basic authentication. The username is your Splunk AppDynamics EUM account name and the password is your EUM license key.

注: If you wish to disable this REST API and use the Controller API that uses the token-based upload, contact Splunk AppDynamics Support.

Send the Source Mapping file

Send the mapping file as a text file in the body of the PUT request to the following URL:
Americas

        
CODE
https://api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping
EMEA
CODE
https://fra-api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping
APAC
CODE
https://syd-api.eum-appdynamics.com/v2/account/<MyAccountName>/<app-key>/<androidPackageName>/<version-string>/[Android/iOS]/jssource-mapping

See SaaS Domain and IP Ranges for more EUM server locations.

These parameters are required:

  • MyAccountName : the URL-encoded version of your account name.
  • androidPackagename : the name of the Android package for which this mapping file was generated.
  • versionName : the string representation of the "version-string" property specified in either the AndroidManifest.xml file or the build.gradle file of the application for which this mapping file was generated.

The request body contains the mapping file. You are required to add a Content-Type -H Content-Type:text/plain,

Sample Request and Response Using the REST API

This is a sample request and response using the REST API.

Upload Request

The following example uses curl to send a Source Map file. You would use a similar command to send a DexGuard mapping file. The account name is "Example account" and the license key/password is "Example-License-Key-4e8ec2ae6cfe". The plus signs replace spaces in the account name when the account name is URL-encoded. The package name of the Android application is "com.appdynamics.android.ReactNativeEveryFeature". The mapping file corresponds to the version with versionName

Syntax

CODE
curl -v -H Content-Type:text/plain --upload-file main.jsbundle.map --user <EUMAccountName>:<license-key> https://api.eum-appdynamics.com/v2/account/<EUMAccountName>/<App-key>/<App-Name>/<version>/<Android/IOS>/jssource-mapping

Examples:

Android
CODE
curl -v -H Content-Type:text/plain --upload-file "index.android.bundle.txt" --user Example+account:Example-License-Key-4e8ec2ae6cfe https://shadow-eum-api.appdynamics.com/v2/Example+account/SH-AAB-AAE-WNX/com.appdynamics.android.ReactNativeEveryFeature/1/Android/jssource-mapping
iOS
CODE
curl -v -H Content-Type:text/plain --upload-file main.jsbundle.map" --user Example+account:Example-License-Key-4e8ec2ae6cfe https://shadow-eum-api.eum-appdynamics.com/v2/account/Example+account/SH-AAB-AAE-WNX/com.appdynamics.ios.ReactNativeEveryFeature/1.0/iOS/jssource-mapping

The API uses HTTP basic authentication. The username is your Splunk AppDynamics EUM account name and the password is your EUM license key.

Upload Request

The following example uses curl to send a Source Mapping file. You would use a similar command to send a DexGuard mapping file. The account name is "Example account" and the license key/password is "Example-License-Key-4e8ec2ae6cfe". The plus signs replace spaces in the account name when the account name is URL-encoded. The package name of the Android application is "com.example.networklogger". The mapping file corresponds to the version with versionName.

Upload Response
The successful output of the example request looks like this:
Americas
CODE
* About to connect() to api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to api.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host api.eum-appdynamics.com left intact
* Closing connection #0
EMEA
CODE
* About to connect() to fra-api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to fra-api.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: fra-api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host fra-api.eum-appdynamics.com left intact
* Closing connection #0
APAC
CODE
* About to connect() to syd-api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to syd.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/jssource-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: syd-api.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host syd-api.eum-appdynamics.com left intact
* Closing connection #0

トークンを使用した REST API でのソースマップのアップロード

注: トークンベースのアップロードを使用するには、次のプロパティが有効になっていることを確認します。
CODE
MAPPING_FILE_UPLOAD_API_DISABLED: True

ソースマップファイルをアップロードするには、次の手順を実行します。

  1. ファイルをアップロードするためのトークンを生成します。
    CODE
    curl -L -X GET -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/fileUploadToken'
  2. アプリケーション ID を取得します。
    CODE
    curl -L -X GET -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/getApplicationId/<App key>'
  3. ソースマップファイルをアップロードします。
    CODE
    curl -L -X POST -u <username>@<accountName>:<password> '<controller base url>/controller/restui/mobileRUMConfig/uploadSourceMappingFile/<applicationID>?token=<token>' -F 'fileData=@"<source map file PATH"' -F 'mobileAppName="<app name>"' -F 'versionName="<version-string>"' -F 'platform="<Platform>"'>