Giter VIP home page Giter VIP logo

newrelic-ios-agent's Introduction

New Relic Open Source community plus project banner.

New Relic iOS Agent

New Relic's mobile monitoring capabilities help you gain deeper visibility into how to analyze your iOS application performance and troubleshoot crashes. You can also examine HTTP and other network performance for unexpected lag, which will in turn help you collaborate more efficiently with your backend teams.

New Relic iOS Agent supports iOS ๐Ÿ“ฑ, tvOS ๐Ÿ“บ, and macOS (Catalyst) ๐Ÿ’ป.

This repository consists of an Xcode workspace containing the New Relic iOS Agent source code. The Agent is packaged as an XCFramework. The framework is available via Swift Package Manager (preferred installation method), Cocoapods, and as a zip file download.

See the XCFramework agent release notes for the latest release information. These release notes contain the link to the XCFramework zip file download.

Documentation

Installation

  1. From Xcode select File > Swift Packages > Add Package Dependency....
  2. Add the Github URL of the Package file:
https://github.com/newrelic/newrelic-ios-agent

See Swift Package Manager agent installation instructions for more info.

View the docs for more installation methods.

Getting Started

If you have not created a Mobile Application in New Relic:

  • Click "+ Add data" in the top right,
  • In the Browser & Mobile section - please select the iOS tile, Select your Account
  • Name your app
  • Install the New Relic iOS Agent to your supported application. This should be an iOS, tvOS, or Catalyst app. Follow the instructions to install via the Swift Package Manager
  • You can also select the "+ Add data" option from the user menu in the upper right corner of the top navigation, then the iOS button to access the installation page.

If you have previously created a Mobile Application in New Relic:

  • Click the name of your mobile app,
  • Choose Installation from the Settings section in the left nav, and
  • Install the New Relic iOS Agent to your supported application. This should be an iOS, tvOS, or Catalyst app. Follow the instructions to install via the Swift Package Manager

Usage

An example app which demonstrates usage of the New Relic iOS Agent is included in the Agent workspace.

  • From Xcode change to the NRTestApp scheme to run the example app.
  • Add your New Relic application token to NRAPIInfo.plist as a String under the key NRAPIKey.

dSYM Upload Tools

By default, the New Relic iOS Agent will report crashes to New Relic. In order to view symbolicated crashes, your app must upload its debugging symbols to New Relic. The Agent contains the run-symbol-tool script for this purpose.

  • Xcode Run Script: Copy and paste the following line, replacing APP_TOKEN with your application token:

iOS agent 7.4.0 or higher:

ARTIFACT_DIR="${BUILD_DIR%Build/*}"
SCRIPT=`/usr/bin/find "${SRCROOT}" "${ARTIFACT_DIR}" -type f -name run-symbol-tool | head -n 1`
/bin/sh "${SCRIPT}" "APP_TOKEN"
  • Add --debug as additional argument after the app token to write additional details to the upload_dsym_results.log file.

iOS agent 7.3.8 or lower:

SCRIPT=`/usr/bin/find "${SRCROOT}" -name newrelic_postbuild.sh | head -n 1`

if [ -z "${SCRIPT}"]; then
    ARTIFACT_DIR="${BUILD_DIR%Build/*}SourcePackages/artifacts"
    SCRIPT=`/usr/bin/find "${ARTIFACT_DIR}" -name newrelic_postbuild.sh | head -n 1`
fi

/bin/sh "${SCRIPT}" "APP_TOKEN"

OPTIONAL:

Add the following lines to your build script above the existing lines to skip symbol upload during debugging:

if [ ${CONFIGURATION} = "Debug" ]; then
    echo "Skipping DSYM upload CONFIGURATION: ${CONFIGURATION}"
    exit 0
fi

Note for Cocoapods or manual XCFramework integration:

With the 7.4.6 release the dsym-upload-tools are no longer included inside the XCFramework. The dsym-upload-tools are available in the dsym-upload-tools folder of the https://github.com/newrelic/newrelic-ios-agent-spm Swift Package Manager repository. Please copy this dsym-upload-tools directory to your applications source code directory if you are integrating the New Relic iOS Agent by copying XCFramework into project or using cocoapods.

