নির্দিষ্ট অ্যাপ কোডের জন্য কাস্টম মনিটরিং যোগ করুন


Performance Monitoring আপনার অ্যাপের পারফরম্যান্স নিরীক্ষণ করতে সাহায্য করার জন্য ট্রেস সংগ্রহ করে। ট্রেস হলো আপনার অ্যাপের দুটি ভিন্ন সময়ের মধ্যবর্তী সময়ে সংগৃহীত পারফরম্যান্স ডেটার একটি রিপোর্ট।

আপনার অ্যাপের নির্দিষ্ট কোডের সাথে সম্পর্কিত পারফরম্যান্স ডেটা নিরীক্ষণ করতে আপনি নিজস্ব ট্রেস তৈরি করতে পারেন। একটি কাস্টম কোড ট্রেসের মাধ্যমে, আপনি পরিমাপ করতে পারেন যে আপনার অ্যাপের একটি নির্দিষ্ট কাজ বা একাধিক কাজ সম্পন্ন করতে কত সময় লাগে, যেমন—একগুচ্ছ ছবি লোড করা বা আপনার ডাটাবেস কোয়েরি করা।

একটি কাস্টম কোড ট্রেসের ডিফল্ট মেট্রিক হলো এর 'ডিউরেশন' (ট্রেসটির শুরু এবং শেষের মধ্যবর্তী সময়), তবে আপনি কাস্টম মেট্রিকও যোগ করতে পারেন।

আপনার কোডে, আপনি Performance Monitoring SDK দ্বারা প্রদত্ত API ব্যবহার করে একটি কাস্টম কোড ট্রেসের শুরু এবং শেষ নির্ধারণ করেন।কাস্টম কোড ট্রেস তৈরি করার পর যেকোনো সময় চালু করা যেতে পারে এবং এগুলো থ্রেড সেফ।

যেহেতু এই ট্রেসগুলির জন্য সংগৃহীত ডিফল্ট মেট্রিকটি 'duration', তাই এগুলিকে কখনও কখনও 'Duration traces' বলা হয়।

আপনি পারফরম্যান্স ড্যাশবোর্ডের একেবারে নিচে থাকা ট্রেস টেবিলের কাস্টম ট্রেস সাবট্যাবে এই ট্রেসগুলোর ডেটা দেখতে পারেন (এই পৃষ্ঠার পরবর্তী অংশে কনসোল ব্যবহার সম্পর্কে আরও জানুন)।

ডিফল্ট অ্যাট্রিবিউট, কাস্টম অ্যাট্রিবিউট এবং কাস্টম মেট্রিক্স

কাস্টম কোড ট্রেসের জন্য, Performance Monitoring স্বয়ংক্রিয়ভাবে ডিফল্ট অ্যাট্রিবিউটগুলো (যেমন অ্যাপ ভার্সন, দেশ, ডিভাইস ইত্যাদি সাধারণ মেটাডেটা) লগ করে, যাতে আপনি Firebase কনসোলে ট্রেসের জন্য ডেটা ফিল্টার করতে পারেন। এছাড়াও আপনি কাস্টম অ্যাট্রিবিউট (যেমন, গেম লেভেল বা ব্যবহারকারীর প্রোপার্টি) যোগ এবং মনিটর করতে পারেন।

আপনি ট্রেসের আওতার মধ্যে ঘটা পারফরম্যান্স-সম্পর্কিত ইভেন্টগুলোর জন্য কাস্টম মেট্রিক রেকর্ড করতে একটি কাস্টম কোড ট্রেস আরও কনফিগার করতে পারেন। উদাহরণস্বরূপ, আপনি ক্যাশে হিট ও মিসের সংখ্যা অথবা উল্লেখযোগ্য সময়ের জন্য UI কতবার প্রতিক্রিয়াহীন হয়ে পড়ে, তার সংখ্যার জন্য একটি কাস্টম মেট্রিক তৈরি করতে পারেন।

ট্রেসের জন্য ডিফল্ট অ্যাট্রিবিউট এবং ডিফল্ট মেট্রিকের পাশাপাশি কাস্টম অ্যাট্রিবিউট ও কাস্টম মেট্রিকগুলোও Firebase কনসোলে প্রদর্শিত হয়।

কাস্টম কোড ট্রেস যোগ করুন

নির্দিষ্ট অ্যাপ্লিকেশন কোড নিরীক্ষণ করতে কাস্টম কোড ট্রেস যোগ করার জন্য Performance Monitoring ট্রেস এপিআই ( সুইফট | অবজেক্টিভ-সি ) ব্যবহার করুন।

