• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

Ionic Capacitor モバイル アプリを監視する

New Relic Ionic Capacitor エージェントは、Ionic Capacitor モバイル アプリを監視し、アプリのパフォーマンス、エラー、ユーザー エクスペリエンスに関する深い洞察を提供します。このエージェントには New Relic のネイティブ エージェントが自動的に組み込まれ、モバイル監視とパフォーマンスの可視化が提供されます。エージェントをインストールして構成すると、次のことができるようになります。

  • Capture JavaScript errors:

    問題を迅速に特定して修正します。

  • Track network requests:

    アプリがバックエンドとどのように対話するかを確認します。

  • Use distributed tracing:

    処理された例外をドリルダウンして、根本原因を見つけます。

  • Create custom events and metrics:

    ユーザーがアプリをどのように操作するかを理解します。

詳細については、 Github の New Relic Ionic Capacitor エージェントを参照してください。

互換性要件

エージェントをインストールする前に、アプリが次の要件を満たしていることを確認してください。

(推奨) ガイド付きインストール

エージェントをインストールするには、UI に直接ある ガイド付きインストールに従ってください。

手動インストール

エージェントを手動でインストールする必要がある場合は、次の手順に従います。

アプリケーショントークンを作成する

  1. one.newrelic.com > Browser & Mobile > (choose Android or iOS)

    に移動し、UI でインストゥルメンテーションの手順を完了します。

  2. UI の

    Step 4

    から、アプリケーション トークン (該当する場合、iOS と Android 用の 1 つ) をコピーします。

Capacitor エージェントを追加する

プロジェクト ディレクトリで、コマンド ライン ツールを使用して Capacitor エージェントをプロジェクトに追加します。

bash
$
npm install @newrelic/newrelic-capacitor-plugin
$
npx cap sync

コンデンサを構成する

  1. main.ts (Angular または Vue) またはindex.tsx (React) でアプリの初期化で Capacitor エージェントを開始します。

  2. 次のコードを追加します。

    import { NewRelicCapacitorPlugin, NREnums, AgentConfiguration } from '@newrelic/newrelic-capacitor-plugin';
    import { Capacitor } from '@capacitor/core';
    var appToken;
    if(Capacitor.getPlatform() === 'ios') {
    appToken = '<IOS-APP-TOKEN>';
    } else {
    appToken = '<ANDROID-APP-TOKEN>';
    }
    if(Capacitor.getPlatform() === 'ios') {
    appToken = '<IOS-APP-TOKEN>';
    } else {
    appToken = '<ANDROID-APP-TOKEN>';
    }
    let agentConfig : AgentConfiguration = {
    //Android Specific
    // Optional:Enable or disable collection of event data.
    analyticsEventEnabled: true,
    // Optional:Enable or disable crash reporting.
    crashReportingEnabled: true,
    // Optional:Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
    interactionTracingEnabled: true,
    // Optional:Enable or disable reporting successful HTTP requests to the MobileRequest event type.
    networkRequestEnabled: true,
    // Optional:Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
    networkErrorRequestEnabled: true,
    // Optional:Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
    httpResponseBodyCaptureEnabled: true,
    // Optional:Enable or disable agent logging.
    loggingEnabled: true,
    // Optional:Specifies the log level. Omit this field for the default log level.
    // Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).
    logLevel: NREnums.LogLevel.INFO,
    // iOS Specific
    // Optional:Enable/Disable automatic instrumentation of WebViews
    webViewInstrumentation: true,
    // Optional:Set a specific collector address for sending data. Omit this field for default address.
    // collectorAddress: "",
    // Optional:Set a specific crash collector address for sending crashes. Omit this field for default address.
    // crashCollectorAddress: "",
    // Optional:Enable or disable sending JS console logs to New Relic.
    sendConsoleEvents: true,
    // Optional:Enable or disable reporting data using different endpoints for US government clients
    //fedRampEnabled: false
    // Optional: Enable or disable offline data storage when no internet connection is available.
    offlineStorageEnabled: true
    }
    NewRelicCapacitorPlugin.start({appKey:appToken, agentConfiguration:agentConfig})

    アプリケーション トークンを上記のコードのappToken = ""に貼り付けてください。ハイブリッド アプリを iOS と Android の両方のプラットフォームにデプロイした場合は、2 つの個別のトークン (iOS 用と Android 用) を追加する必要があります。

(Android のみ) Android ネイティブ アプリを監視している場合は、次の手順に従います。

  1. New Relic ネイティブ Android エージェントをインストールします

  2. build.gradleを更新:

    buildscript {
    ...
    repositories {
    ...
    mavenCentral()
    }
    dependencies {
    ...
    classpath "com.newrelic.agent.android:agent-gradle-plugin:6.11.1"
    }
    }
  3. app/build.gradleを更新:

    apply plugin: "com.android.application"
    apply plugin: 'newrelic' // <-- add this
  4. AndroidManifest.xmlに次の行を追加して、アプリがINTERNETACCESS_NETWORK_STATEの権限をリクエストしていることを確認してください。

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  5. パッケージを自動的にリンクするには、プロジェクトを再構築します。

    bash
    $
    # Android apps
    $
    ionic capacitor run android
    $
    # iOS apps
    $
    ionic capacitor run ios

アプリをデプロイする

次に、アプリをデプロイします。アプリのアクティビティが完了すると、New Relic にデータが表示されるはずです (アプリのデプロイ後、数分かかる場合があります)。

エージェントのインストルメンテーションをカスタマイズする

エージェントのインストルメンテーションをカスタマイズする必要がありますか?パブリック モバイル SDK API メソッドを使用すると、カスタム データの収集、デフォルト設定の構成などが可能になります。

Capacitor エージェントでは次のカスタマイズが可能です。

あなたがしたい場合は...

この方法を使用してください

ブレッドクラムを記録して、クラッシュのトラブルシューティングに役立つアプリのアクティビティを追跡します。

パン粉の記録

メソッドをインタラクションとして追跡します。

インタラクションを開始する

インタラクションを停止する

カスタムエラーを記録します。

カスタムエラーを記録する

カスタムメトリクスの記録

カスタムメトリクスの記録

カスタム属性とイベントを記録します。

カスタム属性とイベントをレポートするには、いくつかの方法があります。

カスタム ネットワーク リクエストと障害を追跡します。

HTTPリクエストを追跡する

失敗したHTTPリクエストを追跡する

エージェントをシャットダウンします。

エージェントのシャットダウン

デフォルトのモバイル監視設定を有効/無効にします。

監視機能の有効化/無効化

テストクラッシュレポートを実行します。

テストクラッシュレポート

JavaScript エラーのトラブルシューティング

Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.