Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
5d40fc4
Avoid crashes in fuzz-tests due to input strings being too long.
jmarantz Oct 27, 2019
8f9ab93
Eliminate 64k limit on # of segments in a real symbol-table stat-name…
jmarantz Oct 28, 2019
beb4684
some cleanup
jmarantz Oct 28, 2019
d143365
Share helper methods for encoding/decoding symbols and sizes.
jmarantz Oct 29, 2019
5ef1a49
cleanup
jmarantz Oct 29, 2019
c425551
typo
jmarantz Oct 29, 2019
f680ccc
fix confusing about whether the encoding-length was the number of byt…
jmarantz Oct 29, 2019
9fee9f5
fix over-aggressive inequality for fake symbol tables
jmarantz Oct 29, 2019
184fbed
don't recompute the number of bytes consumed.
jmarantz Oct 29, 2019
6ac3dee
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Oct 29, 2019
9c62a9e
remove dynamo-stats test change which is not needed
jmarantz Oct 29, 2019
4482ca7
use totalSizeBytes to simplify some code.
jmarantz Oct 29, 2019
14220bb
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 1, 2019
4d345d0
add MemBlock abstraction to isolate risky memory operations.
jmarantz Nov 2, 2019
5b6f0db
reduce need to do byte access to the memory buffers.
jmarantz Nov 2, 2019
70ffe33
remove remainder of memcpy and pointer arithmetic outside MemBlock cl…
jmarantz Nov 2, 2019
9f1eae7
format
jmarantz Nov 2, 2019
cf33e18
some cleanup -- still needs more unit tests.
jmarantz Nov 2, 2019
14b8740
remove superfluous methods.
jmarantz Nov 2, 2019
eb6eb51
add unit test.
jmarantz Nov 2, 2019
6d4b8bc
improve class comment.
jmarantz Nov 2, 2019
cf71f0b
rename MemBlock to MemBlockBuilder.
jmarantz Nov 2, 2019
256a857
Rename MemBlock to MemBlockBuilder to better reflect intended usage m…
jmarantz Nov 2, 2019
cb17d28
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 2, 2019
7b3150e
format.
jmarantz Nov 2, 2019
c4ddd4a
improve comments and function naming.
jmarantz Nov 3, 2019
c728651
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 3, 2019
4824977
guard memcpy against 0-byte calls, which show up as asan failures.
jmarantz Nov 3, 2019
3c9b184
Merge branch 'stats-fuzzer-not-too-long' of github.com:jmarantz/envoy…
jmarantz Nov 14, 2019
5f4ea86
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 14, 2019
64c0af4
RELEASE_ASSERT rather than ASSERT, use non-constructing allocation.
jmarantz Nov 17, 2019
06e3fbc
add test to make sure we don't construct anything.
jmarantz Nov 18, 2019
b2131df
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 18, 2019
a281e28
update gold values
jmarantz Nov 18, 2019
cd98dd2
Go back to new-ing an array and clean up.
jmarantz Nov 19, 2019
cf7b451
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 19, 2019
8069e89
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 20, 2019
9ae8144
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Nov 22, 2019
922a860
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Dec 10, 2019
6dcc218
typo and gold values update.
jmarantz Dec 10, 2019
006b5c7
Merge branch 'master' into stats-fuzzer-not-too-long
jmarantz Dec 14, 2019
f78495d
get basic dynamic stat-names working.
jmarantz Dec 15, 2019
2a4d3cd
Make dynamic StatNames compatible with FakeSymbolTable.
jmarantz Dec 15, 2019
938b5b6
Convert dynamo to the new Dynamic stats infrastructure.
jmarantz Dec 15, 2019
552e530
comments and fix lessThan function to incorporate string-view compone…
jmarantz Dec 15, 2019
41337e7
Add and use StatNameDynamicPool.
jmarantz Dec 15, 2019
12a79a5
format
jmarantz Dec 15, 2019
0db36b4
migrage from StatNameSet::getDynamic to StatNameDynamicStorage and St…
jmarantz Dec 15, 2019
3d03ad3
Remove getDynamic call from ip_tagging_filter.
jmarantz Dec 15, 2019
775affa
get rid of remaining references to StatNameSet::getDynamic().
jmarantz Dec 15, 2019
33bdd19
Remove StatNameSet::getDynamic impl.
jmarantz Dec 15, 2019
e252c85
fix build.
jmarantz Dec 15, 2019
5cbf938
remove the recent_lookups infrastructure from StatNameSet now that it…
jmarantz Dec 15, 2019
17faf1b
Remove commented-out stuff.
jmarantz Dec 15, 2019
796898f
remove unused vector.
jmarantz Dec 15, 2019
d4b98e2
add some asserts that we compute the exact right size for our mem-blo…
jmarantz Dec 15, 2019
125aecd
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 15, 2019
d01fe51
more interface change churn.
jmarantz Dec 15, 2019
e5204cf
fix lifetime issues for span in test.
jmarantz Dec 15, 2019
fc037e5
mirror changes from #9360 to reduce merge conflicts later.
jmarantz Dec 16, 2019
16697a9
manually copy changes from #9360
jmarantz Dec 16, 2019
e0388ba
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 16, 2019
a325d64
update call to MemBlockBuilder::populate(), which is now MemBlockBuil…
jmarantz Dec 16, 2019
827e079
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 20, 2019
f41c82a
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 28, 2019
c794070
clean up
jmarantz Dec 29, 2019
31e4daa
more cleanup and doc.
jmarantz Dec 29, 2019
aec519f
update stats.md to reflect dynamic stats.
jmarantz Dec 29, 2019
6f174d2
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 29, 2019
cbbb17e
Merge branch 'master' into stats-dynamic-escape
jmarantz Dec 30, 2019
92597aa
Add fuzzing for dynamic stats and joins.
jmarantz Dec 30, 2019
946e552
Merge branch 'master' into stats-dynamic-escape
jmarantz Jan 2, 2020
038768a
Merge branch 'master' into stats-dynamic-escape
jmarantz Jan 8, 2020
bcb2604
Merge branch 'master' into stats-dynamic-escape
jmarantz Jan 8, 2020
184f216
review comments.
jmarantz Jan 10, 2020
ed39356
added cost discussion to the dynamic stats section in stats.md.
jmarantz Jan 10, 2020
090b4f3
formatting
jmarantz Jan 10, 2020
a8c886c
add diagram
jmarantz Jan 10, 2020
f4276dc
spelling
jmarantz Jan 10, 2020
9871570
clean up diagram and add some text.
jmarantz Jan 10, 2020
15ca059
add class dictionary
jmarantz Jan 11, 2020
490ea3e
typos
jmarantz Jan 11, 2020
f1e8100
add reference to diagram source so others can edit.
jmarantz Jan 12, 2020
e21d80b
fix link
jmarantz Jan 12, 2020
cfb6c43
fix link try 2
jmarantz Jan 12, 2020
d89e3c6
clean up diagram a little (small fonts 7 to 8, etc).
jmarantz Jan 12, 2020
8711d30
Merge branch 'master' into stats-dynamic-escape
jmarantz Jan 14, 2020
c3d7b72
fix merge-conflict remnant.
jmarantz Jan 14, 2020
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
8 changes: 2 additions & 6 deletions include/envoy/stats/symbol_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class SymbolTable {

private:
friend struct HeapStatData;
friend class StatNameDynamicStorage;
friend class StatNameStorage;
friend class StatNameList;
friend class StatNameSet;
Expand Down Expand Up @@ -222,12 +223,7 @@ class SymbolTable {
*/
virtual StoragePtr encode(absl::string_view name) PURE;

/**
* Called by StatNameSet's destructor.
*
* @param stat_name_set the set.
*/
virtual void forgetSet(StatNameSet& stat_name_set) PURE;
virtual StoragePtr makeDynamicStorage(absl::string_view name) PURE;
};

using SymbolTablePtr = std::unique_ptr<SymbolTable>;
Expand Down
9 changes: 1 addition & 8 deletions source/common/http/codes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ void CodeStatsImpl::chargeResponseTiming(const ResponseTimingInfo& info) const {
}
}

