• English日本語한국어
  • 로그인지금 시작하기

이 한글 문서는 사용자의 편의를 위해 기계 번역되었습니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

Flutter 앱 모니터링

New Relic Flutter 에이전트로 Flutter 애플리케이션을 모니터링하세요. Dart 오류를 캡처하고, 특정 네트워크 요청을 추적하고, 분산 추적을 사용하여 처리된 예외를 드릴다운하고, 사용자 정의 추적 이벤트 및 지표를 생성하여 최종 사용자의 경험을 완전히 캡처하십시오.

Summary view of a flutter app in New Relic

one.newrelic.com > Mobile > (앱 선택) > Summary: Flutter 데이터 보기, HTTP 요청 및 오류 추적, 시간 경과에 따른 앱 성능 모니터링.

시작할 준비가 되셨습니까? 아래 단계를 따르십시오!

Flutter 에이전트 설치

Step 1 of 5

요구 사항 검토

Flutter 에이전트를 설치하기 전에 Flutter 앱이 다음 버전 요구 사항을 충족하는지 확인하세요.

Step 2 of 5

프로젝트에 Flutter 에이전트 추가

먼저 Flutter 에이전트를 dart 프로젝트에 추가해야 합니다. pubspec.yaml에서 다음을 dependencies에 추가합니다.

dependencies:
newrelic_mobile: 0.0.1
Step 3 of 5

애플리케이션 토큰 복사

애플리케이션 토큰은 New Relic이 Flutter 앱의 데이터를 인증하는 데 사용됩니다.

New Relic UI에서 애플리케이션 토큰을 보고 복사하려면:

  1. one.newrelic.com으로 이동합니다. Add data클릭한 다음 Mobile클릭합니다.

  2. Flutter 앱을 선택합니다.

  3. Settings > Application 으로 이동하여 표시된 Application token복사합니다.

    다음 단계에서 이 애플리케이션 토큰을 추가합니다.

Step 4 of 5

Flutter 프로젝트 구성

Flutter 프로젝트에서 main.dart 열고 다음 코드를 추가합니다.

import 'package:newrelic_mobile/newrelic_mobile.dart';
var appToken = "";
if (Platform.isAndroid) {
appToken = "<android app token>"; // Replace with your application token copied from the New Relic UI.
} else if (Platform.isIOS) {
appToken = "<ios app token>"; // Replace with your application token copied from the New Relic UI.
}
Config config =
Config(accessToken: appToken,
//Android Specific
// Optional: Enable or disable collection of event data.
analyticsEventEnabled: true,
// Optional: Enable or disable reporting successful HTTP requests to the MobileRequest event type.
networkErrorRequestEnabled: true,
// Optional: Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
networkRequestEnabled: 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 capture of HTTP response bodies for HTTP error traces and MobileRequestError events.
httpResponseBodyCaptureEnabled: true,
// Optional: Enable or disable agent logging.
loggingEnabled: true,
// iOS specific
// Optional: Enable or disable automatic instrumentation of WebViews
webViewInstrumentation: true,
//Optional: Enable or disable Print Statements as Analytics Events
printStatementAsEventsEnabled : true,
// Optional: Enable or disable automatic instrumentation of HTTP Request
httpInstrumentationEnabled:true
);
NewrelicMobile.instance.start(config, () {
runApp(MyApp());
});
class MyApp extends StatelessWidget {
....

애플리케이션 토큰( 3단계에서 복사)을 위 코드의 appToken = "" 에 붙여넣었는지 확인하세요. Android 기본 앱과 iOS 기본 앱을 모두 모니터링하는 경우 둘 다에 대해 별도의 토큰을 추가해야 합니다.

Step 5 of 5

(Android 전용) Android 앱 구성

Android 네이티브 앱이 있는 경우 Android 앱에서 다음과 같이 변경해야 합니다.

  1. 앱의 android/build.gradle 파일에 다음 변경 사항을 추가합니다.

    buildscript {
    ...
    repositories {
    ...
    mavenCentral()
    }
    dependencies {
    ...
    classpath "com.newrelic.agent.android:agent-gradle-plugin:${latest_android_version}"
    }
    }
  2. android/app/build.gradle 파일 상단에 newrelic 플러그인을 적용합니다.

    apply plugin: "com.android.application"
    apply plugin: 'newrelic' // <-- add this
  3. AndroidManifest.xml 파일에 INTERNETACCESS_NETWORK_STATE 권한을 추가합니다.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    그리고 끝났습니다! 5분 이내에 New Relic에서 데이터를 보기 시작해야 합니다.

New Relic에서 Flutter 앱 데이터 보기

Flutter 에이전트가 New Relic으로 데이터를 전송했으므로 이제 New Relic에서 앱 데이터를 볼 차례입니다.

one.newrelic.com > Mobile > (Flutter 앱 선택) > Summary 이동하여 시간 경과에 따른 데이터 요약을 확인합니다.

Flutter 에이전트를 사용하면 크래시 추적, HTTP 요청 및 처리된 예외와 같은 모든 모바일 모니터링 기능에 액세스할 수 있습니다. 자세한 내용은 다음 기능 페이지를 확인하세요.

UI에서 누락된 데이터 문제 해결

UI에서 HTTP 데이터를 찾는 데 문제가 있습니까?

문제

Flutter 에이전트를 설치하고 5분 이상 기다린 후 HTTP errorsHTTP requests UI 페이지에 No HTTP data appears .

해결책

5분 이상 기다린 후에도 HTTP 데이터가 표시되지 않으면 Flutter 앱 내에서 HttpOverrides.global 재정의하고 있지 않은지 확인하세요.

Flutter 로그 데이터 쿼리

New Relic은 Flutter 로그를 맞춤 이벤트로 저장합니다. 이 NRQL 쿼리를 사용하여 이러한 로그를 쿼리하고 대시보드를 빌드할 수 있습니다.

SELECT * FROM Mobile Dart Console Events SINCE 30 MINUTES AGO

NRQL 쿼리에 대한 자세한 내용은 NRQL 소개를참조하십시오.

(선택 사항) Flutter 에이전트 계측 사용자 지정

New Relic이 데이터를 수집하고 보고하는 방법을 추가로 사용자 정의하려면 다음 선택적 API 호출을 확인하십시오.

iOS 또는 Android SDK API를 사용하여 사용자 지정 이벤트 및 메트릭을 생성합니다. 여기 몇 가지 예가 있어요.

Copyright © 2023 New Relic Inc.

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