নিম্নলিখিত বিষয়গুলো লক্ষ্য করুন:

  • একটি অ্যাপে একাধিক কাস্টম কোড ট্রেস থাকতে পারে।
  • একই সময়ে একাধিক কাস্টম কোড ট্রেস চালানো যেতে পারে।
  • কাস্টম কোড ট্রেসের নামের ক্ষেত্রে নিম্নলিখিত শর্তাবলী পূরণ করতে হবে: নামের শুরুতে বা শেষে কোনো স্পেস থাকা যাবে না, শুরুতে কোনো আন্ডারস্কোর ( _ ) অক্ষর থাকা যাবে না এবং এর সর্বোচ্চ দৈর্ঘ্য ১০০ অক্ষর হতে হবে।
  • কাস্টম কোড ট্রেস কাস্টম মেট্রিক এবং কাস্টম অ্যাট্রিবিউট যোগ করা সমর্থন করে।

কাস্টম কোড ট্রেস শুরু ও বন্ধ করতে, যে কোডটি ট্রেস করতে চান সেটিকে নিচের মতো কোডের লাইন দিয়ে মুড়ে দিন:

সুইফট

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
// Add the Performance Monitoring module to your header
import FirebasePerformance

let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

// code that you want to trace

trace.stop()

উদ্দেশ্য-সি

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
// Add the Performance Monitoring module to your header
@import FirebasePerformance;

FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

// code that you want to trace

[trace stop];

কাস্টম কোড ট্রেসে কাস্টম মেট্রিক যোগ করুন

কাস্টম কোড ট্রেসে কাস্টম মেট্রিক যোগ করতে Performance Monitoring ট্রেস এপিআই ( সুইফট | অবজেক্টিভ-সি ) ব্যবহার করুন।

নিম্নলিখিত বিষয়গুলো লক্ষ্য করুন:

  • কাস্টম মেট্রিকের নাম অবশ্যই নিম্নলিখিত শর্তাবলী পূরণ করবে: নামের শুরুতে বা শেষে কোনো অতিরিক্ত স্পেস থাকবে না, শুরুতে কোনো আন্ডারস্কোর ( _ ) অক্ষর থাকবে না এবং এর সর্বোচ্চ দৈর্ঘ্য হবে ১০০ অক্ষর।
  • প্রতিটি কাস্টম কোড ট্রেস ৩২টি পর্যন্ত মেট্রিক রেকর্ড করতে পারে (ডিফল্ট ডিউরেশন মেট্রিক সহ)।

একটি কাস্টম মেট্রিক যোগ করতে, প্রতিবার ইভেন্টটি ঘটার সময় নিম্নলিখিতের মতো একটি কোড লাইন যোগ করুন। উদাহরণস্বরূপ, এই কাস্টম মেট্রিকটি আপনার অ্যাপে ঘটা পারফরম্যান্স-সম্পর্কিত ইভেন্টগুলি গণনা করে, যেমন ক্যাশে হিট বা রিট্রাই।

সুইফট

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.incrementMetric("EVENT_NAME", by: 1)
// code that you want to trace (and log custom metrics)

trace.stop()

উদ্দেশ্য-সি

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace incrementMetric:@"EVENT_NAME" byInt:1];
// code that you want to trace (and log custom metrics)

[trace stop];

কাস্টম কোড ট্রেসের জন্য কাস্টম অ্যাট্রিবিউট তৈরি করুন

কাস্টম কোড ট্রেসে কাস্টম অ্যাট্রিবিউট যোগ করতে Performance Monitoring ট্রেস এপিআই ( সুইফট | অবজেক্টিভ-সি ) ব্যবহার করুন।

কাস্টম অ্যাট্রিবিউট ব্যবহার করতে, আপনার অ্যাপে এমন কোড যোগ করুন যা অ্যাট্রিবিউটটি সংজ্ঞায়িত করে এবং এটিকে একটি নির্দিষ্ট কাস্টম কোড ট্রেসের সাথে যুক্ত করে। ট্রেস শুরু হওয়ার এবং ট্রেস শেষ হওয়ার মধ্যবর্তী যেকোনো সময়ে আপনি কাস্টম অ্যাট্রিবিউটটি সেট করতে পারেন।

নিম্নলিখিত বিষয়গুলো লক্ষ্য করুন:

  • কাস্টম অ্যাট্রিবিউটের নামগুলোকে অবশ্যই নিম্নলিখিত শর্তগুলো পূরণ করতে হবে:

    • শুরুতে বা শেষে কোনো স্পেস দেওয়া যাবে না, শুরুতে আন্ডারস্কোর ( _ ) চিহ্ন ব্যবহার করা যাবে না।
    • কোনো ফাঁকা স্থান নেই
    • সর্বোচ্চ দৈর্ঘ্য ৩২ অক্ষর
    • নামের জন্য অনুমোদিত অক্ষরগুলো হলো AZ , az , এবং _
  • প্রতিটি কাস্টম কোড ট্রেস সর্বোচ্চ ৫টি কাস্টম অ্যাট্রিবিউট রেকর্ড করতে পারে।

  • অনুগ্রহ করে নিশ্চিত করুন যে কাস্টম অ্যাট্রিবিউটগুলিতে এমন কোনো তথ্য নেই যা গুগলের কাছে কোনো ব্যক্তিকে ব্যক্তিগতভাবে শনাক্ত করতে পারে।

    এই নির্দেশিকা সম্পর্কে আরও জানুন

