Search in sources :

Example 21 with Trace

use of com.google.firebase.perf.metrics.Trace in project capacitor-firebase by robingenz.

the class FirebasePerformance method incrementMetric.

public void incrementMetric(String traceName, String metricName, Integer incrementBy) {
    Trace trace = this.traces.get(traceName);
    trace.incrementMetric(metricName, incrementBy);
}
Also used : Trace(com.google.firebase.perf.metrics.Trace)

Example 22 with Trace

use of com.google.firebase.perf.metrics.Trace in project capacitor-firebase by robingenz.

the class FirebasePerformancePlugin method incrementMetric.

@PluginMethod
public void incrementMetric(PluginCall call) {
    String traceName = call.getString("traceName");
    String metricName = call.getString("metricName");
    Integer incrementBy = call.getInt("incrementBy", 1);
    if (traceName == null) {
        call.reject(ERROR_TRACE_NAME_MISSING);
        return;
    }
    if (metricName == null) {
        call.reject(ERROR_METRIC_NAME_MISSING);
        return;
    }
    Trace trace = implementation.getTraceByName(traceName);
    if (trace == null) {
        call.reject(ERROR_TRACE_NOT_FOUND);
        return;
    }
    implementation.incrementMetric(traceName, metricName, incrementBy);
    call.resolve();
}
Also used : Trace(com.google.firebase.perf.metrics.Trace) PluginMethod(com.getcapacitor.PluginMethod)

Example 23 with Trace

use of com.google.firebase.perf.metrics.Trace in project capacitor-firebase by robingenz.

the class FirebasePerformancePlugin method startTrace.

@PluginMethod
public void startTrace(PluginCall call) {
    String traceName = call.getString("traceName");
    if (traceName == null) {
        call.reject(ERROR_TRACE_NAME_MISSING);
        return;
    }
    Trace trace = implementation.getTraceByName(traceName);
    if (trace != null) {
        call.reject(ERROR_TRACE_NAME_ALREADY_ASSIGNED);
        return;
    }
    implementation.startTrace(traceName);
    call.resolve();
}
Also used : Trace(com.google.firebase.perf.metrics.Trace) PluginMethod(com.getcapacitor.PluginMethod)

Example 24 with Trace

use of com.google.firebase.perf.metrics.Trace in project snippets-android by firebase.

the class MainActivity method basicTrace.

// [END perf_traced_create]
public void basicTrace() {
    ItemCache cache = new ItemCache();
    // [START perf_basic_trace_start]
    Trace myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
    myTrace.start();
    // [END perf_basic_trace_start]
    // [START perf_basic_trace_increment]
    Item item = cache.fetch("item");
    if (item != null) {
        myTrace.incrementMetric("item_cache_hit", 1);
    } else {
        myTrace.incrementMetric("item_cache_miss", 1);
    }
    // [END perf_basic_trace_increment]
    // [START perf_basic_trace_stop]
    myTrace.stop();
// [END perf_basic_trace_stop]
}
Also used : ItemCache(com.google.firebase.example.perf.kotlin.model.ItemCache) Trace(com.google.firebase.perf.metrics.Trace) AddTrace(com.google.firebase.perf.metrics.AddTrace) Item(com.google.firebase.example.perf.kotlin.model.Item)

Example 25 with Trace

use of com.google.firebase.perf.metrics.Trace in project snippets-android by firebase.

the class MainActivity method piiExamples.

public void piiExamples() {
    Trace trace = FirebasePerformance.getInstance().newTrace("trace");
    User user = new User();
    // [START perf_attr_no_pii]
    trace.putAttribute("experiment", "A");
    // [END perf_attr_no_pii]
    // [START perf_attr_pii]
    trace.putAttribute("email", user.getEmailAddress());
// [END perf_attr_pii]
}
Also used : Trace(com.google.firebase.perf.metrics.Trace) AddTrace(com.google.firebase.perf.metrics.AddTrace) User(com.google.firebase.example.perf.kotlin.model.User)

Aggregations

Trace (com.google.firebase.perf.metrics.Trace)25 AddTrace (com.google.firebase.perf.metrics.AddTrace)11 SharedPreferences (android.content.SharedPreferences)6 ConnectivityManager (android.net.ConnectivityManager)6 LinkProperties (android.net.LinkProperties)6 Network (android.net.Network)6 FirebaseRemoteConfigSettings (com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings)6 ITransaction (io.sentry.ITransaction)6 Intent (android.content.Intent)5 Bundle (android.os.Bundle)5 View (android.view.View)5 ImageView (android.widget.ImageView)5 WebView (android.webkit.WebView)3 PluginMethod (com.getcapacitor.PluginMethod)3 PerfFrameMetrics (com.google.firebase.perf.metrics.FrameMetricsCalculator.PerfFrameMetrics)2 ApplicationProcessState (com.google.firebase.perf.v1.ApplicationProcessState)2 TraceMetric (com.google.firebase.perf.v1.TraceMetric)2 Test (org.junit.Test)2 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1