absl::string_view CodeStatsImpl::stripTrailingDot(absl::string_view str) {
if (absl::EndsWith(str, ".")) {
str.remove_suffix(1);
}
return str;
}

Stats::StatName CodeStatsImpl::upstreamRqGroup(Code response_code) const {
switch (enumToInt(response_code) / 100) {
case 1:
Expand All @@ -187,7 +180,7 @@ Stats::StatName CodeStatsImpl::upstreamRqStatName(Code response_code) const {
if (rc_index >= NumHttpCodes) {
return upstream_rq_unknown_;
}
std::atomic<uint8_t*>& atomic_ref = rc_stat_names_[rc_index];
std::atomic<const uint8_t*>& atomic_ref = rc_stat_names_[rc_index];
if (atomic_ref.load() == nullptr) {
absl::MutexLock lock(&mutex_);

Expand Down
3 changes: 1 addition & 2 deletions source/common/http/codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class CodeStatsImpl : public CodeStats {
void recordHistogram(Stats::Scope& scope, const Stats::StatNameVec& names,
Stats::Histogram::Unit unit, uint64_t count) const;

static absl::string_view stripTrailingDot(absl::string_view prefix);
Stats::StatName upstreamRqGroup(Code response_code) const;
Stats::StatName upstreamRqStatName(Code response_code) const;

Expand Down Expand Up @@ -109,7 +108,7 @@ class CodeStatsImpl : public CodeStats {

static constexpr uint32_t NumHttpCodes = 500;
static constexpr uint32_t HttpCodeOffset = 100; // code 100 is at index 0.
mutable std::atomic<uint8_t*> rc_stat_names_[NumHttpCodes];
mutable std::atomic<const uint8_t*> rc_stat_names_[NumHttpCodes];
};

/**
Expand Down
6 changes: 1 addition & 5 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,7 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::HeaderMap& headers, bool e

const Http::HeaderEntry* request_alt_name = headers.EnvoyUpstreamAltStatName();
if (request_alt_name) {
// TODO(#7003): converting this header value into a StatName requires
// taking a global symbol-table lock. This is not a frequently used feature,
// but may not be the only occurrence of this pattern, where it's difficult
// or impossible to pre-compute a StatName for a component of a stat name.
alt_stat_prefix_ = std::make_unique<Stats::StatNameManagedStorage>(
alt_stat_prefix_ = std::make_unique<Stats::StatNameDynamicStorage>(
request_alt_name->value().getStringView(), config_.scope_.symbolTable());
headers.removeEnvoyUpstreamAltStatName();
}
Expand Down
2 changes: 1 addition & 1 deletion source/common/router/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class Filter : Logger::Loggable<Logger::Id::router>,
RouteConstSharedPtr route_;
const RouteEntry* route_entry_{};
Upstream::ClusterInfoConstSharedPtr cluster_;
std::unique_ptr<Stats::StatNameManagedStorage> alt_stat_prefix_;
std::unique_ptr<Stats::StatNameDynamicStorage> alt_stat_prefix_;
const VirtualCluster* request_vcluster_;
Event::TimerPtr response_timeout_;
FilterUtility::TimeoutData timeout_;
Expand Down
12 changes: 6 additions & 6 deletions source/common/stats/fake_symbol_table_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ class FakeSymbolTableImpl : public SymbolTable {
MemBlockBuilder<uint8_t> mem_block(total_size_bytes);
mem_block.appendOne(num_names);
for (uint32_t i = 0; i < num_names; ++i) {
auto& name = names[i];
size_t sz = name.size();
absl::string_view name = names[i];
const size_t sz = name.size();
SymbolTableImpl::Encoding::appendEncoding(sz, mem_block);
if (!name.empty()) {
mem_block.appendData(
absl::MakeConstSpan(reinterpret_cast<const uint8_t*>(name.data()), sz));
mem_block.appendData(absl::MakeSpan(reinterpret_cast<const uint8_t*>(name.data()), sz));
}
}

Expand All @@ -102,6 +101,7 @@ class FakeSymbolTableImpl : public SymbolTable {
void free(const StatName&) override {}
void incRefCount(const StatName&) override {}
StoragePtr encode(absl::string_view name) override { return encodeHelper(name); }
StoragePtr makeDynamicStorage(absl::string_view name) override { return encodeHelper(name); }
SymbolTable::StoragePtr join(const std::vector<StatName>& names) const override {
std::vector<absl::string_view> strings;
for (StatName name : names) {
Expand All @@ -125,7 +125,6 @@ class FakeSymbolTableImpl : public SymbolTable {
// make_unique does not work with private ctor, even though FakeSymbolTableImpl is a friend.
return StatNameSetPtr(new StatNameSet(*this, name));
}
void forgetSet(StatNameSet&) override {}
uint64_t getRecentLookups(const RecentLookupsFn&) const override { return 0; }
void clearRecentLookups() override {}
void setRecentLookupCapacity(uint64_t) override {}
Expand All @@ -142,7 +141,8 @@ class FakeSymbolTableImpl : public SymbolTable {
MemBlockBuilder<uint8_t> mem_block(SymbolTableImpl::Encoding::totalSizeBytes(name.size()));
SymbolTableImpl::Encoding::appendEncoding(name.size(), mem_block);
mem_block.appendData(
absl::MakeConstSpan(reinterpret_cast<const uint8_t*>(name.data()), name.size()));
absl::MakeSpan(reinterpret_cast<const uint8_t*>(name.data()), name.size()));
ASSERT(mem_block.capacityRemaining() == 0);
return mem_block.release();
}
};
Expand Down
Loading