সুইফট

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.setValue("A", forAttribute: "experiment")

// Update scenario.
trace.setValue("B", forAttribute: "experiment")

// Reading scenario.
let experimentValue:String? = trace.valueForAttribute("experiment")

// Delete scenario.
trace.removeAttribute("experiment")

// Read attributes.
let attributes:[String, String] = trace.attributes;

উদ্দেশ্য-সি

দ্রষ্টব্য: এই Firebase পণ্যটি macOS, Mac Catalyst, watchOS টার্গেটগুলিতে উপলব্ধ নয়।
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace setValue:@"A" forAttribute:@"experiment"];

// Update scenario.
[trace setValue:@"B" forAttribute:@"experiment"];

// Reading scenario.
NSString *experimentValue = [trace valueForAttribute:@"experiment"];

// Delete scenario.
[trace removeAttribute:@"experiment"];

// Read attributes.
NSDictionary <NSString *, NSString *> *attributes = [trace attributes];

পারফরম্যান্স ডেটা ট্র্যাক করুন, দেখুন এবং ফিল্টার করুন

আপনার ড্যাশবোর্ডে নির্দিষ্ট মেট্রিকগুলি ট্র্যাক করুন

আপনার মূল মেট্রিকগুলোর প্রবণতা কেমন তা জানতে, সেগুলোকে পারফরম্যান্স ড্যাশবোর্ডের শীর্ষে থাকা মেট্রিক্স বোর্ডে যোগ করুন। সপ্তাহ-ভিত্তিক পরিবর্তন দেখে আপনি দ্রুত অবনতি শনাক্ত করতে পারবেন অথবা আপনার কোডের সাম্প্রতিক পরিবর্তনগুলো পারফরম্যান্স উন্নত করছে কিনা তা যাচাই করতে পারবেন।

মেট্রিক্স বোর্ডের একটি ছবি <span class= ফায়ারবেস পারফরম্যান্স মনিটরিং ড্যাশবোর্ড

আপনার মেট্রিক্স বোর্ডে একটি মেট্রিক যোগ করতে, এই ধাপগুলো অনুসরণ করুন:

  1. Firebase কনসোলে পারফরম্যান্স ড্যাশবোর্ডে যান।
  2. একটি খালি মেট্রিক কার্ডে ক্লিক করুন, তারপর আপনার বোর্ডে যোগ করার জন্য একটি বিদ্যমান মেট্রিক নির্বাচন করুন।
  3. আরও বিকল্পের জন্য, যেমন কোনো মেট্রিক প্রতিস্থাপন বা অপসারণ করতে, ডেটাযুক্ত মেট্রিক কার্ডে ক্লিক করুন।

মেট্রিক্স বোর্ডটি সময়ের সাথে সাথে সংগৃহীত মেট্রিক ডেটা গ্রাফিক্যাল আকারে এবং সংখ্যাসূচক শতাংশ পরিবর্তন হিসেবে প্রদর্শন করে।

ড্যাশবোর্ড ব্যবহার সম্পর্কে আরও জানুন।

চিহ্ন এবং তাদের ডেটা দেখুন

আপনার ট্রেসগুলো দেখতে, Firebase কনসোলের পারফরম্যান্স ড্যাশবোর্ডে যান, ট্রেস টেবিল পর্যন্ত স্ক্রল করুন, তারপর উপযুক্ত সাবট্যাবে ক্লিক করুন। টেবিলটি প্রতিটি ট্রেসের জন্য কিছু শীর্ষ মেট্রিক প্রদর্শন করে, এবং আপনি এমনকি একটি নির্দিষ্ট মেট্রিকের শতাংশ পরিবর্তন অনুসারে তালিকাটি সাজাতেও পারেন।

