MetricKit available for NetworkExtension

Am I able to add a subscriber inside of my Network Extension to receive reports?
Adding MetricKit to your iOS host app should collect metrics about your host app and all of it's Network Extension. Was there a reason you wanted to add your subscriber to a custom class inside your extension?


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Hello Matt and Mike,

According to the WWDC video Whats new in MetricKit

Over the course of the day, the operating system is passively aggregating performance data for your app as it is used. This data is anonymized and designed to protect user privacy.

What if I am building a security oriented application (for example in use with an MDM) that the user will likely never actively use.
I.e. the user will not actively use the host application, because they don't need to. And all my important code runs through network extensions. Are metrics still gathered then ?

According to my experiments so far, adopting the MXMetricManagerSubscriber protocol in my network extension code, and subscribing via MXMetricManager.shared doesn't seem to work from a network extension.

I can see in the logs that a request is made (at least I believe that's what's happening)

default 2020-10-22 18:04:06.585416 +0100 MetricKitCore metrickitd 318: 0x2233f com.apple.metrickit.core Received connection request from <PIDOFMYNETWORKEXTENSION>

However, triggering a simulated event from Xcode (Debug > Simulate Metric Payloads...) doesn't seem to do anything.

Could you confirm whether this is a supported scenario ? And if not, the metrics for network extensions can still be gathered in a timely fashion from the host process, even it's not run frequently, if ever ?

Thank you in advance !



According to my experiments so far, adopting the MXMetricManagerSubscriber protocol in my network extension code, and subscribing via MXMetricManager.shared doesn't seem to work from a network extension.

Could you confirm whether this is a supported scenario ? And if not, the metrics for network extensions can still be gathered in a timely fashion from the host process, even it's not run frequently, if ever ?

Your testing is correct. There is nothing technically stopping you from adding a MXMetricManagerSubscriber to your Network Extension, but this is not a supported workflow and it is recommended to add this protocol and receiving methods in your container app.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
"Me too". The real question is what's expected behavior if host app is never launched. Let's say it's pushed by MDM with VPN config and extension doesn't really need the hosting app - it's all pre-configured by MDM and started by iOS as VPN on demand. Is MetricKit expected to function in such scenario? Is it going to start the host app in background once per day?

"Me too". The real question is what's expected behavior if host app is never launched.
Let's say it's pushed by MDM with VPN config
Is MetricKit expected to function in such scenario?

This is a valid point. I think the best option here is to open an Enhancement Request for a supported path with MetricKit in an Network Extension. In the Enhancement Request please describe in detail the MDM scenario that configures the VPN for a device and what the desired behavior would be for MetricKit in your Network Extension.

Please respond back with the Feedback ID.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Matt,
Feedback ID FB8883832
Thank you for opening the bug report. I see it internally and requested to be copied on any future status.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Hello again @meaton

I also created a suggestion request : FB8903549

Thank you for the support.
Thank you for opening the Feedback. I see it internally and have requested access to be copied on updates to this report.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

@Matt Eaton Any update on FB8903549, FB8883832.

How can we track these tickets?

MetricKit available for NetworkExtension
 
 
Q