Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Conversation

@gambrose
Copy link
Contributor

@gambrose gambrose commented Sep 3, 2017

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.

Copy link
Contributor

@nblumhardt nblumhardt left a 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 👍

}

public void Timestamp(TimeSpan value)
public void Timestamp(TimeSpan value, PrecisionResolutionStrategy? resolutionStrategy = null)
Copy link
Contributor

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

Copy link
Contributor Author

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.

payload.Format(writer);

return SendAsync(writer.ToString(), cancellationToken);
return SendAsync(writer.ToString(), Precision.Nanoseconds, cancellationToken);
Copy link
Contributor

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?

@nblumhardt
Copy link
Contributor

👍 ready to go, @gambrose ?

@gambrose
Copy link
Contributor Author

gambrose commented Sep 4, 2017

Yeah I think it's good to go.

@nblumhardt nblumhardt merged commit a69b180 into influxdata:dev Sep 5, 2017
@nblumhardt
Copy link
Contributor

👍

This was referenced Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants