-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose diagnostic metadata properties at top level #8
base: main
Are you sure you want to change the base?
Expose diagnostic metadata properties at top level #8
Conversation
…r and change resource bundling to process to not introduce a level of indirection on disk
Thank you so much for putting this together! I know I've been a little negligent keeping up with the types I don't actually use myself as much. Can you help me understand why making them public on the meta data types is helpful? That was really just an implementation detail to deal with the API/encoding mismatch. Now these structures no longer match the corresponding classes from MetricKit. I'm open to it! I just want to understand. |
Also, what does the change from copy->process do? |
I'm sorry, I'm lost. XD I read your comment on #7 as recommending to expose the metadata type properties at the diagnostic type level. But I can see I misunderstood and failed to actually convert to the expected type. Will do! In truth I was going to use them as strings in our code anyway so I just worked for me to leave them that way :).
Updated the PR description with screenshots of the file layout before and after. Before ==
https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package |
You know, I always wondered why these didn't work within Xcode. That's awesome!! Totally my fault for not being more clear. The specialized metadata types are actually there only to help out with serialization. MetricKit doesn't expose them - there's only a generic This is very minor, and honestly might be more annoying that helpful. I was just trying to keep as close as possible to the actual MetricKit types. |
No no. I like the idea for sure! I am finding that converting from the JSON representation in the test resources back to
But if you were to serialize a
I know there is
Meaning something like below kind of works (though would not commit it with
|
Riiiight. Now I'm remembering why I didn't do this in the first place... Honestly, MetricKit drives me bananas! It converts so much useful structure into strings. I'm not opposed to hacking in some parsing. You are consuming these on-device, right? Can you consume the real MetricKit payloads? I know this does not solve the immediate issue here, but I'm just curious. |
We want to land this code before we have dropped support for BigSur. And so that leaves me with essentially reimplementing Meter to deal with availability on BigSur. I really liked how clean your implementation was and only was caught up when trying to access the few special properties. Our specific needs at this time would be satisfied with the values as strings. That would let us start collecting information from coworkers and then figure out a general pattern to the data and how MetricKit is encoding. Of course we could go the disassembly route to figure it out but I'm not sure that would be any faster for me :). I will take a pass at the bespoke parsing but I'm not entirely sure how much time I can commit to it. I wonder if there is a way to have the diagnostic types extract the data directly from the MXDiagnostic types. This might work because the various |
The interesting bits of data for each diagnostic type are on the metadata types. However those properties were also private so not accessible to users of Meter. Let's expose them as public but also add convenience accessors at the diagnostic type level.
I also changed the bundling of the test resources because
.copy
was introducing a level of indirection/nesting in the final bundle that caused the tests to fail in Xcode 14.2. With the.copy
and the extra level of nesting the paths in the tests would need to change, and given there were no resources with the same name being merged into the bundle that seemed unnecessary.Addresses #7