Performance Monitoring Firebase কনসোলে একটি ট্রাবলশুটিং পেজ প্রদান করে, যা মেট্রিকের পরিবর্তনগুলো তুলে ধরে। এর ফলে আপনার অ্যাপ এবং ব্যবহারকারীদের উপর পারফরম্যান্স সংক্রান্ত সমস্যার প্রভাব দ্রুত সমাধান করা ও কমানো সহজ হয়। সম্ভাব্য পারফরম্যান্স সমস্যা সম্পর্কে জানতে পারলে আপনি এই ট্রাবলশুটিং পেজটি ব্যবহার করতে পারেন, যেমন— নিম্নলিখিত পরিস্থিতিগুলোতে:

  • আপনি ড্যাশবোর্ডে প্রাসঙ্গিক মেট্রিকগুলো নির্বাচন করেন এবং একটি বড় পার্থক্য লক্ষ্য করেন।
  • ট্রেসেস টেবিলে আপনি সবচেয়ে বড় ডেল্টাগুলোকে উপরে দেখানোর জন্য সর্ট করেন, এবং আপনি একটি উল্লেখযোগ্য শতাংশ পরিবর্তন দেখতে পান।
  • আপনি একটি পারফরম্যান্স সমস্যা সম্পর্কে অবহিত করে একটি ইমেল সতর্কতা পেয়েছেন।

আপনি নিম্নলিখিত উপায়ে সমস্যা সমাধান পৃষ্ঠায় প্রবেশ করতে পারেন:

  • মেট্রিক ড্যাশবোর্ডে, 'মেট্রিকের বিবরণ দেখুন' বোতামটিতে ক্লিক করুন।
  • যেকোনো মেট্রিক কার্ডে, নির্বাচন করুন => বিস্তারিত দেখুন । সমস্যা সমাধান পৃষ্ঠাটি আপনার নির্বাচিত মেট্রিক সম্পর্কে তথ্য প্রদর্শন করে।
  • ট্রেস টেবিলে, একটি ট্রেসের নামে অথবা সেই ট্রেসের সাথে যুক্ত সারিতে থাকা যেকোনো মেট্রিক মানে ক্লিক করুন।
  • ইমেল সতর্কবার্তায়, ‘এখনই তদন্ত করুন’ এ ক্লিক করুন।

ট্রেস টেবিলে কোনো ট্রেসের নামে ক্লিক করলে, আপনি আপনার আগ্রহের মেট্রিকগুলো আরও বিস্তারিতভাবে দেখতে পারবেন। ক্লিক করুন অ্যাট্রিবিউট অনুযায়ী ডেটা ফিল্টার করার জন্য ফিল্টার বাটন, উদাহরণস্বরূপ:

একটি ছবি <span class= অ্যাট্রিবিউট দ্বারা ফিল্টার করা ফায়ারবেস পারফরম্যান্স মনিটরিং ডেটা
  • পূর্ববর্তী রিলিজ বা আপনার সর্বশেষ রিলিজের ডেটা দেখতে অ্যাপ সংস্করণ অনুযায়ী ফিল্টার করুন।
  • পুরোনো ডিভাইসগুলো আপনার অ্যাপটি কীভাবে পরিচালনা করে তা জানতে ডিভাইস অনুযায়ী ফিল্টার করুন।
  • আপনার ডেটাবেসের অবস্থান কোনো নির্দিষ্ট অঞ্চলকে প্রভাবিত করছে না তা নিশ্চিত করতে দেশ অনুযায়ী ফিল্টার করুন।

আপনার ট্রেসগুলির ডেটা দেখার বিষয়ে আরও জানুন।

পরবর্তী পদক্ষেপ

  • ব্যবহারকারীর সেশনের বিস্তারিত রিপোর্ট দেখুন, যেখানে আপনি একই সেশনে সংগৃহীত অন্যান্য ট্রেসের টাইমলাইন প্রেক্ষাপটে একটি নির্দিষ্ট ট্রেস দেখতে পারবেন।
,


Performance Monitoring আপনার অ্যাপের পারফরম্যান্স নিরীক্ষণ করতে সাহায্য করার জন্য ট্রেস সংগ্রহ করে। ট্রেস হলো আপনার অ্যাপের দুটি ভিন্ন সময়ের মধ্যবর্তী সময়ে সংগৃহীত পারফরম্যান্স ডেটার একটি রিপোর্ট।

আপনার অ্যাপের নির্দিষ্ট কোডের সাথে সম্পর্কিত পারফরম্যান্স ডেটা নিরীক্ষণ করতে আপনি নিজস্ব ট্রেস তৈরি করতে পারেন। একটি কাস্টম কোড ট্রেসের মাধ্যমে, আপনি পরিমাপ করতে পারেন যে আপনার অ্যাপের একটি নির্দিষ্ট কাজ বা একাধিক কাজ সম্পন্ন করতে কত সময় লাগে, যেমন—একগুচ্ছ ছবি লোড করা বা আপনার ডাটাবেস কোয়েরি করা।

একটি কাস্টম কোড ট্রেসের ডিফল্ট মেট্রিক হলো এর 'ডিউরেশন' (ট্রেসটির শুরু এবং শেষের মধ্যবর্তী সময়), তবে আপনি কাস্টম মেট্রিকও যোগ করতে পারেন।

