All Projects → pleak → pleak-react-perf-monitor

pleak / pleak-react-perf-monitor

Licence: BSD-2-Clause License
⚡️Performance monitoring for React and React Native apps with Pleak.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to pleak-react-perf-monitor

skywalking-swck
Apache SkyWalking Cloud on Kubernetes
Stars: ✭ 62 (+210%)
Mutual labels:  apm
bee-apm
BeeAPM is a distributed tracing system and APM ( Application Performance Monitoring )
Stars: ✭ 137 (+585%)
Mutual labels:  apm
pryin
PryIn is an Application Performance Monitoring platform for your Elixir/Phoenix application.
Stars: ✭ 25 (+25%)
Mutual labels:  apm
scout apm python
ScoutAPM Python Agent. Supports Django, Flask, and many other frameworks.
Stars: ✭ 54 (+170%)
Mutual labels:  apm
erda
An enterprise-grade Cloud-Native application platform for Kubernetes.
Stars: ✭ 2,304 (+11420%)
Mutual labels:  apm
skywalking-nodejs
The NodeJS agent for Apache SkyWalking
Stars: ✭ 81 (+305%)
Mutual labels:  apm
appsignal-nodejs
🟩 AppSignal for Node.js
Stars: ✭ 17 (-15%)
Mutual labels:  apm
apollo-link-tracer
Trace your apollo queries and mutations with https://github.com/apollographql/apollo-link
Stars: ✭ 20 (+0%)
Mutual labels:  apm
gateway
A proxy to buffer and forward metrics, events, and traces.
Stars: ✭ 94 (+370%)
Mutual labels:  apm
elastic-apm-agent-php
Elastic APM agent for PHP
Stars: ✭ 37 (+85%)
Mutual labels:  apm
etrace
A robust and functional Application Performance Monitor (APM) system
Stars: ✭ 45 (+125%)
Mutual labels:  apm
elastic-apm-agent
Elastic Application Performance Monitoring (APM) agent for PHP
Stars: ✭ 48 (+140%)
Mutual labels:  apm
skywalking-kong
Kong agent for Apache SkyWalking
Stars: ✭ 17 (-15%)
Mutual labels:  apm
observability-workshop
To get started, please proceed to The Splunk Observability Cloud Workshop Homepage.
Stars: ✭ 48 (+140%)
Mutual labels:  apm
PocketPilot
Smaller PocketBeagle version of the BBBmini flight controller.
Stars: ✭ 61 (+205%)
Mutual labels:  apm
FWDebug
iOS调试库,支持iOS11+,无需添加任何代码,方便iOS开发和测试。 iOS debugging library, support for iOS11 +, without adding any code to facilitate iOS development and testing.
Stars: ✭ 49 (+145%)
Mutual labels:  apm
egg-alinode
alinode plugin for egg
Stars: ✭ 54 (+170%)
Mutual labels:  apm
atom-yii2
Atom package for working with Yii Framework 2
Stars: ✭ 22 (+10%)
Mutual labels:  apm
weweibuy-framework
基于Springboot 封装的基础组件, 包括: Http请求响应日志,日志脱敏,APM, 加解密,签名(AES,BCrypt,RSA,JWT),数据库脱敏,报文脱敏,下滑线风格URL传参,统一异常处理,feign mock,feign日志,feign报文风格转换,跨应用异常上抛,自动补偿组件,幂等组件,RocketMq客户端
Stars: ✭ 24 (+20%)
Mutual labels:  apm
OneAgent-SDK
Describes technical concepts of Dynatrace OneAgent SDK
Stars: ✭ 15 (-25%)
Mutual labels:  apm

@pleak/react-perf-monitor

Performance monitoring for React and React Native apps with Pleak.

Table of contents

Getting started

Installation

# With npm
npm install @pleak/react-perf-monitor

# With yarn
yarn add @pleak/react-perf-monitor

React Native

If you're using this package with a React Native app, you must link native dependencies to your project with react-native-cli.

react-native link

This command will automatically find native dependencies and link them to your project.

Initializing

We recommend you to initialize the lib in a separate file and then import it when you need it.

import { Pleak } from '@pleak/react-perf-monitor';

const pleak = new Pleak({
  uri: 'YOUR_PLEAK_DSN',
});

export default pleak;

Options

Required

uri

Your Pleak DSN, required to publish to Pleak. The structure of your DSN should look like this:

https://{publicKey}@{host}/{appId}

Optional

debug

Defaults to false

If true, informations about events and publishing will be logged in console.

publish

Defaults to true

If true, collected events will be published on Pleak.

interval

Defaults to 5000

Events are not published one by one, they are stored and published in batch at an interval in milliseconds defined by this option.

environment

Defaults to process.env.NODE_ENV

Define tracked environment of your app in Pleak.

Usage

Once you installed and initialized the lib you can use it to monitor your React components like so:

import React, { Component } from 'react';
import pleak from '../pleak'; // Import the Pleak instance you defined earlier

class MyComponent extends Component {
  state = { user: null };

  constructor(props) {
    super(props);

    // Capture your component's performance
    pleak.captureComponentPerfs(this, {
      // Optional. Use the excludes option to avoid collecting events on specific methods
      excludes: ['render'],
    });
  }

  componentDidMount() {
    /* Optional.
    This allows you to attach a context to any event triggered by this method */
    pleak.setContext({
      time: Date.now(),
    });

    this.loadData();
  }

  loadData = async () => {
    const res = await fetch('https://jsonplaceholder.typicode.com/users/1');
    const user = await res.json();

    /* Optional.
    This allows you to attach a context to all events,
    from the moment when this method is triggered (overwritable) */
    pleak.setGlobalContext({
      user,
    });

    this.setState({
      user,
    });
  };

  render() {
    const { user } = this.state;

    return <div>Hello, {user ? user.name : 'world'}!</div>;
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].