Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

instana-redux-middleware

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instana-redux-middleware

Instana tracking for redux

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Redux Middleware for Instana

This middleware automatically reports navigation changes to Instana.

Usage

Navigation Tracking

Add it in your applyMiddleware funciton.

import { createStore, applyMiddleware } from 'redux';
import instanaMiddleware from 'instana-redux-middleware';
import rootReducer from './reducers/index';

const store = createStore(
  rootReducer,
  applyMiddleware(instanaMiddleware)
);

After adding the middleware navigation events will be sent to Instana.

Custom Tracking

If action.meta.instana is an array, those values will be sent as arguments to instana's API.

When using actions, the middleware attempts to time the actual time used in both loading and rendering. It will run calls to startSpaPageTransition immediately but defer endSpaPageTransition calls until after reducers have run and React has had a chance to render.

// this example uses redux-thunk
const myAction = args => dispatch => {
  dispatch({
    type: START_LOADING,
    meta: {
      instana: ['startSpaPageTransition']
    }
  });

  loadStuff(args).then(result => {
    dispatch({
      type: FINISH_LOADING,
      meta: {
        instana: [
          'endSpaPageTransition',
          {status: 'completed', url: window.location.href}
        ]
      }
      payload: result
    });
  }).catch(error => {
    dispatch({
      type: LOAD_ERROR,
      meta: {
        instana: [
          'endSpaPageTransition',
          {
            status: 'error',
            url: window.location.href
            explanation: error.description
          }
        ]
      },
      payload: error
    });
  })
}

of coures, you can still use the ienum global.

Why not use their navigation component?

The navigation component they provided only reports page transition time if all the data required for rendering is already in the store. If you're loading data and showing a spinner, it measures the amount of time it takes to show the spinner.

  • You can track the page transition time of your app including load times for data
  • It does not pollute the DOM.
  • Usage is transparent and can be added or removed easily.
  • Works with memory or hash based routing

Keywords

FAQs

Package last updated on 23 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc