Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
7223128
initial commit
fredlas Feb 11, 2019
520e353
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Feb 11, 2019
88238ea
add note to version_history about the hot-restart-breaking changes
fredlas Feb 12, 2019
343ecaf
replace hot restart RPC proto with a protobuf-based one
fredlas Feb 13, 2019
676cbfb
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Feb 13, 2019
fd5187f
rearrange version_history list
fredlas Feb 13, 2019
cdf7eeb
rearrange version_history list again
fredlas Feb 13, 2019
ba050ff
remove not yet necessary SimpleMetric additions
fredlas Feb 13, 2019
4cc2c5d
address comments
fredlas Feb 14, 2019
2d478b2
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Feb 14, 2019
c6f2570
remove now unused resizeRecvBuf
fredlas Feb 14, 2019
4dcb47f
expected type helper cleanup
fredlas Feb 15, 2019
062dc24
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Feb 15, 2019
49ac058
make sendmsg always blocking
fredlas Feb 15, 2019
7176243
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Feb 15, 2019
9ab728e
initial work on stat combining logic, about to rip out shmem
fredlas Mar 4, 2019
0a2dd3a
initial apparently working version of stats not in shared memory
fredlas Mar 7, 2019
453fe6b
resolve merge
fredlas Mar 7, 2019
311bd4b
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Mar 7, 2019
1e1adbb
fix proto BUILD file
fredlas Mar 7, 2019
ac8324a
add basic unit test for combining logic
fredlas Mar 7, 2019
034c362
clean up comments, add basic unit test
fredlas Mar 7, 2019
14f0b4b
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Mar 7, 2019
ff2df39
added boolIndicator support, more testing
fredlas Mar 7, 2019
bd5a88b
remove max_stats shared memory limit
fredlas Mar 7, 2019
2fa39cd
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Mar 7, 2019
2906b9b
restore max-stats flag
fredlas Mar 18, 2019
73e3217
remove bool indicator stat combination
fredlas Mar 18, 2019
d4151f3
resolve conflict
fredlas Mar 18, 2019
9c63bf4
remove boolIndicator support, add all necessary combination logic exc…
fredlas Mar 18, 2019
d24f0d1
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Mar 18, 2019
ece40e6
bring max_stats field back into proto
fredlas Mar 27, 2019
3e064c9
resolve merge conflict
fredlas Mar 27, 2019
3a1911c
add words to dictionary
fredlas Mar 27, 2019
7233a5c
docs can no longer have max-stats tagged as an option
fredlas Mar 27, 2019
70445f0
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 5, 2019
982f4b4
move release notes to 1.11.0
fredlas Apr 5, 2019
683e523
Kick CI
fredlas Apr 8, 2019
708e0a3
address simple comments and merge master
fredlas Apr 12, 2019
c5a92fa
address simple comments and merge master conflict
fredlas Apr 12, 2019
f1bf534
hot restart no longer uses envoy.admin.v2alpha.SimpleMetric proto
fredlas Apr 15, 2019
1582531
break stat merging logic out into its own class
fredlas Apr 15, 2019
ae9998d
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 15, 2019
9133ff6
address comments, remove many uses of StatsOptions
fredlas Apr 16, 2019
2e07d8a
add TODOs
fredlas Apr 16, 2019
ee94b33
remove BooleanOr
fredlas Apr 17, 2019
072e086
switch combination logic exceptions to regex
fredlas Apr 17, 2019
0042aea
remove StatsOptions and max-obj-name-length
fredlas Apr 17, 2019
1e0052c
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 17, 2019
84cbb15
docs cleanup
fredlas Apr 18, 2019
c883fb5
add comments to merge logic exceptions
fredlas Apr 18, 2019
c50b1f4
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 18, 2019
bc6791f
bring test in line with changes i just made
fredlas Apr 18, 2019
cd7858d
add note about combine logic
fredlas Apr 18, 2019
86b3594
refactor server usage of hot restart
fredlas Apr 18, 2019
ab00d3a
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 18, 2019
b833808
delete RawStatData and BlockMemoryHashSet
fredlas Apr 18, 2019
0ff2ba9
remove requiresBoundedStatNameSize
fredlas Apr 18, 2019
5ca818a
remove unused raw_stat_data_test
fredlas Apr 18, 2019
6ec5536
fix test
fredlas Apr 18, 2019
191fdee
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 18, 2019
9b4b5c3
further cleanup and deletion
fredlas Apr 19, 2019
fbaa76f
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 19, 2019
4760aa9
fix weird TSAN failure
fredlas Apr 19, 2019
a967a1c
minor refactor of StatMerger anticipating all-gauges-logic verification
fredlas Apr 19, 2019
5fd8b77
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 19, 2019
07f6821
add verifyCombineLogicSpecified TODO
fredlas Apr 19, 2019
344ecef
apply some comments
fredlas Apr 23, 2019
bb8e14a
resolve merge conflict
fredlas Apr 23, 2019
8f6d830
first counter value shouldnt increment
fredlas Apr 24, 2019
7500f41
rename unix seconds
fredlas Apr 24, 2019
68e7a52
ConstCharStarHashMap
fredlas Apr 24, 2019
a0f5d47
comments
fredlas Apr 24, 2019
98bcdf2
fix test
fredlas Apr 24, 2019
e8c2dc8
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 24, 2019
95a8f65
separate out counter values from deltas
fredlas Apr 25, 2019
4c01657
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 25, 2019
2256fdc
stop sending whole counter value, cache combine logic
fredlas Apr 25, 2019
e2b0380
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 25, 2019
1f1dc51
fix uses of things i removed
fredlas Apr 25, 2019
6cc31a1
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 25, 2019
ed5d2bd
fix uses of things i removed
fredlas Apr 25, 2019
4fb5ce1
merge stats symbol table
fredlas Apr 26, 2019
2156168
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 26, 2019
20b2217
change static map to pointer
fredlas Apr 26, 2019
c90c713
add comment
fredlas Apr 26, 2019
88726c2
remove only import when unused logic option
fredlas Apr 29, 2019
e521b15
replace CombineLogic enum with bool
fredlas Apr 29, 2019
5b2b05e
remove accidental temp file
fredlas Apr 29, 2019
6019303
added TODO, and dont send 0 delta counters
fredlas Apr 29, 2019
b5f9a44
resolve conflict
fredlas Apr 29, 2019
4d7c740
add TODO
fredlas Apr 29, 2019
27b7d3f
hot restart parent tests
fredlas Apr 29, 2019
96fc99c
rename combineLogic to shouldImport
fredlas Apr 29, 2019
79b0eec
revert ConstCharStarHashMap and address comments
fredlas Apr 30, 2019
3d133c7
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 30, 2019
7228b85
unrevert, but now to StatNameHashMap
fredlas Apr 30, 2019
399033a
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas Apr 30, 2019
3521042
update BUILD
fredlas Apr 30, 2019
5eebdaa
enhance a StatMerger test
fredlas Apr 30, 2019
50bb3b8
Merge remote-tracking branch 'upstream/master' into RPC_non_recvmg_rpc
fredlas May 1, 2019
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: 3 additions & 5 deletions api/envoy/admin/v2alpha/server_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ message CommandLineOptions {
// See :option:`--mode` for details.
Mode mode = 19;

// See :option:`--max-stats` for details.
uint64 max_stats = 20;

// See :option:`--max-obj-name-len` for details.
uint64 max_obj_name_len = 21;
// max_stats and max_obj_name_len are now unused and have no effect.
uint64 max_stats = 20 [deprecated = true];
uint64 max_obj_name_len = 21 [deprecated = true];

// See :option:`--disable-hot-restart` for details.
bool disable_hot_restart = 22;
Expand Down
3 changes: 0 additions & 3 deletions api/envoy/api/v2/cds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ message Cluster {
// :ref:`statistics <config_cluster_manager_cluster_stats>` if :ref:`alt_stat_name
// <envoy_api_field_Cluster.alt_stat_name>` is not provided.
// Any ``:`` in the cluster name will be converted to ``_`` when emitting statistics.
// By default, the maximum length of a cluster name is limited to 60
// characters. This limit can be increased by setting the
// :option:`--max-obj-name-len` command line argument to the desired value.
string name = 1 [(validate.rules).string.min_bytes = 1];

// An optional alternative to the cluster name to be used while emitting stats.
Expand Down
3 changes: 0 additions & 3 deletions api/envoy/api/v2/lds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ message Listener {
// The unique name by which this listener is known. If no name is provided,
// Envoy will allocate an internal UUID for the listener. If the listener is to be dynamically
// updated or removed via :ref:`LDS <config_listeners_lds>` a unique name must be provided.
// By default, the maximum length of a listener's name is limited to 60 characters. This limit can
// be increased by setting the :option:`--max-obj-name-len` command line argument to the desired
// value.
string name = 1;

// The address that the listener should listen on. In general, the address must be unique, though
Expand Down
12 changes: 0 additions & 12 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,6 @@ local_repository(
...
```

## Stats Tunables

The default maximum number of stats in shared memory, and the default
maximum length of a cluster/route config/listener name, can be
overridden at compile-time by defining `ENVOY_DEFAULT_MAX_STATS` and
`ENVOY_DEFAULT_MAX_OBJ_NAME_LENGTH`, respectively, to the desired
value. For example:

```
bazel build --copt=-DENVOY_DEFAULT_MAX_STATS=32768 --copt=-DENVOY_DEFAULT_MAX_OBJ_NAME_LENGTH=150 //source/exe:envoy-static
```

# Release builds

Release builds should be built in `opt` mode, processed with `strip` and have a
Expand Down
8 changes: 0 additions & 8 deletions docs/root/configuration/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
Statistics
==========

A few statistics are emitted to report statistics system behavior:

.. csv-table::
:header: Name, Type, Description
:widths: 1, 1, 2

stats.overflow, Counter, Total number of times Envoy cannot allocate a statistic due to a shortage of shared memory

Server
------

Expand Down
1 change: 1 addition & 0 deletions docs/root/intro/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Deprecated items below are listed in chronological order.

Version 1.11.0 (Pending)
========================
* The --max-stats and --max-obj-name-len flags no longer has any effect.
* Use of :ref:`cluster <envoy_api_field_config.filter.network.redis_proxy.v2.RedisProxy.cluster>` in :ref:`redis_proxy.proto <envoy_api_file_envoy/config/filter/network/redis_proxy/v2/redis_proxy.proto>` is deprecated. Set a :ref:`catch_all_cluster <envoy_api_field_config.filter.network.redis_proxy.v2.RedisProxy.PrefixRoutes.catch_all_cluster>` instead.

Version 1.10.0 (Apr 5, 2019)
Expand Down
3 changes: 2 additions & 1 deletion docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version history
* event: added :ref:`loop duration and poll delay statistics <operations_performance>`.
* ext_authz: added a `x-envoy-auth-partial-body` metadata header set to `false|true` indicating if there is a partial body sent in the authorization request message.
* ext_authz: added option to `ext_authz` that allows the filter clearing route cache.
* hot restart: stats are no longer shared between hot restart parent/child via shared memory, but rather by RPC. Hot restart version incremented to 11.
* http: mitigated a race condition with the :ref:`delayed_close_timeout<envoy_api_field_config.filter.network.http_connection_manager.v2.HttpConnectionManager.delayed_close_timeout>` where it could trigger while actively flushing a pending write buffer for a downstream connection.
* jwt_authn: make filter's parsing of JWT more flexible, allowing syntax like ``jwt=eyJhbGciOiJS...ZFnFIw,extra=7,realm=123``
* redis: added :ref:`prefix routing <envoy_api_field_config.filter.network.redis_proxy.v2.RedisProxy.prefix_routes>` to enable routing commands based on their key's prefix to different upstream.
Expand Down Expand Up @@ -643,7 +644,7 @@ Version history
* runtime: added :ref:`comment capability <config_runtime_comments>`.
* server: change default log level (:option:`-l`) to `info`.
* stats: maximum stat/name sizes and maximum number of stats are now variable via the
:option:`--max-obj-name-len` and :option:`--max-stats` options.
`--max-obj-name-len` and `--max-stats` options.
* tcp proxy: added :ref:`access logging <envoy_api_field_config.filter.network.tcp_proxy.v2.TcpProxy.access_log>`.
* tcp proxy: added :ref:`configurable connect retries
<envoy_api_field_config.filter.network.tcp_proxy.v2.TcpProxy.max_connect_attempts>`.
Expand Down
2 changes: 0 additions & 2 deletions docs/root/operations/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ modify different aspects of the server:
"service_node": "",
"service_zone": "",
"mode": "Serve",
"max_stats": "16384",
"max_obj_name_len": "60",
"disable_hot_restart": false,
"enable_mutex_tracing": false,
"restart_epoch": 0,
Expand Down
12 changes: 0 additions & 12 deletions docs/root/operations/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,12 @@ following are the command line options that Envoy supports.
during a hot restart. See the :ref:`hot restart overview <arch_overview_hot_restart>` for more
information. Defaults to 900 seconds (15 minutes).

.. option:: --max-obj-name-len <uint64_t>

*(optional)* The maximum name length (in bytes) of the name field in a cluster/route_config/listener.
This setting is typically used in scenarios where the cluster names are auto generated, and often exceed
the built-in limit of 60 characters. Defaults to 60, and it's not valid to set to less than 60.

.. attention::

This setting affects the output of :option:`--hot-restart-version`. If you started Envoy with this
option set to a non default value, you should use the same option (and same value) for subsequent hot
restarts.

.. option:: --max-stats <uint64_t>

*(optional)* The maximum number of stats that can be shared between hot-restarts. This setting
affects the output of :option:`--hot-restart-version`; the same value must be used to hot
restart. Defaults to 16384. It's not valid to set this larger than 100 million.

.. option:: --disable-hot-restart

*(optional)* This flag disables Envoy hot restart for builds that have it enabled. By default, hot
Expand Down
2 changes: 0 additions & 2 deletions docs/root/start/sandboxes/front_proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ statistics. For example inside ``frontenvoy`` we can get::
"service_node": "",
"service_zone": "",
"mode": "Serve",
"max_stats": "16384",
"max_obj_name_len": "60",
"disable_hot_restart": false,
"enable_mutex_tracing": false,
"restart_epoch": 0,
Expand Down
1 change: 1 addition & 0 deletions include/envoy/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ envoy_cc_library(
deps = [
"//include/envoy/event:dispatcher_interface",
"//include/envoy/thread:thread_interface",
"//source/server:hot_restart_cc",
],
)

Expand Down
51 changes: 25 additions & 26 deletions include/envoy/server/hot_restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
#include "envoy/common/pure.h"
#include "envoy/event/dispatcher.h"
#include "envoy/stats/stat_data_allocator.h"
#include "envoy/stats/store.h"
#include "envoy/thread/thread.h"

#include "source/server/hot_restart.pb.h"

namespace Envoy {
namespace Server {

Expand All @@ -20,13 +23,9 @@ class Instance;
*/
class HotRestart {
public:
struct GetParentStatsInfo {
uint64_t memory_allocated_;
uint64_t num_connections_;
};

struct ShutdownParentAdminInfo {
time_t original_start_time_;
struct ServerStatsFromParent {
uint64_t parent_memory_allocated_ = 0;
uint64_t parent_connections_ = 0;
};

virtual ~HotRestart() {}
Expand All @@ -46,32 +45,37 @@ class HotRestart {
virtual int duplicateParentListenSocket(const std::string& address) PURE;

/**
* Retrieve stats from our parent process.
* @param info will be filled with information from our parent if it can be retrieved.
*/
virtual void getParentStats(GetParentStatsInfo& info) PURE;

/**
* Initialize the restarter after primary server initialization begins. The hot restart
* implementation needs to be created early to deal with shared memory, logging, etc. so
* late initialization of needed interfaces is done here.
* Initialize the parent logic of our restarter. Meant to be called after initialization of a
* new child has begun. The hot restart implementation needs to be created early to deal with
* shared memory, logging, etc. so late initialization of needed interfaces is done here.
*/
virtual void initialize(Event::Dispatcher& dispatcher, Server::Instance& server) PURE;

/**
* Shutdown admin processing in the parent process if applicable. This allows admin processing
* to start up in the new process.
* @param info will be filled with information from our parent if it can be retrieved.
* @param original_start_time will be filled with information from our parent, if retrieved.
*/
virtual void shutdownParentAdmin(ShutdownParentAdminInfo& info) PURE;
virtual void sendParentAdminShutdownRequest(time_t& original_start_time) PURE;

/**
* Tell our parent to gracefully terminate itself.
* Tell our parent process to gracefully terminate itself.
*/
virtual void terminateParent() PURE;
virtual void sendParentTerminateRequest() PURE;

/**
* Shutdown the hot restarter.
* Retrieve stats from our parent process and merges them into stats_store, taking into account
* the stats values we've already seen transferred.
* Skips all of the above and returns 0s if there is not currently a parent.
* @param stats_store the store whose stats will be updated.
* @param stats_proto the stats values we are updating with.
* @return special values relating to the "server" stats scope, whose
* merging has to be handled by Server::InstanceImpl.
*/
virtual ServerStatsFromParent mergeParentStatsIfAny(Stats::StoreRoot& stats_store) PURE;

/**
* Shutdown the half of our hot restarter that acts as a parent.
*/
virtual void shutdown() PURE;

Expand All @@ -90,11 +94,6 @@ class HotRestart {
* @return Thread::BasicLockable& a lock for access logs.
*/
virtual Thread::BasicLockable& accessLogLock() PURE;

/**
* @returns an allocator for stats.
*/
virtual Stats::StatDataAllocator& statsAllocator() PURE;
};

} // namespace Server
Expand Down
6 changes: 0 additions & 6 deletions include/envoy/server/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ class Instance {
*/
virtual void failHealthcheck(bool fail) PURE;

/**
* Fetch server stats specific to this process vs. global shared stats in a hot restart scenario.
* @param info supplies the stats structure to fill.
*/
virtual void getParentStats(HotRestart::GetParentStatsInfo& info) PURE;

/**
* @return whether external healthchecks are currently failed or not.
*/
Expand Down
12 changes: 0 additions & 12 deletions include/envoy/server/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "envoy/admin/v2alpha/server_info.pb.h"
#include "envoy/common/pure.h"
#include "envoy/network/address.h"
#include "envoy/stats/stats_options.h"

#include "spdlog/spdlog.h"

Expand Down Expand Up @@ -148,17 +147,6 @@ class Options {
*/
virtual const std::string& serviceZone() const PURE;

/**
* @return uint64_t the maximum number of stats gauges and counters.
*/
virtual uint64_t maxStats() const PURE;

/**
* @return StatsOptions& the max stat name / suffix lengths for stats.
* router/cluster/listener.
*/
virtual const Stats::StatsOptions& statsOptions() const PURE;

/**
* @return bool indicating whether the hot restart functionality has been disabled via cli flags.
*/
Expand Down
1 change: 0 additions & 1 deletion include/envoy/stats/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ envoy_cc_library(
"stat_data_allocator.h",
"stats.h",
"stats_matcher.h",
"stats_options.h",
"store.h",
"tag.h",
"tag_extractor.h",
Expand Down
8 changes: 0 additions & 8 deletions include/envoy/stats/scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "envoy/common/pure.h"
#include "envoy/stats/histogram.h"
#include "envoy/stats/stats_options.h"
#include "envoy/stats/symbol_table.h"

namespace Envoy {
Expand All @@ -15,7 +14,6 @@ class Counter;
class Gauge;
class Histogram;
class Scope;
class StatsOptions;
class NullGaugeImpl;

typedef std::unique_ptr<Scope> ScopePtr;
Expand Down Expand Up @@ -86,12 +84,6 @@ class Scope {
*/
virtual Histogram& histogram(const std::string& name) PURE;

/**
* @return a reference to the top-level StatsOptions struct, containing information about the
* maximum allowable object name length and stat suffix length.
*/
virtual const Stats::StatsOptions& statsOptions() const PURE;

/**
* @return a reference to the symbol table.
*/
Expand Down
6 changes: 1 addition & 5 deletions include/envoy/stats/stat_data_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Stats {
* be created utilizing a single fixed-size block suitable for
* shared-memory, or in the heap, allowing for pointers and sharing of
* substrings, with an opportunity for reduced memory consumption.
* TODO(fredlas) this interface can be deleted now that the shared memory version is gone.
*/
class StatDataAllocator {
public:
Expand All @@ -48,11 +49,6 @@ class StatDataAllocator {
virtual GaugeSharedPtr makeGauge(StatName name, absl::string_view tag_extracted_name,
const std::vector<Tag>& tags) PURE;

/**
* Determines whether this stats allocator requires bounded stat-name size.
*/
virtual bool requiresBoundedStatNameSize() const PURE;

virtual const SymbolTable& symbolTable() const PURE;
virtual SymbolTable& symbolTable() PURE;

Expand Down
25 changes: 25 additions & 0 deletions include/envoy/stats/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "envoy/stats/symbol_table.h"

#include "absl/strings/string_view.h"
#include "absl/types/optional.h"

namespace Envoy {
namespace Stats {
Expand Down Expand Up @@ -65,6 +66,20 @@ class Metric {
*/
virtual bool used() const PURE;

/**
* Flags:
* Used: used by all stats types to figure out whether they have been used.
* Logic...: used by gauges to cache how they should be combined with a parent's value.
*/
struct Flags {
static const uint8_t Used = 0x01;
// TODO(fredlas) these logic flags should be removed if we move to indicating combine logic in
// the stat declaration macros themselves. (Now that stats no longer use shared memory, it's
// safe to mess with what these flag bits mean whenever we want).
static const uint8_t LogicAccumulate = 0x02;
static const uint8_t LogicNeverImport = 0x04;
static const uint8_t LogicCached = LogicAccumulate | LogicNeverImport;
};
virtual SymbolTable& symbolTable() PURE;
virtual const SymbolTable& symbolTable() const PURE;
};
Expand Down Expand Up @@ -99,6 +114,16 @@ class Gauge : public virtual Metric {
virtual void set(uint64_t value) PURE;
virtual void sub(uint64_t amount) PURE;
virtual uint64_t value() const PURE;

/**
* Returns the stat's combine logic, if known.
*/
virtual absl::optional<bool> cachedShouldImport() const PURE;

/**
* Sets the value to be returned by cachedCombineLogic().
*/
virtual void setShouldImport(bool should_import) PURE;
};

typedef std::shared_ptr<Gauge> GaugeSharedPtr;
Expand Down
Loading