Page MenuHomePhabricator

Consolidate Metrics Platform Swift client into mediawiki/libs/metrics-platform
Closed, ResolvedPublic

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
Resolved Mholloway
OpenNone
OpenNone
OpenNone
Resolved DAbad
Resolved jlinehan
Resolved Mholloway
OpenNone
Resolvedmpopov
ResolvedTsevener
ResolvedTsevener
Resolvedmpopov
ResolvedBUG REPORT Mholloway
ResolvedSNowick_WMF
Resolved Mholloway
ResolvedSpike Mholloway
Resolved Mholloway

Event Timeline

Mholloway created this task.
Mholloway renamed this task from Conslidate Metrics Platform Swfit client into mediawiki/libs/metrics-platform to Conslidate Metrics Platform Swift client into mediawiki/libs/metrics-platform.May 3 2021, 9:07 PM
Aklapper renamed this task from Conslidate Metrics Platform Swift client into mediawiki/libs/metrics-platform to Consolidate Metrics Platform Swift client into mediawiki/libs/metrics-platform.Jun 30 2021, 9:32 PM

Change 703012 had a related patch set uploaded (by Mholloway; author: Michael Holloway):

[mediawiki/libs/metrics-platform@master] Add Swift client library

https://gerrit.wikimedia.org/r/703012

Change 713927 had a related patch set uploaded (by Mholloway; author: Michael Holloway):

[mediawiki/libs/metrics-platform@master] [WIP] [Swift] Support adding context values based on stream config

https://gerrit.wikimedia.org/r/713927

Current status on the WIP patch: the SerializedSwift library for serializing objects to/from JSON had seemed to be working well, but I've found a bug in it that needs to be resolved if we want to more forward with it. The bug is that null values are explicitly serialized as { "property": null } rather than being omitted, which is the default in GSON, which inspired SerializedSwift, and which is what we want. I believe it's a bug because the intention in the code is pretty clearly that these values be omitted.

After some debugging, I've identified what I think is the issue, which is that the value wrapped by the @Serialized property wrapper is always being interpreted as non-optional (and therefore nonnull), even when the value it is in fact a nil-valued Optional. This can be seen by debugging any unit test that involves serializing a null field, such as testInheritance; the wrappedValue getter for optionals is never used, even for the nil-valued boo field.

What I don't understand is how this even makes sense or compiles, or how to fix it. We'll likely have to pull in someone with deeper knowledge of Swift.

After discussing this with Toni I decided to drop the library and just implement this using the standard Codable/CodingKeys approach, which is a bit more boilerplate code but is working great. That change is reflected in the lastest patch set.

Change 703012 merged by jenkins-bot:

[mediawiki/libs/metrics-platform@master] [Swift] Add Swift client library

https://gerrit.wikimedia.org/r/703012

Change 713927 merged by jenkins-bot:

[mediawiki/libs/metrics-platform@master] [Swift] Support adding context values based on stream config

https://gerrit.wikimedia.org/r/713927