-
Notifications
You must be signed in to change notification settings - Fork 7
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: Refactor Go architecture #43
Conversation
Refactoring Go SDK to be closer to the API and internal representation that we have with the Rust SDK. Just doing Datadog at the moment and seeking some feedback then i'll port the others and add docs and tests.
go/adapter.go
Outdated
return fmt.Sprintf("%032x", t) | ||
return AdapterBase{ | ||
// TODO set to some kind of max, add dump logic | ||
TraceEvents: make(chan TraceEvent, 100), |
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.
My plan is for the adapter to hold a bucket of these events and dump them after MAX is reached or after some timeout occurs. So it may make sense to default this to MAX. but it could also be something configurable by the end programmer.
Collectors: map[*Collector]chan bool{}, | ||
return AdapterBase{ | ||
// TODO set to some kind of max, add dump logic | ||
TraceEvents: make(chan TraceEvent, 100), |
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.
Sends to this channel will block once the channel reaches 100 events. I think thats probably ok, but wondering if this is intentional. We can omit the buffered size and let the channel grow as needed.
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.
Yeah i think non-buffered might be the way to go but let me think about it for a moment. my intention with using a buffered channel is if the adapter is busy then it may take some time to read off this channel which would block the sender right? By default sending a message to a channel blocks until the receiver synchronizes. Ideally the adapter just pulls messages off this channel and only puts them in a local slice, then it submits them offline in another goroutine. but i haven't done that yet. so this is acting at the bucket.
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 see -- yea that makes sense!
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'll make a follow up for that. Goal will be to add the bucket on the adapter side and test that this channel can't get blocked. We just need to make sure that the adapter's main routine only reads off this channel as fast as possible. And if it can't put the events in a bucket it should just throw them away and log an error. But never block.
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.
SGTM!
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.
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.
@bhelx - if you wanna give it one last look, and then merge when you're ready I think it's good to go
Refactoring Go SDK to be closer to the API and internal representation that we have with the Rust SDK.