MetricKit available for NetworkExtension
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
According to the WWDC video Whats new in MetricKit
What if I am building a security oriented application (for example in use with an MDM) that the user will likely never actively use.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.
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)
However, triggering a simulated event from Xcode (Debug > Simulate Metric Payloads...) doesn't seem to do anything.default 2020-10-22 18:04:06.585416 +0100 MetricKitCore metrickitd 318: 0x2233f com.apple.metrickit.core Received connection request from <PIDOFMYNETWORKEXTENSION>
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 !
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.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 ?
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
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."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?
Please respond back with the Feedback ID.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Feedback ID FB8883832
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
I also created a suggestion request : FB8903549
Thank you for the support.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
@Matt Eaton Any update on FB8903549, FB8883832.
How can we track these tickets?
See also: MetricKit for System Extension