In your code, you define the beginning and the end of a custom code trace using the APIs provided by the Performance Monitoring SDK.Custom code traces can be started anytime after they've been created, and they are thread safe.

Since the default metric collected for these traces is "duration", they are sometimes called "Duration traces".

You can view data from these traces in the Custom traces subtab of the traces table, which is at the bottom of the Performance dashboard (learn more about using the console later on this page).

Default attributes, custom attributes, and custom metrics

For custom code traces, Performance Monitoring automatically logs default attributes (common metadata like app version, country, device, etc.) so that you can filter the data for the trace in the Firebase console. You can also add and monitor custom attributes (such as, game level or user properties).

You can further configure a custom code trace to record custom metrics for performance-related events that occur within the trace's scope. For example, you can create a custom metric for the number of cache hits and misses or the number of times that the UI becomes unresponsive for a noticeable period of time.

Custom attributes and custom metrics display in the Firebase console alongside the default attributes and default metric for the trace.

Add custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom code traces to monitor specific application code.

Note the following:

  • An app can have multiple custom code traces.
  • More than one custom code trace can run at the same time.
  • Names for custom code traces must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Custom code traces support adding custom metrics and custom attributes .

To start and stop a custom code trace, wrap the code that you want to trace with lines of code similar to the following:

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
import FirebasePerformance

let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

// code that you want to trace

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
@import FirebasePerformance;

FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

// code that you want to trace

[trace stop];

Add custom metrics to custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom metrics to custom code traces.

Note the following:

  • Names for custom metrics must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Each custom code trace can record up to 32 metrics (including the default Duration metric).

To add a custom metric, add a line of code similar to the following each time that the event occurs. For example, this custom metric counts performance- related events that occur in your app, such as cache hits or retries.

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.incrementMetric("EVENT_NAME", by: 1)
// code that you want to trace (and log custom metrics)

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace incrementMetric:@"EVENT_NAME" byInt:1];
// code that you want to trace (and log custom metrics)

[trace stop];

Create custom attributes for custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom attributes to custom code traces.

To use custom attributes, add code to your app that defines the attribute and associates it with a specific custom code trace. You can set the custom attribute anytime between when the trace starts and when the trace stops.

Note the following:

  • Names for custom attributes must meet the following requirements:

    • No leading or trailing whitespace, no leading underscore ( _ ) character
    • No spaces
    • Max length is 32 characters
    • Allowed characters for the name are AZ , az , and _ .
  • Each custom code trace can record up to 5 custom attributes.

  • Please ensure that custom attributes do not contain any information that personally identifies an individual to Google.

    Learn more about this guideline

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.setValue("A", forAttribute: "experiment")

// Update scenario.
trace.setValue("B", forAttribute: "experiment")

// Reading scenario.
let experimentValue:String? = trace.valueForAttribute("experiment")

// Delete scenario.
trace.removeAttribute("experiment")

// Read attributes.
let attributes:[String, String] = trace.attributes;

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace setValue:@"A" forAttribute:@"experiment"];

// Update scenario.
[trace setValue:@"B" forAttribute:@"experiment"];

// Reading scenario.
NSString *experimentValue = [trace valueForAttribute:@"experiment"];

// Delete scenario.
[trace removeAttribute:@"experiment"];

// Read attributes.
NSDictionary <NSString *, NSString *> *attributes = [trace attributes];

Track, view, and filter performance data

Track specific metrics in your dashboard

To learn how your key metrics are trending, add them to your metrics board at the top of the Performance dashboard. You can quickly identify regressions by seeing week-over-week changes or verify that recent changes in your code are improving performance.

an image of the metrics board in the <span class=Firebase Performance Monitoring dashboard" />

To add a metric to your metrics board, follow these steps:

  1. Go to the Performance dashboard in the Firebase console.
  2. Click an empty metric card, then select an existing metric to add to your board.
  3. Click on a populated metric card for more options, for example to replace or remove a metric.

The metrics board shows collected metric data over time, both in graphical form and as a numerical percentage change.

Learn more about using the dashboard .

View traces and their data

To view your traces, go to the Performance dashboard in the Firebase console, scroll down to the traces table, then click the appropriate subtab. The table displays some top metrics for each trace, and you can even sort the list by the percentage change for a specific metric.

Performance Monitoring provides a troubleshooting page in the Firebase console that highlights metric changes, making it easy to quickly address and minimize the impact of performance issues on your apps and users. You can use the troubleshooting page when you learn about potential performance issues, for example, in the following scenarios:

  • You select relevant metrics on the dashboard and you notice a big delta.
  • In the traces table you sort to display the largest deltas at the top, and you see a significant percentage change.
  • You receive an email alert notifying you of a performance issue.

