async customTrace(traceName, customAttributes = null, customMetrics = null) {

    // Define & start a custom trace
    const trace = await firebase.perf().newTrace(traceName);

    await trace.start();

    // Define trace meta details: attributes
    if (customAttributes && Array.isArray(customAttributes)) {
      await customAttributes.forEach(attr => {
        if (attr) {
          console.log(attr);
          trace.putAttribute(attr.name, attr.value);
        }
      });

    }

    // Define trace meta details: metrics
    if (customMetrics && Array.isArray(customMetrics)) {
      await customMetrics.forEach(metric => {
        if (metric) {
          trace.putMetric(metric.name, metric.value);
        }
      });

    }

    await trace.incrementMetric(traceName, 1);

    // Stop the trace
    await trace.stop();
  }
// Trigger custom performance trace with support for array of attributes and array of metrics name-value
Trigger custom performance trace with support for array of attributes and array of metrics name-value
Trigger custom performance trace with support for array of attributes and array of metrics name - value
async customTrace(traceName, customAttributes = null, customMetrics = null) {
    const trace = await firebase.perf().newTrace(traceName);
    await trace.start();
    if (customAttributes && Array.isArray(customAttributes)) {
      await customAttributes.forEach(attr => {
        if (attr) {
          console.log(attr);
          trace.putAttribute(attr.name, attr.value);
        }
      });
    }
    if (customMetrics && Array.isArray(customMetrics)) {
      await customMetrics.forEach(metric => {
        if (metric) {
          trace.putMetric(metric.name, metric.value);
        }
      });
    }
    await trace.incrementMetric(traceName, 1);
    await trace.stop();
  }
async customTrace ( traceName , customAttributes = null , customMetrics = null ) { const trace = await firebase . perf ( ) . newTrace ( traceName ) ; await trace . start ( ) ; if ( customAttributes && Array . isArray ( customAttributes ) ) { await customAttributes . forEach ( attr => { if ( attr ) { console . log ( attr ) ; trace . putAttribute ( attr . name , attr . value ) ; } } ) ; } if ( customMetrics && Array . isArray ( customMetrics ) ) { await customMetrics . forEach ( metric => { if ( metric ) { trace . putMetric ( metric . name , metric . value ) ; } } ) ; } await trace . incrementMetric ( traceName , 1 ) ; await trace . stop ( ) ; }
Trigger custom performance trace with support for array of attributes and array of metrics name-value
Trigger custom performance trace with support for array of attributes and array of metrics name - value
// Define & start a custom trace // Define trace meta details: attributes // Define trace meta details: metrics // Stop the trace