-
Notifications
You must be signed in to change notification settings - Fork 812
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
Small optimization to PrometheusResponse marshalling #3964
Small optimization to PrometheusResponse marshalling #3964
Conversation
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
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.
Good stuff!
matrix = model.ValMatrix.String() | ||
json = jsoniter.Config{ | ||
EscapeHTML: false, // No HTML in our responses. | ||
SortMapKeys: true, |
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.
Why is this required?
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 don't think it's required, but I wasn't able to figure out if we may introduce any regression disabling it (the default config has it enabled). Any thoughts?
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 expect some clients are relying on it whether they realise it or not.
I.e. the ordering of series here maps directly to what you see in your dashboard, in at least some cases.
However we should try disabling it (in a separate change) and see if anyone notices.
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.
Opened an issue to follow up about it:
#3997
What this PR does:
I took a quick look at #3963 to see if there was any low-hanging fruit. In this PR I'm reducing the memory allocations when deserializing the
PrometheusResponse
. Not a big win, but still worthwhile.I've manually tested it both with query-frontend and query-scheduler, adding a temporarily log to see if
ContentLength
is valued correctly inprometheusCodec.DecodeResponse()
and it is.Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]