You can access the troubleshooting page in the following ways:

  • On the metric dashboard, click the View metric details button.
  • On any metric card, select => View details . The troubleshooting page displays information about the metric you selected.
  • In the traces table, click a trace name or any metric value in the row associated with that trace.
  • In an email alert, click Investigate now .

When you click a trace name in the traces table, you can then drill down into metrics of interest. Click the Filter button to filter the data by attribute, for example:

an image of <span class=Firebase Performance Monitoring data being filtered by attribute" />
  • Filter by App version to view data about a past release or your latest release
  • Filter by Device to learn how older devices handle your app
  • Filter by Country to make sure your database location isn't affecting a specific region

Learn more about viewing data for your traces .

Next Steps

  • Learn more about using attributes to examine performance data.

  • Learn more about how to track performance issues in the Firebase console.

  • Set up alerts for code changes that are degrading the performance of your app. For example, you can configure an email alert for your team if the duration of a specific custom code trace exceeds a threshold that you set.

  • View detailed reports of user sessions in which you can see a specific trace in a timeline context of other traces collected during the same session.
,


Performance Monitoring collects traces to help you monitor the performance of your app. A trace is a report of performance data captured between two points in time in your app.

You can create your own traces to monitor performance data associated with specific code in your app. With a custom code trace , you can measure how long it takes your app to complete a specific task or a set of tasks, for example loading a set of images or querying your database.

The default metric for a custom code trace is its "duration" (the time between the starting and stopping points of the trace), but you can add custom metrics , as well.

In your code, you define the beginning and the end of a custom code trace using the APIs provided by the Performance Monitoring SDK.Custom code traces can be started anytime after they've been created, and they are thread safe.

Since the default metric collected for these traces is "duration", they are sometimes called "Duration traces".

You can view data from these traces in the Custom traces subtab of the traces table, which is at the bottom of the Performance dashboard (learn more about using the console later on this page).

Default attributes, custom attributes, and custom metrics

For custom code traces, Performance Monitoring automatically logs default attributes (common metadata like app version, country, device, etc.) so that you can filter the data for the trace in the Firebase console. You can also add and monitor custom attributes (such as, game level or user properties).

You can further configure a custom code trace to record custom metrics for performance-related events that occur within the trace's scope. For example, you can create a custom metric for the number of cache hits and misses or the number of times that the UI becomes unresponsive for a noticeable period of time.

Custom attributes and custom metrics display in the Firebase console alongside the default attributes and default metric for the trace.

Add custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom code traces to monitor specific application code.

Note the following:

  • An app can have multiple custom code traces.
  • More than one custom code trace can run at the same time.
  • Names for custom code traces must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Custom code traces support adding custom metrics and custom attributes .

To start and stop a custom code trace, wrap the code that you want to trace with lines of code similar to the following:

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
import FirebasePerformance

let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

// code that you want to trace

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
@import FirebasePerformance;

FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

// code that you want to trace

[trace stop];

Add custom metrics to custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom metrics to custom code traces.

Note the following:

  • Names for custom metrics must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Each custom code trace can record up to 32 metrics (including the default Duration metric).

To add a custom metric, add a line of code similar to the following each time that the event occurs. For example, this custom metric counts performance- related events that occur in your app, such as cache hits or retries.

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.incrementMetric("EVENT_NAME", by: 1)
// code that you want to trace (and log custom metrics)

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace incrementMetric:@"EVENT_NAME" byInt:1];
// code that you want to trace (and log custom metrics)

[trace stop];

Create custom attributes for custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom attributes to custom code traces.

To use custom attributes, add code to your app that defines the attribute and associates it with a specific custom code trace. You can set the custom attribute anytime between when the trace starts and when the trace stops.

Note the following:

  • Names for custom attributes must meet the following requirements:

    • No leading or trailing whitespace, no leading underscore ( _ ) character
    • No spaces
    • Max length is 32 characters
    • Allowed characters for the name are AZ , az , and _ .
  • Each custom code trace can record up to 5 custom attributes.

  • Please ensure that custom attributes do not contain any information that personally identifies an individual to Google.

    Learn more about this guideline

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.setValue("A", forAttribute: "experiment")

// Update scenario.
trace.setValue("B", forAttribute: "experiment")

// Reading scenario.
let experimentValue:String? = trace.valueForAttribute("experiment")

// Delete scenario.
trace.removeAttribute("experiment")

// Read attributes.
let attributes:[String, String] = trace.attributes;

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace setValue:@"A" forAttribute:@"experiment"];

// Update scenario.
[trace setValue:@"B" forAttribute:@"experiment"];

