Open ransombriggs opened 6 years ago
@ransombriggs Thanks for the thorough details on this issue.
As for which implementation to use, it's a tough one. I'm not sure what the reasoning behind the time precision is, maybe @rwz can get into that? As Pliny defaults to using DateTime
in serializers, I'd say we should stick to that. Higher precision can be provided for the event envelope specifically.
I agree that the time_v3
name isn't the best, how about time
or zulu_time
?
I think we should leave it as a class method on the serializer base class, rather than mixing into Time
or DateTime
.
@gudmundur I am down with having it available as a class method on the serializer base class, but would like to continue leaving it as a module that I mix into the serializer base. I have seen usage in mediators as well, specifically for submitting jobs with a string timestamp and would like to explicitly include the helper there.
@gudmundur pushed up https://github.com/interagent/pliny/pull/322
To get
Time
objects into a zulu formatted string various pliny apps have defined identical helpers that could be consolidated in pliny. I started this issue rather than filing a PR since there are some approach questions that we should probably discuss.The
time_v3
helpers are usually defined in a module which is mixed into serializers and sometimes mediators if they are publishing events. There are currently two different implementations I have seen.The second version has the extra flexibility of having sub second precisions which I believe the app uses for event timestamps. The only problem with this method is that it does not work for
DateTime
objects where as the first implementation does.I guess I would lobby for the
strftime
implementation at this point so that it would not be confusing when used withDateTime
objects.Also,
time_v3
is probably not the best name for this method in pliny since it is tied to the idea of the heroku apiv3
implementation instead of zulu formatted dates.Finally, would this be better as an optional mixin on
Time
andDateTime
instead?/cc @gudmundur