หน้านี้มีคำแนะนำในการแก้ปัญหาสำหรับการเริ่มต้นใช้งานการตรวจสอบประสิทธิภาพหรือการใช้คุณลักษณะและเครื่องมือการตรวจสอบประสิทธิภาพ
ตรวจสอบการแก้ไขปัญหาเบื้องต้น
การตรวจสอบสองรายการต่อไปนี้เป็นแนวทางปฏิบัติที่ดีที่สุดทั่วไปที่แนะนำสำหรับทุกคนก่อนที่จะแก้ไขปัญหาเพิ่มเติม
1. ตรวจสอบข้อความบันทึกสำหรับเหตุการณ์ประสิทธิภาพ
ตรวจสอบข้อความบันทึกเพื่อให้แน่ใจว่า Performance Monitoring SDK กำลังบันทึกเหตุการณ์ประสิทธิภาพ
เปิดเครื่องมือสำหรับนักพัฒนาของเบราว์เซอร์ของคุณ (เช่น แท็บเครือข่ายสำหรับ Chrome Dev Tools หรือใน การตรวจสอบเครือข่ายสำหรับ Firefox )
รีเฟรชเว็บแอปของคุณในเบราว์เซอร์
ตรวจสอบข้อความบันทึกของคุณเพื่อหาข้อความแสดงข้อผิดพลาด
หลังจากนั้นสักครู่ ให้มองหาการเรียกเครือข่ายไปที่
firebaselogging.googleapis.com
ในเครื่องมือสำหรับนักพัฒนาของเบราว์เซอร์ของคุณ การมีอยู่ของการโทรผ่านเครือข่ายแสดงว่าเบราว์เซอร์กำลังส่งข้อมูลประสิทธิภาพไปยัง Firebase
หากแอปของคุณไม่บันทึกกิจกรรมด้านประสิทธิภาพ ให้อ่าน เคล็ดลับการแก้ปัญหา
2. ตรวจสอบแดชบอร์ดสถานะ Firebase
ตรวจสอบ แดชบอร์ดสถานะของ Firebase ในกรณีที่ทราบการหยุดทำงานของ Firebase หรือสำหรับการตรวจสอบประสิทธิภาพ
เริ่มต้นใช้งานการตรวจสอบประสิทธิภาพ
หากคุณเริ่มต้นใช้งานการตรวจสอบประสิทธิภาพ ( iOS+ | Android | เว็บ ) เคล็ดลับการแก้ปัญหาต่อไปนี้สามารถช่วยแก้ปัญหาที่เกี่ยวข้องกับ Firebase ตรวจพบ SDK หรือแสดงข้อมูลประสิทธิภาพแรกในคอนโซล Firebase
Firebase สามารถตรวจจับได้ว่าคุณเพิ่ม Performance Monitoring SDK ลงในแอปสำเร็จหรือไม่ เมื่อได้รับข้อมูลเหตุการณ์ (เช่น การโต้ตอบกับแอป) จากแอปของคุณ โดยปกติภายใน 10 นาทีหลังจากเริ่มแอป แดชบอร์ด ประสิทธิภาพ ของคอนโซล Firebase จะแสดงข้อความ "ตรวจพบ SDK" จากนั้นภายใน 30 นาที แดชบอร์ดจะแสดงข้อมูลที่ประมวลผลเริ่มต้น
หากคุณเพิ่ม SDK เวอร์ชันล่าสุดลงในแอปเป็นเวลานานกว่า 10 นาทีแล้ว และคุณยังคงไม่เห็นการเปลี่ยนแปลงใดๆ ให้ตรวจสอบข้อความบันทึก เพื่อให้แน่ใจว่า Performance Monitoring กำลังบันทึกเหตุการณ์ ลองทำตามขั้นตอนการแก้ปัญหาที่เหมาะสมตามที่อธิบายด้านล่างเพื่อแก้ปัญหาข้อความการตรวจจับ SDK ที่ล่าช้า
หากคุณยังคงพัฒนาในพื้นที่ ให้ลองสร้างเหตุการณ์เพิ่มเติมสำหรับการรวบรวมข้อมูล:
ให้บริการและดูเว็บแอปของคุณในสภาพแวดล้อมท้องถิ่น
สร้างกิจกรรมโดยการโหลดหน้าย่อยสำหรับไซต์ของคุณ โต้ตอบกับแอปของคุณ และ/หรือเรียกใช้คำขอของเครือข่าย ตรวจสอบให้แน่ใจว่าได้เปิดแท็บเบราว์เซอร์ไว้อย่างน้อย 10 วินาทีหลังจากโหลดหน้าเว็บ
ตรวจสอบให้แน่ใจว่าเพิ่ม ออบเจกต์การกำหนดค่า Firebase ลงในแอปอย่างถูกต้องแล้ว และคุณไม่ได้แก้ไขออบเจ็กต์ ตรวจสอบสิ่งต่อไปนี้โดยเฉพาะ:
- Firebase Web App ID (
appId
) ในวัตถุการกำหนดค่านั้นถูกต้องสำหรับแอปของคุณ ค้นหารหัสแอป Firebase ของคุณในการ์ด แอปของคุณ ใน ของคุณ การตั้งค่าโครงการ
หากมีสิ่งใดผิดปกติกับวัตถุกำหนดค่าในแอปของคุณ ให้ลองทำดังนี้:
ลบวัตถุกำหนดค่าที่คุณมีอยู่ในแอปของคุณ
ทำตาม คำแนะนำเหล่านี้ เพื่อรับวัตถุกำหนดค่าใหม่และเพิ่มไปยังเว็บแอปของคุณ
- Firebase Web App ID (
หาก SDK กำลังบันทึกเหตุการณ์และทุกอย่างดูเหมือนจะตั้งค่าอย่างถูกต้อง แต่คุณยังไม่เห็นข้อความตรวจพบ SDK หรือข้อมูลที่ประมวลผล (หลังจาก 2 ชั่วโมง) ให้ติดต่อ Firebase Support
ตรวจสอบให้แน่ใจว่า SDK การตรวจสอบประสิทธิภาพได้ รับการเริ่มต้น อย่างถูกต้องในแอปของคุณ
ตรวจสอบให้แน่ใจ ว่าไม่ได้ ปิดใช้งาน Performance Monitoring SDK ผ่านแฟล็กต่อไปนี้:
-
performance.instrumentationEnabled
-
ตรวจสอบให้แน่ใจว่า ได้ ปิดใช้งานการแคชของเบราว์เซอร์ มิฉะนั้น เบราว์เซอร์อาจไม่รับการตั้งค่าเครื่องมือวัดใหม่ใดๆ
ปิด แล้วเปิดแท็บหน้าเว็บอีกครั้ง ตรวจสอบการบันทึกอีกครั้ง
หากคุณเพิ่งเพิ่ม Performance Monitoring SDK ในแอป คุณอาจต้องรีสตาร์ทแอปทั้งหมดเพื่อให้ SDK เริ่มทำงาน
หากคุณไม่พบสิ่งที่ถูกปิดใช้งานในแอปของคุณ โปรดติดต่อฝ่ายสนับสนุนของ Firebase
การตรวจสอบประสิทธิภาพจะประมวลผลข้อมูลเหตุการณ์ประสิทธิภาพก่อนที่จะแสดงใน แดชบอร์ด ประสิทธิภาพ
หากผ่านไป นานกว่า 24 ชั่วโมงแล้วที่ข้อความ "ตรวจพบ SDK" ปรากฏขึ้น และคุณยังไม่เห็นข้อมูล ให้ตรวจสอบ แดชบอร์ดสถานะ Firebase ในกรณีที่ทราบว่ามีการหยุดทำงาน หากไม่มีการหยุดทำงาน โปรดติดต่อฝ่ายสนับสนุน Firebase
การแก้ไขปัญหาทั่วไป
หากคุณเพิ่ม SDK สำเร็จและกำลังใช้ Performance Monitoring ในแอปของคุณ เคล็ดลับการแก้ปัญหาต่อไปนี้สามารถช่วยแก้ปัญหาทั่วไปที่เกี่ยวข้องกับฟีเจอร์และเครื่องมือ Performance Monitoring
หากคุณไม่เห็น ข้อความบันทึกสำหรับเหตุการณ์ประสิทธิภาพ ให้ลองทำตามขั้นตอนการแก้ปัญหาต่อไปนี้:
ตรวจสอบให้แน่ใจว่า SDK การตรวจสอบประสิทธิภาพได้ รับการเริ่มต้น อย่างถูกต้องในแอปของคุณ
ตรวจสอบให้แน่ใจ ว่าไม่ได้ ปิดใช้งาน Performance Monitoring SDK ผ่านแฟล็กต่อไปนี้:
-
performance.instrumentationEnabled
-
ตรวจสอบให้แน่ใจว่า ได้ ปิดใช้งานการแคชของเบราว์เซอร์ มิฉะนั้น เบราว์เซอร์อาจไม่รับการตั้งค่าเครื่องมือวัดใหม่ใดๆ
ปิด แล้วเปิดแท็บหน้าเว็บอีกครั้ง ตรวจสอบการบันทึกอีกครั้ง
หากคุณเพิ่งเพิ่ม Performance Monitoring SDK ในแอป คุณอาจต้องรีสตาร์ทแอปทั้งหมดเพื่อให้ SDK เริ่มทำงาน
หากคุณไม่พบสิ่งที่ถูกปิดใช้งานในแอปของคุณ โปรดติดต่อฝ่ายสนับสนุนของ Firebase
หากคุณไม่เห็นข้อมูลสำหรับ เมตริก การหน่วงเวลาอินพุตแรก ให้ลองทำตามขั้นตอนการแก้ปัญหาต่อไปนี้:
โปรดทราบว่าการตรวจสอบประสิทธิภาพจะบันทึกเมตริก การหน่วงเวลาอินพุตแรก เท่านั้นเมื่อผู้ใช้คลิกบนหน้าเว็บภายใน 5 วินาทีแรกหลังจากโหลดหน้าเว็บ
ตรวจสอบให้แน่ใจว่าคุณได้ตั้งค่าแอปของคุณเพื่อวัดเมตริกนี้ เมตริก การหน่วงเวลาอินพุตแรก ต้องมี การตั้งค่าด้วยตนเอง คุณต้องเพิ่มไลบรารี polyfill สำหรับเมตริกนี้โดยเฉพาะ สำหรับคำแนะนำในการติดตั้ง โปรดดู เอกสารประกอบ ของห้องสมุด
โปรดทราบว่าการเพิ่มไลบรารี polyfill นี้ไม่จำเป็นสำหรับการมอนิเตอร์ประสิทธิภาพเพื่อรายงานเมตริกเว็บแอปอื่นๆ
คุณเห็นข้อมูลประสิทธิภาพสำหรับการติดตามที่รวบรวมโดยอัตโนมัติ แต่ไม่เห็นสำหรับการติดตามโค้ดที่กำหนดเอง หรือไม่ ลองทำตามขั้นตอนการแก้ไขปัญหาต่อไปนี้:
ตรวจสอบการตั้งค่าการติดตามโค้ดที่กำหนดเองโดยใช้ Trace API โดยเฉพาะรายการต่อไปนี้:
- ชื่อสำหรับการติดตามโค้ดที่กำหนดเองและเมตริกที่กำหนดเองต้องเป็นไปตามข้อกำหนดต่อไปนี้: ไม่มีช่องว่างนำหน้าหรือต่อท้าย ไม่มีอักขระขีดล่างนำหน้า (
_
) และความยาวสูงสุดคือ 32 อักขระ - การติดตามทั้งหมดจะต้องเริ่มต้นและหยุด การติดตามใดๆ ที่ไม่ได้เริ่ม ไม่หยุด หรือหยุดก่อนเริ่มต้นจะไม่ถูกบันทึก
โปรดทราบว่าหากคุณใช้เมธอด
record()
คุณไม่จำเป็นต้องเริ่มหรือหยุดการติดตามอย่างชัดเจน- ชื่อสำหรับการติดตามโค้ดที่กำหนดเองและเมตริกที่กำหนดเองต้องเป็นไปตามข้อกำหนดต่อไปนี้: ไม่มีช่องว่างนำหน้าหรือต่อท้าย ไม่มีอักขระขีดล่างนำหน้า (
ตรวจสอบให้แน่ใจว่า การรวบรวมข้อมูลการตรวจสอบประสิทธิภาพ ไม่ ถูกปิดใช้งาน ผ่านแฟล็กต่อไปนี้:
performance.dataCollectionEnabled
แฟล็กนี้ควบคุมการรวบรวมข้อมูลสำหรับการติดตามโค้ดที่กำหนดเองเท่านั้น (ไม่ใช่ข้อมูลทั้งหมด)
ตรวจสอบข้อความบันทึกของคุณ เพื่อให้แน่ใจว่า Performance Monitoring กำลังบันทึกการติดตามโค้ดแบบกำหนดเองที่คาดไว้
หากการตรวจสอบประสิทธิภาพกำลังบันทึกเหตุการณ์ แต่ไม่มีข้อมูลแสดงหลังจาก 24 ชั่วโมง โปรดติดต่อฝ่ายสนับสนุนของ Firebase
หากคุณไม่มีข้อมูลคำขอเครือข่าย ให้ระวังสิ่งต่อไปนี้:
การตรวจสอบประสิทธิภาพจะรวบรวมเมตริกสำหรับคำขอเครือข่ายที่รายงานโดย API ของเบราว์เซอร์โดยอัตโนมัติ รายงานเหล่านี้ไม่รวมคำขอเครือข่ายที่ล้มเหลว
ขึ้นอยู่กับลักษณะการทำงานของโค้ดและไลบรารีเครือข่ายที่ใช้โดยโค้ดของคุณ การตรวจสอบประสิทธิภาพอาจรายงานเฉพาะคำขอเครือข่ายที่เสร็จสมบูรณ์เท่านั้น ซึ่งหมายความว่าการเชื่อมต่อ HTTP/S ที่เปิดทิ้งไว้อาจไม่ได้รับการรายงาน
เรียนรู้เพิ่มเติมเกี่ยวกับ วิธีที่ Performance Monitoring รวมข้อมูลคำขอเครือข่าย ภายใต้รูปแบบ URL
คุณยังสามารถลองใช้ รูปแบบ URL ที่กำหนดเองได้ !
คำถามที่พบบ่อย
เราแทนที่ ปัญหายอดนิยม ด้วย การแจ้งเตือนล่าสุด เพื่อติดตามผลการแจ้งเตือนล่าสุด ซึ่งจะแจ้งให้คุณทราบโดยอัตโนมัติเมื่อเกินเกณฑ์ที่คุณตั้งไว้ ตอนนี้เลิกใช้งานปัญหาแล้ว และแทนที่ด้วยการแจ้งเตือน
ตัวเลือกแอปที่ด้านบนของการ์ดประสิทธิภาพจะกรองรายการแจ้งเตือนภายใต้ การแจ้งเตือนล่าสุด เฉพาะการแจ้งเตือนสามรายการล่าสุดสำหรับแอปที่เลือกเท่านั้นที่จะแสดง
หากต้องการเรียนรู้เพิ่มเติมเกี่ยวกับการแจ้งเตือน โปรดดู ที่ ตั้งค่าการแจ้งเตือนสำหรับปัญหาด้านประสิทธิภาพ
การตรวจสอบประสิทธิภาพรองรับ การแจ้งเตือน สำหรับเมตริกที่เกินเกณฑ์ที่กำหนด เพื่อหลีกเลี่ยงความสับสนกับเกณฑ์ที่กำหนดค่าได้สำหรับเมตริกประสิทธิภาพ เราจึงนำความสามารถในการกำหนดค่าเกณฑ์สำหรับ ปัญหาต่างๆ ออก
เราแทนที่หน้ารายละเอียดและเมตริกด้วยส่วนต่อประสานผู้ใช้ (UI) แบบรวมศูนย์ที่ออกแบบใหม่เพื่อปรับปรุงวิธีการแก้ไขปัญหาของคุณ UI การแก้ไขปัญหาใหม่นี้มีฟังก์ชันการทำงานหลักแบบเดียวกับที่รายละเอียดและเมตริกมีให้ หากต้องการเรียนรู้เพิ่มเติมเกี่ยวกับการแก้ไขปัญหา ดูที่ ดูข้อมูลเพิ่มเติมสำหรับการติดตามเฉพาะ
การตรวจสอบประสิทธิภาพจะรวบรวมข้อมูลประสิทธิภาพจากอุปกรณ์ของผู้ใช้แอปของคุณ หากแอปพลิเคชันของคุณมีผู้ใช้จำนวนมากหรือหากแอปสร้างกิจกรรมด้านประสิทธิภาพจำนวนมาก การตรวจสอบประสิทธิภาพอาจจำกัดการรวบรวมข้อมูลไว้ที่ชุดย่อยของอุปกรณ์เพื่อลดจำนวนเหตุการณ์ที่ประมวลผล ขีดจำกัดเหล่านี้สูงพอที่แม้จะมีเหตุการณ์น้อยลง ค่าเมตริกก็ยังเป็นตัวแทนของประสบการณ์แอปของผู้ใช้
ในการจัดการปริมาณข้อมูลที่เรารวบรวม การตรวจสอบประสิทธิภาพจะใช้ตัวเลือกการสุ่มตัวอย่างต่อไปนี้:
การจำกัดอัตราในอุปกรณ์ : เพื่อป้องกันไม่ให้อุปกรณ์ส่งการติดตามแบบฉับพลัน เราจะจำกัดจำนวนโค้ดและการติดตามคำขอเครือข่ายที่ส่งจากอุปกรณ์เป็น 300 เหตุการณ์ทุกๆ 10 นาที วิธีนี้ช่วยปกป้องอุปกรณ์จากเครื่องมือวัดแบบวนซ้ำที่สามารถส่งข้อมูลประสิทธิภาพจำนวนมาก และป้องกันไม่ให้อุปกรณ์เครื่องเดียวบิดเบือนการวัดประสิทธิภาพ
การสุ่มตัวอย่างแบบไดนามิก : การตรวจสอบประสิทธิภาพจะรวบรวมเหตุการณ์ประมาณ 100 ล้านเหตุการณ์สำหรับการติดตามโค้ดและ 100 ล้านสำหรับการติดตามคำขอเครือข่ายต่อแอปสำหรับผู้ใช้แอปทั้งหมด อัตราการสุ่มตัวอย่างแบบไดนามิกจะดึงข้อมูลบนอุปกรณ์ (โดยใช้ Firebase Remote Config) เพื่อพิจารณาว่าอุปกรณ์สุ่มควรจับและส่งการติดตามหรือไม่ อุปกรณ์ที่ไม่ได้เลือกสำหรับการสุ่มตัวอย่างจะไม่ส่งเหตุการณ์ใดๆ อัตราการสุ่มตัวอย่างแบบไดนามิกเป็นแบบเฉพาะแอปและปรับเพื่อให้แน่ใจว่าปริมาณข้อมูลที่รวบรวมโดยรวมยังคงต่ำกว่าขีดจำกัด
เซสชันผู้ใช้ส่งข้อมูลรายละเอียดเพิ่มเติมจากอุปกรณ์ของผู้ใช้ ทำให้ต้องใช้ทรัพยากรมากขึ้นในการจับภาพและส่งข้อมูล เพื่อลดผลกระทบของเซสชันผู้ใช้ การตรวจสอบประสิทธิภาพอาจจำกัดจำนวนเซสชันด้วย
การจำกัดอัตราฝั่งเซิร์ฟเวอร์ : เพื่อให้แน่ใจว่าแอปไม่เกินขีดจำกัดการสุ่มตัวอย่าง การตรวจสอบประสิทธิภาพอาจใช้การสุ่มตัวอย่างฝั่งเซิร์ฟเวอร์เพื่อลดเหตุการณ์บางอย่างที่ได้รับจากอุปกรณ์ แม้ว่าการจำกัดประเภทนี้จะไม่เปลี่ยนประสิทธิภาพของเมตริกของเรา แต่อาจทำให้เกิดการเปลี่ยนแปลงรูปแบบเล็กน้อย ซึ่งรวมถึงสิ่งต่อไปนี้:
- จำนวนการติดตามอาจแตกต่างจากจำนวนครั้งที่โค้ดหนึ่งชิ้นถูกเรียกใช้
- การติดตามที่เชื่อมโยงอย่างใกล้ชิดในโค้ดแต่ละรายการอาจมีจำนวนตัวอย่างที่แตกต่างกัน
เราแทนที่แท็บปัญหาด้วยการแนะนำการแจ้งเตือน ซึ่งจะแจ้งให้คุณทราบโดยอัตโนมัติเมื่อเกินเกณฑ์ที่คุณตั้งไว้ คุณไม่จำเป็นต้องตรวจสอบคอนโซล Firebase ด้วยตนเองเพื่อระบุสถานะของเกณฑ์อีกต่อไป หากต้องการเรียนรู้เกี่ยวกับการแจ้งเตือน โปรดดู ที่ ตั้งค่าการแจ้งเตือนสำหรับปัญหาด้านประสิทธิภาพ
เราได้ออกแบบส่วนการตรวจสอบประสิทธิภาพของคอนโซล Firebase ใหม่ เพื่อให้ แท็บแดชบอร์ด แสดงเมตริกหลักและการติดตามทั้งหมดในพื้นที่เดียว ส่วนหนึ่งของการออกแบบใหม่ เราได้ลบหน้า บนอุปกรณ์ และหน้า เครือข่าย ออก
ตารางการติดตามที่ด้านล่างของ แท็บแดช บอร์ดมีข้อมูลทั้งหมดเหมือนกันกับที่แสดงแท็บ บนอุปกรณ์ และ เครือข่าย แต่มีคุณสมบัติเพิ่มเติมบางอย่าง รวมถึงความสามารถในการจัดเรียงการติดตามของคุณตามเปอร์เซ็นต์การเปลี่ยนแปลงสำหรับเมตริกเฉพาะ หากต้องการดูเมตริกและข้อมูล ทั้งหมด สำหรับการติดตามเฉพาะ ให้คลิกชื่อการติดตามในตารางการติดตาม
ดูการติดตามของคุณในแท็บย่อยต่อไปนี้ของตารางการติดตาม:
- การติดตามคำขอเครือข่าย (ทั้งแบบสำเร็จรูปและแบบกำหนดเอง) — แท็บย่อย คำขอเครือข่าย
- การติดตามรหัสแบบกำหนดเอง — แท็บย่อย การติดตามแบบกำหนดเอง
- การเริ่มต้นแอป แอปในเบื้องหน้า แอปในเบื้องหลัง การติดตาม — แท็บย่อย การติดตามที่กำหนดเอง
- ร่องรอยการเรนเดอร์หน้าจอ — แท็บย่อย การเรนเดอร์หน้าจอ
- การติดตามการโหลดหน้าเว็บ — แท็บย่อย การโหลดหน้าเว็บ
สำหรับรายละเอียดเกี่ยวกับตารางการติดตามและการดูเมตริกและข้อมูล โปรดไปที่หน้าภาพรวมคอนโซล ( iOS+ | Android | เว็บ )
เฟรมที่เรนเดอร์ช้าและเฟรมค้างคำนวณด้วยอัตรารีเฟรชอุปกรณ์ที่สมมติไว้ที่ 60Hz หากอัตราการรีเฟรชอุปกรณ์ต่ำกว่า 60Hz แต่ละเฟรมจะมีเวลาเรนเดอร์ช้าลงเนื่องจากมีการแสดงผลเฟรมต่อวินาทีน้อยลง เวลาในการเรนเดอร์ที่ช้าลงอาจทำให้รายงานเฟรมที่ช้าหรือค้างมากขึ้น เนื่องจากเฟรมที่มากขึ้นจะแสดงผลช้าลงหรือจะค้าง อย่างไรก็ตาม หากอัตราการรีเฟรชอุปกรณ์สูงกว่า 60Hz แต่ละเฟรมจะมีเวลาเรนเดอร์เร็วขึ้น ซึ่งอาจทำให้รายงานเฟรมที่ช้าหรือค้างน้อยลง นี่เป็นข้อจำกัดปัจจุบันใน Performance Monitoring SDK
If Performance Monitoring is the only Firebase product in your app, you can use the standalone Performance Monitoring SDK (and the recommended header script below) if you're interested in:
- using a namespaced library
- reducing your SDK package size
- delaying initialization of the SDK until after your page loads
To include the standalone Performance Monitoring SDK in your app and delay its initialization to after your page loads:
- Add the following script to the header of your index file.
- Make sure to add your app's Firebase project configuration object .
(function(sa,fbc){function load(f,c){var a=document.createElement('script'); a.async=1;a.src=f;var s=document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(a,s);}load(sa); window.addEventListener('load',function(){firebase.initializeApp(fbc).performance()}); })(performance_standalone, firebaseConfig);
where,
- performance_standalone is
'https://www.gstatic.com/firebasejs/9.17.2/firebase-performance-standalone.js'
- firebaseConfig is your app's Firebase config object
The above script asynchronously loads the standalone SDK then initializes Firebase after the window's onload
event fires. This tactic reduces the impact that the SDK could have on page load metrics since the browser has already reported its loading metrics when you initialize the SDK.
Near real-time data processing and display
Firebase Performance Monitoring processes collected performance data as it comes in, which results in near real-time data display in the Firebase console. Processed data displays in the console within a few minutes of its collection, hence the term "near real-time".
To take advantage of near real-time data processing, make sure your app uses a real-time compatible SDK version .
To take advantage of near real-time data processing, you only need to make sure that your app uses a Performance Monitoring SDK version that's compatible with real-time data processing.
These are the real-time compatible SDK versions:
- iOS — v7.3.0 or later
- tvOS — v8.9.0 or later
- Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
- Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
These are the SDK versions compatible with real-time data processing:
- iOS — v7.3.0 or later
- tvOS — v8.9.0 or later
- Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
- Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
If your app doesn't use a real-time compatible SDK version, you will still see all your app's performance data in the Firebase console. However, the display of performance data will be delayed by roughly 36 hours from the time of its collection.
Yes! Regardless of which SDK version an app instance uses, you'll see performance data from all your users.
However, if you're looking at recent data (less than roughly 36 hours old), then the displayed data is from users of app instances using a real-time compatible SDK version. The non-recent data, though, includes performance data from all versions of your app.
Contacting Firebase Support
If you reach out to Firebase Support , always include your Firebase App ID. Find your Firebase App ID in the Your apps card of your Project settings .
,This page provides troubleshooting tips for getting started with Performance Monitoring or using Performance Monitoring features and tooling.
First checks for troubleshooting
The following two checks are general best practices recommended for anyone before further troubleshooting.
1. Check log messages for performance events
Check your log messages to be sure that the Performance Monitoring SDK is capturing performance events.
Open your browser's developer tools (for example, Network tab for Chrome Dev Tools or in the Network Monitor for Firefox ).
Refresh your web app in the browser.
Check your log messages for any error messages.
After a few seconds, look for a network call to
firebaselogging.googleapis.com
in your browser's developer tools. The presence of that network call shows that the browser is sending performance data to Firebase.
If your app isn't logging performance events, review the troubleshooting tips .
2. Check the Firebase Status Dashboard
Check the Firebase Status Dashboard in case there is a known outage for Firebase or for Performance Monitoring.
Getting started with Performance Monitoring
If you're getting started with Performance Monitoring ( iOS+ | Android | Web ), the following troubleshooting tips can help with issues that involve Firebase detecting the SDK or displaying your first performance data in the Firebase console.
Firebase can detect if you've successfully added the Performance Monitoring SDK to your app when it receives event information (like app interactions) from your app. Usually within 10 minutes of starting your app, the Performance dashboard of the Firebase console displays an "SDK detected" message. Then, within 30 minutes, the dashboard displays the initial processed data.
If it's been more than 10 minutes since you added the latest version of SDK to your app, and you're still not seeing any change, check your log messages to make sure that Performance Monitoring is logging events. Try the appropriate troubleshooting steps as described below to troubleshoot a delayed SDK detection message.
If you're still developing locally, try generating more events for data collection:
Serve and view your web app in a local environment.
Generate events by loading subpages for your site, interacting with your app, and/or triggering network requests. Make sure to keep the browser tab open for at least 10 seconds after the page loads.
Make sure that your Firebase configuration object is correctly added to your app and that you haven't modified the object. Specifically, check the following:
- The Firebase Web App ID (
appId
) in the config object is correct for your app. Find your Firebase App ID in the Your apps card of your Project settings .
If anything seems wrong with the config object in your app, try the following:
Delete the config object that you currently have in your app.
Follow these instructions to obtain a new config object and add it to your web app.
- The Firebase Web App ID (
If the SDK is logging events and everything seems to be set up correctly, but you're still not seeing the SDK detection message or processed data (after 2 hours), contact Firebase Support .
Make sure that the Performance Monitoring SDK is correctly initialized in your app.
Make sure that the Performance Monitoring SDK is not disabled through the following flag:
-
performance.instrumentationEnabled
-
Make sure that your browser caching is disabled, otherwise the browser might not pick up any new instrumentation settings.
Close, then reopen the webpage tab. Check for logging again.
If you just added the Performance Monitoring SDK in your app, you might need to fully restart your app for the SDK to start working.
If you can't find anything that's disabled in your app, contact Firebase Support .
Performance Monitoring processes performance event data before displaying it in the Performance dashboard .
If it's been more than 24 hours since the "SDK detected" message appeared , and you're still not seeing data, then check the Firebase Status Dashboard in case there is a known outage. If there is no outage, contact Firebase Support .
General troubleshooting
If you've successfully added the SDK and are using Performance Monitoring in your app, the following troubleshooting tips can help with general issues that involve Performance Monitoring features and tooling.
If you're not seeing log messages for performance events , try the following troubleshooting steps:
Make sure that the Performance Monitoring SDK is correctly initialized in your app.
Make sure that the Performance Monitoring SDK is not disabled through the following flag:
-
performance.instrumentationEnabled
-
Make sure that your browser caching is disabled, otherwise the browser might not pick up any new instrumentation settings.
Close, then reopen the webpage tab. Check for logging again.
If you just added the Performance Monitoring SDK in your app, you might need to fully restart your app for the SDK to start working.
If you can't find anything that's disabled in your app, contact Firebase Support .
If you're not seeing data for the first input delay metric , try the following troubleshooting steps:
Be aware that Performance Monitoring only records the first input delay metric when a user clicks on the web page within the first 5 seconds after page load.
Make sure that you've set up your app to measure this metric. The first input delay metric requires manual setup . Specifically, you need to add the polyfill library for this metric. For installation instructions, refer to the library's documentation .
Note that adding this polyfill library is not required for Performance Monitoring to report other web app metrics.
Are you seeing performance data for automatically collected traces but not for custom code traces ? Try the following troubleshooting steps:
Check the setup of custom code traces instrumented via the Trace API , especially the following:
- Names for custom code traces and custom metrics must meet the following requirements: no leading or trailing whitespace, no leading underscore (
_
) character, and max length is 32 characters. - All traces must be started and stopped. Any trace that is not started, not stopped, or stopped before started will not be logged.
Note that if you're using the
record()
method, then you don't need to explicitly start or stop your trace.- Names for custom code traces and custom metrics must meet the following requirements: no leading or trailing whitespace, no leading underscore (
Make sure that Performance Monitoring data collection is not disabled through the following flag:
performance.dataCollectionEnabled
This flag controls the collection of data for custom code traces only (not all data).
Check your log messages to make sure that Performance Monitoring is logging expected custom code traces.
If Performance Monitoring is logging events, but no data displays after 24 hours, contact Firebase Support .
If you're missing network request data, be aware of the following:
Performance Monitoring automatically collects metrics for network requests reported by the browser API. These reports do not include failed network requests.
Depending on the behavior of your code and networking libraries used by your code, Performance Monitoring might only report on network requests that are completed. This means that HTTP/S connections that are left open might not be reported.
Learn more about how Performance Monitoring aggregates network request data under URL patterns.
You can also try out custom URL patterns !
FAQ
We replaced Top Issues with Recent Alerts as a follow-up to our recent introduction of alerts, which automatically notify you when the thresholds you set are crossed. Issues are now deprecated and replaced by alerts.
The apps selector at the top of the Performance card filters the alert entries under Recent Alerts . Only the three most recent alerts for the app(s) selected are displayed.
To learn more about alerts, see Set up alerts for performance issues .
Performance Monitoring supports alerts for metrics that exceed defined thresholds. To avoid confusion with these configurable thresholds for performance metrics, we removed the ability to configure thresholds for issues .
We replaced the Details and Metrics pages with a newly redesigned, centralized user interface (UI) to improve how you troubleshoot issues. This new troubleshooting UI offers the same core functionality that Details and Metrics offered. To learn more about troubleshooting, see View more data for a specific trace .
Performance Monitoring collects performance data from your app's user devices. If your application has many users or if the app generates a large amount of performance activity, Performance Monitoring might limit data collection to a subset of devices to reduce the number of processed events. These limits are high enough so that, even with fewer events, the metric values are still representative of your user's app experience.
To manage the volume of data that we collect, Performance Monitoring uses the following sampling options:
On-device rate limiting : To prevent a device from sending sudden bursts of traces, we limit the number of code and network request traces sent from a device to 300 events every 10 mins. This approach protects the device from looped instrumentations that can send large amounts of performance data, and it prevents a single device from skewing the performance measurements.
Dynamic sampling : Performance Monitoring collects approximately 100M events for code traces and 100M for network request traces per app across all app users. A dynamic sampling rate is fetched on devices (using Firebase Remote Config) to determine whether a random device should capture and send traces. A device that is not selected for sampling does not send any events. The dynamic sampling rate is app-specific and adjusts to ensure that the overall volume of collected data remains below the limit.
User sessions send additional, detailed data from a user's device, requiring more resources to capture and send the data. To minimize the impact of user sessions, Performance Monitoring might also restrict the number of sessions.
Server-side rate limiting : To ensure that apps don't exceed the sampling limit, Performance Monitoring might use server-side sampling to drop some events received from devices. Although this type of limiting doesn't change the effectiveness of our metrics, it may cause minor pattern shifts, including the following:
- The number of traces can differ from the number of times that a piece of code was executed.
- Traces that are closely coupled in code may each have a different number of samples.
We replaced the Issues tab with the introduction of Alerts, which automatically notifies you when the thresholds you set are exceeded. You no longer need to manually check the Firebase console to determine the status of a threshold. To learn about Alerts, see Set up alerts for performance issues .
We've redesigned the Performance Monitoring section of the Firebase console so that the Dashboard tab displays your key metrics and all your traces in one space. As part of the redesign, we removed the On device and Network pages.
The traces table at the bottom of the Dashboard tab has all the same information that the On device and Network tabs displayed, but with some added features, including the ability to sort your traces by the percentage change for a specific metric. To view all the metrics and data for a specific trace, click the trace name in the traces table.
View your traces in the following subtabs of the traces table:
- Network request traces (both out-of-the-box and custom) — Network requests subtab
- Custom code traces — Custom traces subtab
- App start, app-in-foreground, app-in-background traces — Custom traces subtab
- Screen rendering traces — Screen rendering subtab
- Page load traces — Page load subtab
For details about the traces table and viewing metrics and data, visit the console overview page ( iOS+ | Android | Web ).
Slow rendering frames and frozen frames are calculated with an assumed device refresh rate of 60Hz. If a device refresh rate is lower than 60Hz, each frame will have a slower rendering time because fewer frames are rendered per second. Slower rendering times can cause more slow or frozen frames to be reported because more frames will be rendered slower or will freeze. However, if a device refresh rate is higher than 60Hz, each frame will have a faster rendering time. This can cause fewer slow or frozen frames to be reported. This is a current limitation in the Performance Monitoring SDK.
If Performance Monitoring is the only Firebase product in your app, you can use the standalone Performance Monitoring SDK (and the recommended header script below) if you're interested in:
- using a namespaced library
- reducing your SDK package size
- delaying initialization of the SDK until after your page loads
To include the standalone Performance Monitoring SDK in your app and delay its initialization to after your page loads:
- Add the following script to the header of your index file.
- Make sure to add your app's Firebase project configuration object .
(function(sa,fbc){function load(f,c){var a=document.createElement('script'); a.async=1;a.src=f;var s=document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(a,s);}load(sa); window.addEventListener('load',function(){firebase.initializeApp(fbc).performance()}); })(performance_standalone, firebaseConfig);
where,
- performance_standalone is
'https://www.gstatic.com/firebasejs/9.17.2/firebase-performance-standalone.js'
- firebaseConfig is your app's Firebase config object
The above script asynchronously loads the standalone SDK then initializes Firebase after the window's onload
event fires. This tactic reduces the impact that the SDK could have on page load metrics since the browser has already reported its loading metrics when you initialize the SDK.
Near real-time data processing and display
Firebase Performance Monitoring processes collected performance data as it comes in, which results in near real-time data display in the Firebase console. Processed data displays in the console within a few minutes of its collection, hence the term "near real-time".
To take advantage of near real-time data processing, make sure your app uses a real-time compatible SDK version .
To take advantage of near real-time data processing, you only need to make sure that your app uses a Performance Monitoring SDK version that's compatible with real-time data processing.
These are the real-time compatible SDK versions:
- iOS — v7.3.0 or later
- tvOS — v8.9.0 or later
- Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
- Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
These are the SDK versions compatible with real-time data processing:
- iOS — v7.3.0 or later
- tvOS — v8.9.0 or later
- Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
- Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
If your app doesn't use a real-time compatible SDK version, you will still see all your app's performance data in the Firebase console. However, the display of performance data will be delayed by roughly 36 hours from the time of its collection.
Yes! Regardless of which SDK version an app instance uses, you'll see performance data from all your users.
However, if you're looking at recent data (less than roughly 36 hours old), then the displayed data is from users of app instances using a real-time compatible SDK version. The non-recent data, though, includes performance data from all versions of your app.
Contacting Firebase Support
If you reach out to Firebase Support , always include your Firebase App ID. Find your Firebase App ID in the Your apps card of your Project settings .