UNPKG

@embrace-io/react-native-redux

Version:

Collects telemetry from dispatching actions with Redux

29 lines (28 loc) 972 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OUTCOMES = exports.STATIC_NAME = exports.ATTRIBUTES = exports.spanEnd = exports.spanStart = void 0; const react_native_1 = require("react-native"); const STATIC_NAME = "action"; exports.STATIC_NAME = STATIC_NAME; const ATTRIBUTES = { payload: `${STATIC_NAME}.payload`, type: `${STATIC_NAME}.type`, appState: `${STATIC_NAME}.state`, outcome: `${STATIC_NAME}.outcome`, }; exports.ATTRIBUTES = ATTRIBUTES; const OUTCOMES = { incomplete: "incomplete", success: "success", fail: "fail", }; exports.OUTCOMES = OUTCOMES; const spanStart = (tracer, name, options, context) => { return tracer.startSpan(name, options, context); }; exports.spanStart = spanStart; const spanEnd = (span, attributes) => { span.setAttributes(Object.assign({ [ATTRIBUTES.appState]: react_native_1.AppState.currentState }, attributes)); span.end(); }; exports.spanEnd = spanEnd;