Skip to content

Fix setReference() call in hystrix stats sink#5815

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
rgs1:fix-hystrix
Feb 3, 2019
Merged

Fix setReference() call in hystrix stats sink#5815
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
rgs1:fix-hystrix

Conversation

@rgs1
Copy link
Member

@rgs1 rgs1 commented Feb 2, 2019

Per:

https://github.com/envoyproxy/envoy/blob/master/include/envoy/http/header_map.h#L148

setReference() needs a std::string ref that will live beyond
the lifetime of a request/response, but it's currently receiving
a string literal which is used to construct a temporary
std::string.

So instead pass a static std::string.

Signed-off-by: Raul Gutierrez Segales rgs@pinterest.com

Per:

https://github.com/envoyproxy/envoy/blob/master/include/envoy/http/header_map.h#L148

`setReference()` needs a std::string ref that will live beyond
the lifetime of a request/response, but it's currently receiving
a string literal which is used to construct a temporary
std::string.

So instead pass a static std::string.

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
@rgs1 rgs1 changed the title Fix setReference() call in hystrix stats sinks Fix setReference() call in hystrix stats sink Feb 2, 2019
@rgs1
Copy link
Member Author

rgs1 commented Feb 2, 2019

cc: @htuch @trabetti @jmarantz

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Small comment.

/wait

response_headers.insertAccessControlAllowOrigin().value().setReference(
Http::Headers::get().AccessControlAllowOriginValue.All);
response_headers.insertNoChunks().value().setReference("0");
response_headers.insertNoChunks().value().setReference(zeroValue());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that calling setInteger(0) here would be both faster and simpler to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, thanks for the quick review!

@mattklein123 mattklein123 self-assigned this Feb 3, 2019
Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattklein123 mattklein123 merged commit f54d222 into envoyproxy:master Feb 3, 2019
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Per:

https://github.com/envoyproxy/envoy/blob/master/include/envoy/http/header_map.h#L148

`setReference()` needs a std::string ref that will live beyond
the lifetime of a request/response, but it's currently receiving
a string literal which is used to construct a temporary
std::string.

So instead pass an integer.

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants