MetricKit doesn't work for system Launch Daemons/Agents

This is related to my post https://developer.apple.com/forums/thread/724698 where I submitted an issue that MetricKit reports didn't work for System Extensions on mac. I've come to realize that this is also true for Launch Daemons/Agents in the system domain (and so it probably also explains the System Extension case as I understand System Extensions are somewhat like Launch Daemons).

I have a "thin executable" (a Command Line Tool target) that registers with MetricKit reports and then just crashes itself. Here's the scenarios I've tested -

  • If I launch this executable as the current user, I receive the crash reports from MetricKit.
  • If I launch this executable as root, I also receive the crash reports.
  • If I register it as a Launch Agent in a "user", or a "gui" domain, I still receive the crash reports.
  • However, if I register it as a Launch Agent in the "system" domain, or as a Launch Daemon, I got this error from the CrashReport process.
<<bundle ID>> is not a MetricKit client

(I noticed the same error from MetricKit APIs in our system extension targets as well)

I decided to open this new post here, because the solution we were talking about in post 724698 - delivering metric reports from system extensions to their host apps -
may not apply here, since a Launch Daemon/Agent may not have a host app at all. What is the guidance if we want to receive these reports?

Replies

What is the guidance if we want to receive these reports?

Pretty much the same. MetricKit has its origins on iOS where there are only apps [1]. If you want it to support other kinds of code, you’re back in enhancement request territory.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Well, app-like things, so app extensions as well. Oh and App Clips of course, but I try not to think about those (-:

  • Alright I submitted an enhancement request FB11985759 for the general MetricKit usage against system service scenarios. As mentioned in the ticket it hurts to know there's such a good framework out there but we couldn't apply it to our software due to more complicated use cases. I don't know how often/soon Apple responds to this kind of enhancement requests, hopefully sooner than any inferior solutions can dig their roots deep and it will be too late to replace it for even a better option.

  • And thanks for the reply anyway The Eskimo!

Add a Comment