The run-symbol-tool Run script must be added to your app's Xcode project build phases.

  • dsym-upload-tools/run-symbol-tool: Shell script which is used to bootstrap Swift script.
  • dsym-upload-tools/run-symbol-tool.swift: Swift script which converts dSYMs to map files and uploads to New Relic.

Building

  • To check out the code, run the following git command. Note the recursive submodule addition to make sure we get the repo's git submodules.

  • Open newrelic-ios-agent/Agent.xcworkspace using the Finder.

  • Option 1: Build using Xcode.

  • Option 2: Build using Fastlane

    • bundle exec fastlane buildFramework
      • Run the above command to create the New Relic iOS Agent XCFramework.

Testing

  • Option 1: Run the Unit Tests using Xcode by selecting Agent-iOS scheme and Product -> Test
  • Option 2: Running tests using Fastlane
    • bundle exec fastlane runIOSTests
      • Run above command to run tests on iOS. Upon completion, code coverage will be generated.
        • run brew install lcov to add lcov for code coverage.

Links

Support

New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub. You can find this project's topic/threads here: Mobile topic on forum.newrelic.com

Contribute

We encourage your contributions to improve New Relic iOS Agent! Keep in mind that, when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at [email protected].

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to New Relic iOS agent.

License

New Relic iOS Agent is licensed under the Apache 2.0 License. The New Relic iOS agent also uses source code from third-party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the third-party notices.

newrelic-ios-agent's People

Contributors

cdillard-newrelic avatar cliftondobrich avatar github-actions[bot] avatar justinrush-nr avatar kennyt276 avatar mbruin-nr avatar smalsam-newr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newrelic-ios-agent's Issues

`AppLaunch/Cold` is suspiciosly big

Description

I receive AppLaunch/Cold stats of 18-20 seconds. I also have tried Sentry (not at the same time with the NR agent). From Sentry I receive values that do not exceed 2 seconds. I'm not sure whether this is a bug or Sentry just calculates cold launch time differently.

Here are cold launch times I receive from the NR agent:
21.7, 21.35, 29.6, 39.2, 5.52, 55.5 (in seconds)

I wonder what is the finish point of the cold launch timer? Could some background process within the app affect this? E.g. the app screen may be loaded, and user could be able to use the app, but some stuck background request which affects the cold launch time

(warm launch times are ok, and all are less than 0.5sec)

[Repolinter] Open Source Policy Issues

Repolinter Report

๐Ÿค–This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

โ— Error โŒ Fail โš ๏ธ Warn โœ… Pass Ignored Total
0 0 0 7 0 7

Passed #

Click to see rules

โœ… license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

โœ… readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-by-default.

โœ… readme-starts-with-community-plus-header #

The first 5 lines contain all of the requested patterns. (README.md). The README of a community plus project should have a community plus header at the start of the README. If you already have a community plus header and this rule is failing, your header may be out of date, and you should update your header with the suggested one below. For more information please visit https://opensource.newrelic.com/oss-category/.

โœ… readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends putting a link to the open source security policy for your project (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in the README. For an example of this, please see the "a note about vulnerabilities" section of the Open By Default repository. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… readme-contains-forum-topic #

Contains a link to the appropriate forum.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate forum.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… code-of-conduct-should-not-exist-here #

New Relic has moved the CODE_OF_CONDUCT file to a centralized location where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other CODE_OF_CONDUCT file in a repository is now redundant and should be removed. Note that you will need to adjust any links to the local CODE_OF_CONDUCT file in your documentation to point to the central file (README and CONTRIBUTING will probably have links that need updating). For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view. Did not find a file matching the specified patterns. All files passed this test.

โœ… third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file can be present in your repository to grant attribution to all dependencies being used by this project. This document is necessary if you are using third-party source code in your project, with the exception of code referenced outside the project's compiled/bundled binary (ex. some Java projects require modules to be pre-installed in the classpath, outside the project binary and therefore outside the scope of the THIRD_PARTY_NOTICES). Please review your project's dependencies and create a THIRD_PARTY_NOTICES.md file if necessary. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.