-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat: make spans fit an envelope size #4022
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
agent/workers/poller.go
Outdated
@@ -24,6 +25,8 @@ import ( | |||
"go.uber.org/zap" | |||
) | |||
|
|||
const maxEnvelopeSize = 4 * 1024 * 1024 // 4MB |
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 wonder if we should increase this value. What do you think @xoscar, @schoren and @danielbdias? Like 10MB. It should be something less than the server limit due to the large span policy in the code.
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.
You mean increasing the value server side too?
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.
No, just here. The server is already accepting a large-enough message. Increasing the message here means that in we can send more spans per polling cycle.
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.
We discussed and the limit on the server is 4MB, so I'm setting this to be 3MB
to prevent an overflow in case of a large span as discussed in the code.
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.
Great job!
|
||
// There's a weird scenario that must be covered here: imagine a span so big it is bigger than maxPacketSize. | ||
// It is impossible to send a span like this, so in this case, we classify those spans as "large spans" and we allow | ||
// `largeSpansPerPacket` per packet. |
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.
This is a great point, I believe there is an issue around this very same subject in one of the otel collector repos, I'm glad you thought about it too!
agent/workers/poller.go
Outdated
@@ -24,6 +25,8 @@ import ( | |||
"go.uber.org/zap" | |||
) | |||
|
|||
const maxEnvelopeSize = 4 * 1024 * 1024 // 4MB |
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.
You mean increasing the value server side too?
This PR makes all polling responses to be added to an envelope and to fit a certain size. It tries to fit as many spans as possible in the envelope before sending it to the server. In case a span is let out of the envelope, it will be sent in the next polling iterations.
Fixes
Checklist
Loom video
I could not record a loom because it is not supported in firefox 😢 But here is a screencast. In this case, I was running the agent in debug mode and an envelope max size of
5kb
, this is why you see spans increasing slowly. By default, we are going to use3MB
, which would be more than enough for real-life spans.Screencast.from.2024-09-17.16-56-18.webm