About Health. Or Health Metrics of iOS and Android applications to be honest.

About Health. Or Health Metrics of iOS and Android applications to be honest.

While your product grows, you become more and more aware of how it works. We have a lot of great practice in the backend world, loggers, monitoring and etc.

While in mobile, we mostly watch crash-free?? But! In modern iOS and Android applications, we have some type-safe unwrapping that we can use to prevent crashes and show some blank screen or screen without data. At the same time, we will see 100% crash-free for our application and feel safe. A bad situation, don't you think? ??

This is where health metrics come into play. Health metrics provide a fuller view of your application's performance, going beyond just crash reports. They can help identify issues that don't necessarily cause a crash but can still significantly impact the user experience.

It can be based on product metrics or can be based on logs inside application. Let’s go into second variant ??

Firebase, a tool you definitely already use for crash reporting, can also be use for collection health metrics. It's an easy and cost-effective solution, no need for additional integration ?? ♂?

First of all, we need to think about problem areas. To my understanding, they can be:

  • Parsing. For example, in ManyChat, we have a lot of different types of messages that can be changed, and parsing errors can indicate that we can improve the user experience.
  • Database errors - a super unpredictable thing, better to be aware and log everything
  • Dead ends - when you are sure that data should be there, but you used guard/if let. Write near log, and you will find out that sometimes data can be missing.
  • Push Notification, Deeplink - this entry point is highly tied to parsing and can also produce non-fatal events.

In our case, we also have websockets, some SDKs, our custom analytics, and a lot more. I think you got an idea.

So what you can do is write a simple function that will store an error inside Firebase. Here is example for iOS

func log(
		message: LosslessStringConvertible,
		errorDomain: ErrorDomain,
		params: [String : String]) {
				params["device_id"] = _deviceTokenStore.deviceToken ?? ""
				params["error_description"] = message.description
				return Crashlytics.crashlytics().record(error: NSError(
					domain: errorDomain.rawValue,
					code: 400,
					userInfo: params))
		}
        

And put this in your code. For example for us great practice is:

guard var messages = contents.messages else {
	mcAssertionFailure() // Here we call assertionFailure for Debug code or log to Firebase
	return contents 
}        

Now you can visit the Firebase Crashlytics page, select non-fatals, and check how many events are there. Understand the impact of these non-fatal errors and investigate them using parameters you added.

No alt text provided for this image

You can track for example place of error by this parameters or add additional data from error

file: String = #file,
function: String = #function,
line: Int = #line        

Next step can be using more professional instruments like Sentry, Embrace and etc but it’s another story.

Do you track you apps health beyond crashfree metric?

要查看或添加评论,请登录

Aleksandr L.的更多文章

  • Work in progress

    Work in progress

    Ever found yourself overwhelmed, with your sprint board looking more like a Christmas Tree than an organized workspace?…

    3 条评论
  • Using your own product makes you a better engineer

    Using your own product makes you a better engineer

    Great engineers don't just understand the mechanics of a product; they understand its soul. Going through a codebase is…

    2 条评论
  • Engineers vs AI

    Engineers vs AI

    All this year we talking more and more about AI. It went really crazy! And it doing great job in programming! I guess…

    1 条评论
  • Understanding Business: The Engineer's Superpower ??

    Understanding Business: The Engineer's Superpower ??

    Great engineers do more than just code and design. They create solutions that match business challenges.

    2 条评论
  • Why Business Context is a Game-Changer for Engineers ??

    Why Business Context is a Game-Changer for Engineers ??

    In the journey of becoming the best engineer, one essential step seems quite illogical. It involves pausing the deep…

    4 条评论
  • Boost your team with a structured retro

    Boost your team with a structured retro

    Reflection is key to growth and results, especially when talking about a team. Development, like any other creative…

社区洞察

其他会员也浏览了