Skip to content
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

Refactor payload serializer #24

Closed
1 of 2 tasks
at15 opened this issue Apr 18, 2017 · 2 comments
Closed
1 of 2 tasks

Refactor payload serializer #24

at15 opened this issue Apr 18, 2017 · 2 comments

Comments

@at15
Copy link
Member

at15 commented Apr 18, 2017

Existing serializer only have one method WriteInt, which makes it thread safe, since the method use nothing from the object, but this introduce the problem when we want to write multiple series

A better implementation might be

WriteOpen() { buf.Write("[") }
WriteInt( .....
WriteDouble( ....
WriteClose() { buf.Write("]") }
Reader() // or maybe we can make it a reader closer
Reset()
  • deal with comma in json array
    • one way is to use a flag to indicate if this is the first element in array
    • a better would be always add comma, and remove the last one, when finalize
    • might use truncate
@at15 at15 self-assigned this Apr 18, 2017
@at15 at15 added this to DOING in Metrics Collector Apr 18, 2017
at15 added a commit that referenced this issue Apr 18, 2017
- change usage in http worker
- add bool flag for dealing with `,` between array elements in json, if
bytes.Buffer allow go back some char, the code would be more efficient,
might use truncate
- add interface check for all three serializers, influxdb, kairosdb,
xephon-k
@at15 at15 added the backlog label Apr 19, 2017
@at15
Copy link
Member Author

at15 commented Apr 19, 2017

just leave it as it is for now

@at15 at15 closed this as completed Apr 19, 2017
@at15 at15 added this to the 0.1.0 milestone Apr 19, 2017
@at15 at15 moved this from DOING to BACKLOG in Metrics Collector Apr 19, 2017
@at15
Copy link
Member Author

at15 commented May 15, 2017

And it brought trouble in #33 because Start does not call Reset and server won't complain for invalid JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Metrics Collector
  
BACKLOG
Development

No branches or pull requests

1 participant