// Reading scenario.
NSString *experimentValue = [trace valueForAttribute:@"experiment"];

// Delete scenario.
[trace removeAttribute:@"experiment"];

// Read attributes.
NSDictionary <NSString *, NSString *> *attributes = [trace attributes];

Track, view, and filter performance data

Track specific metrics in your dashboard

To learn how your key metrics are trending, add them to your metrics board at the top of the Performance dashboard. You can quickly identify regressions by seeing week-over-week changes or verify that recent changes in your code are improving performance.

an image of the metrics board in the <span class=Firebase Performance Monitoring dashboard" />

To add a metric to your metrics board, follow these steps:

  1. Go to the Performance dashboard in the Firebase console.
  2. Click an empty metric card, then select an existing metric to add to your board.
  3. Click on a populated metric card for more options, for example to replace or remove a metric.

The metrics board shows collected metric data over time, both in graphical form and as a numerical percentage change.

Learn more about using the dashboard .

View traces and their data

To view your traces, go to the Performance dashboard in the Firebase console, scroll down to the traces table, then click the appropriate subtab. The table displays some top metrics for each trace, and you can even sort the list by the percentage change for a specific metric.

Performance Monitoring provides a troubleshooting page in the Firebase console that highlights metric changes, making it easy to quickly address and minimize the impact of performance issues on your apps and users. You can use the troubleshooting page when you learn about potential performance issues, for example, in the following scenarios:

  • You select relevant metrics on the dashboard and you notice a big delta.
  • In the traces table you sort to display the largest deltas at the top, and you see a significant percentage change.
  • You receive an email alert notifying you of a performance issue.

You can access the troubleshooting page in the following ways:

  • On the metric dashboard, click the View metric details button.
  • On any metric card, select => View details . The troubleshooting page displays information about the metric you selected.
  • In the traces table, click a trace name or any metric value in the row associated with that trace.
  • In an email alert, click Investigate now .

When you click a trace name in the traces table, you can then drill down into metrics of interest. Click the Filter button to filter the data by attribute, for example:

an image of <span class=Firebase Performance Monitoring data being filtered by attribute" />
  • Filter by App version to view data about a past release or your latest release
  • Filter by Device to learn how older devices handle your app
  • Filter by Country to make sure your database location isn't affecting a specific region

Learn more about viewing data for your traces .

Next Steps

  • Learn more about using attributes to examine performance data.

  • Learn more about how to track performance issues in the Firebase console.

  • Set up alerts for code changes that are degrading the performance of your app. For example, you can configure an email alert for your team if the duration of a specific custom code trace exceeds a threshold that you set.

  • View detailed reports of user sessions in which you can see a specific trace in a timeline context of other traces collected during the same session.
,


Performance Monitoring collects traces to help you monitor the performance of your app. A trace is a report of performance data captured between two points in time in your app.

You can create your own traces to monitor performance data associated with specific code in your app. With a custom code trace , you can measure how long it takes your app to complete a specific task or a set of tasks, for example loading a set of images or querying your database.

The default metric for a custom code trace is its "duration" (the time between the starting and stopping points of the trace), but you can add custom metrics , as well.

In your code, you define the beginning and the end of a custom code trace using the APIs provided by the Performance Monitoring SDK.Custom code traces can be started anytime after they've been created, and they are thread safe.

Since the default metric collected for these traces is "duration", they are sometimes called "Duration traces".

You can view data from these traces in the Custom traces subtab of the traces table, which is at the bottom of the Performance dashboard (learn more about using the console later on this page).

Default attributes, custom attributes, and custom metrics

For custom code traces, Performance Monitoring automatically logs default attributes (common metadata like app version, country, device, etc.) so that you can filter the data for the trace in the Firebase console. You can also add and monitor custom attributes (such as, game level or user properties).

You can further configure a custom code trace to record custom metrics for performance-related events that occur within the trace's scope. For example, you can create a custom metric for the number of cache hits and misses or the number of times that the UI becomes unresponsive for a noticeable period of time.

Custom attributes and custom metrics display in the Firebase console alongside the default attributes and default metric for the trace.

Add custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom code traces to monitor specific application code.

Note the following:

  • An app can have multiple custom code traces.
  • More than one custom code trace can run at the same time.
  • Names for custom code traces must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Custom code traces support adding custom metrics and custom attributes .

To start and stop a custom code trace, wrap the code that you want to trace with lines of code similar to the following:

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
import FirebasePerformance

let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

// code that you want to trace

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
// Add the Performance Monitoring module to your header
@import FirebasePerformance;

FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

// code that you want to trace

[trace stop];

Add custom metrics to custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom metrics to custom code traces.

Note the following:

  • Names for custom metrics must meet the following requirements: no leading or trailing whitespace, no leading underscore ( _ ) character, and max length is 100 characters.
  • Each custom code trace can record up to 32 metrics (including the default Duration metric).

To add a custom metric, add a line of code similar to the following each time that the event occurs. For example, this custom metric counts performance- related events that occur in your app, such as cache hits or retries.

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.incrementMetric("EVENT_NAME", by: 1)
// code that you want to trace (and log custom metrics)

trace.stop()

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace incrementMetric:@"EVENT_NAME" byInt:1];
// code that you want to trace (and log custom metrics)

[trace stop];

Create custom attributes for custom code traces

Use the Performance Monitoring Trace API ( Swift | Obj-C ) to add custom attributes to custom code traces.

To use custom attributes, add code to your app that defines the attribute and associates it with a specific custom code trace. You can set the custom attribute anytime between when the trace starts and when the trace stops.

Note the following:

  • Names for custom attributes must meet the following requirements:

    • No leading or trailing whitespace, no leading underscore ( _ ) character
    • No spaces
    • Max length is 32 characters
    • Allowed characters for the name are AZ , az , and _ .
  • Each custom code trace can record up to 5 custom attributes.

  • Please ensure that custom attributes do not contain any information that personally identifies an individual to Google.

    Learn more about this guideline

সুইফট

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
let trace = Performance.startTrace(name: "CUSTOM_TRACE_NAME")

trace.setValue("A", forAttribute: "experiment")

// Update scenario.
trace.setValue("B", forAttribute: "experiment")

// Reading scenario.
let experimentValue:String? = trace.valueForAttribute("experiment")

// Delete scenario.
trace.removeAttribute("experiment")

// Read attributes.
let attributes:[String, String] = trace.attributes;

উদ্দেশ্য-সি

Note: This Firebase product is not available on macOS, Mac Catalyst, watchOS targets.
FIRTrace *trace = [FIRPerformance startTraceWithName:@"CUSTOM_TRACE_NAME"];

[trace setValue:@"A" forAttribute:@"experiment"];

// Update scenario.
[trace setValue:@"B" forAttribute:@"experiment"];

// Reading scenario.
NSString *experimentValue = [trace valueForAttribute:@"experiment"];

// Delete scenario.
[trace removeAttribute:@"experiment"];

// Read attributes.
NSDictionary <NSString *, NSString *> *attributes = [trace attributes];

Track, view, and filter performance data

Track specific metrics in your dashboard

To learn how your key metrics are trending, add them to your metrics board at the top of the Performance dashboard. You can quickly identify regressions by seeing week-over-week changes or verify that recent changes in your code are improving performance.

an image of the metrics board in the <span class=Firebase Performance Monitoring dashboard" />

To add a metric to your metrics board, follow these steps:

  1. Go to the Performance dashboard in the Firebase console.
  2. Click an empty metric card, then select an existing metric to add to your board.
  3. Click on a populated metric card for more options, for example to replace or remove a metric.

The metrics board shows collected metric data over time, both in graphical form and as a numerical percentage change.

Learn more about using the dashboard .

View traces and their data

To view your traces, go to the Performance dashboard in the Firebase console, scroll down to the traces table, then click the appropriate subtab. The table displays some top metrics for each trace, and you can even sort the list by the percentage change for a specific metric.

Performance Monitoring provides a troubleshooting page in the Firebase console that highlights metric changes, making it easy to quickly address and minimize the impact of performance issues on your apps and users. You can use the troubleshooting page when you learn about potential performance issues, for example, in the following scenarios:

  • You select relevant metrics on the dashboard and you notice a big delta.
  • In the traces table you sort to display the largest deltas at the top, and you see a significant percentage change.
  • You receive an email alert notifying you of a performance issue.

You can access the troubleshooting page in the following ways:

  • On the metric dashboard, click the View metric details button.
  • On any metric card, select => View details . The troubleshooting page displays information about the metric you selected.
  • In the traces table, click a trace name or any metric value in the row associated with that trace.
  • In an email alert, click Investigate now .

When you click a trace name in the traces table, you can then drill down into metrics of interest. Click the Filter button to filter the data by attribute, for example:

an image of <span class=Firebase Performance Monitoring data being filtered by attribute" />
  • Filter by App version to view data about a past release or your latest release
  • Filter by Device to learn how older devices handle your app
  • Filter by Country to make sure your database location isn't affecting a specific region

Learn more about viewing data for your traces .

Next Steps

  • Learn more about using attributes to examine performance data.

  • Learn more about how to track performance issues in the Firebase console.

  • Set up alerts for code changes that are degrading the performance of your app. For example, you can configure an email alert for your team if the duration of a specific custom code trace exceeds a threshold that you set.

  • View detailed reports of user sessions in which you can see a specific trace in a timeline context of other traces collected during the same session.