Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Firebase Performance Monitoring React Native integration

$
0
0

I have install Firebase Performance monitoring on my React Native app and integrate it successfully. After i want to track my network requests performance and go through as documentation.

const trackRequest = async (url,method) => {
    // Define the network metric
    const metric = await perf().newHttpMetric(url, method);

    // Define meta details
    metric.putAttribute('testAttr', 'testValue');

    // Perform a HTTP request and provide response information
    const response = await fetch(url);
    metric.setHttpResponseCode(response.status);
    metric.setResponseContentType(response.headers.get('Content-Type'));
    metric.setResponsePayloadSize(response.headers.get('Content-Length'));

    // Stop the trace
    await metric.stop();

    return response.json();
};

I use this function from documentation and call it every network requests time

fetch("www.example.com")
trackRequest("www.example.com","GET")

Can anyone explain me what i were doing wrong ?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>