Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion source/extensions/stat_sinks/hystrix/hystrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "common/buffer/buffer_impl.h"
#include "common/common/logger.h"
#include "common/common/macros.h"
#include "common/config/well_known_names.h"
#include "common/http/headers.h"

Expand Down Expand Up @@ -275,6 +276,8 @@ HystrixSink::HystrixSink(Server::Instance& server, const uint64_t num_buckets)
MAKE_ADMIN_HANDLER(handlerHystrixEventStream), false, false);
}

const std::string& HystrixSink::zeroValue() const { CONSTRUCT_ON_FIRST_USE(std::string, "0"); }

Http::Code HystrixSink::handlerHystrixEventStream(absl::string_view,
Http::HeaderMap& response_headers,
Buffer::Instance&,
Expand All @@ -290,7 +293,7 @@ Http::Code HystrixSink::handlerHystrixEventStream(absl::string_view,
AccessControlAllowHeadersValue.AllowHeadersHystrix);
response_headers.insertAccessControlAllowOrigin().value().setReference(
Http::Headers::get().AccessControlAllowOriginValue.All);
response_headers.insertNoChunks().value().setReference("0");
response_headers.insertNoChunks().value().setReference(zeroValue());

Copy link
Copy Markdown
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
Copy Markdown
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!


Http::StreamDecoderFilterCallbacks& stream_decoder_filter_callbacks =
admin_stream.getDecoderFilterCallbacks();
Expand Down
2 changes: 2 additions & 0 deletions source/extensions/stat_sinks/hystrix/hystrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class HystrixSink : public Stats::Sink, public Logger::Loggable<Logger::Id::hyst
uint64_t reporting_hosts, std::chrono::milliseconds rolling_window_ms,
std::stringstream& ss);

const std::string& zeroValue() const;

std::vector<Http::StreamDecoderFilterCallbacks*> callbacks_list_;
Server::Instance& server_;
uint64_t current_index_;
Expand Down