-
Notifications
You must be signed in to change notification settings - Fork 59
Conversation
…than unitis change with precision
…se when precision set. Changed to use nullable to make intention of not passing a strategy more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
|
||
position = LinePosition.TimestampWritten; | ||
} | ||
|
||
public void Timestamp(TimeSpan value) | ||
public void Timestamp(TimeSpan value, PrecisionResolutionStrategy? resolutionStrategy = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones will be binary breaking changes - not a big deal, but we should either:
- add overloads instead of default args, or
- bump the major version to 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking it wasn't a breaking change as the new param is optional but on further investigation it appears it would be a breaking change as although it would work if recompiled it would break if ref updated without recompiling.
I will add overloads.
@@ -36,20 +36,39 @@ public Task<LineProtocolWriteResult> WriteAsync(LineProtocolPayload payload, Can | |||
|
|||
payload.Format(writer); | |||
|
|||
return SendAsync(writer.ToString(), cancellationToken); | |||
return SendAsync(writer.ToString(), Precision.Nanoseconds, cancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small thing, here we've got a variable writer
that's a StringWriter
, below we are using LineProtocolWriter writer
... my eyes keep wanting to see some symmetry that's not there :-) ... Could we rename this one stringWriter
or something similar just to break the similarity?
👍 ready to go, @gambrose ? |
Yeah I think it's good to go. |
👍 |
Allows writing LineProtocol using timestamps at a precision other than nanoseconds.
Precision to use is set when creating the
LineProtocolWriter
as I needs to be consistent for the whole batch. The client will set the precision parameter when asked to send a batch with precision set to something other than nanoseconds.By default if given a timestamp at a higher precision that write setup to write (e.g. with seconds defined when writing hours) an error will be thrown. This behavior can be configured when creating the writer and overridden when writing each individual point.
Instead of erroring the writer can be setup to floor, ceiling or round the timestamp.