-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Using mime-type in prometheus parser to handle protocol-buffer responses #8545
Conversation
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.
Just two minor comments. One is in the code, the other one is: Could you please improve the PR-message to e.g. something like "Using mime-type in prometheus parser to handle protocol-buffer responses".
Wow that was fast @Aladex! :-) |
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.
Looks good to me.
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.
Looks great. Thank you!
Can we get a test to protect against regressions here?
Maybe, but i don't know how to do it :-( |
@Aladex you need one test-data sample in protocol-buffers format. The you start a small http-server to serve this sample to the plugin. Check |
Yes, but here we have examples with classic httptest.NewServer. How do i make such tests with the protobuf server? |
Let me understand this, I thought you query a http-server and get back a response with the mime-type set to protocol buffers and the message content is a binary protocol-buffer frame. Is this correct? If so, you can use the httptest.NewServer example, set the response header (e.g. https://www.lemoda.net/go/override-mime-type/index.html) of the answer and embedd serialized protocol-buffer data. The protocol-buffer data you might be able to generate from a real request to a real server offline and then just add the bytes as a variable (or file if it is larger). |
@srebhan hi. Can u review my latest changes? |
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.
Looks perfect.
Thank you! |
Fixed #8366