Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 9 additions & 5 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
"name": "Mac",
"includePath": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/opt/homebrew/include",
"/opt/homebrew/opt/openssl@3/include",
"/opt/homebrew/opt/openssl@1.1/include",
"/opt/homebrew/opt/openssl/include",
"/usr/local/include",
"/usr/local/opt/openssl@3/include",
"/usr/local/opt/openssl@1.1/include",
"/usr/local/opt/openssl/include",
"${workspaceFolder}",
Expand All @@ -20,12 +25,11 @@
"${workspaceFolder}/iocore/net",
"${workspaceFolder}/iocore/utils",
"${workspaceFolder}/lib",
"${workspaceFolder}/lib/records",
"${workspaceFolder}/src/records",
"${workspaceFolder}/lib/yamlcpp/include",
"${workspaceFolder}/lib/swoc/include",
"${workspaceFolder}/mgmt",
"${workspaceFolder}/mgmt/api",
"${workspaceFolder}/mgmt/api/include",
"${workspaceFolder}/mgmt/utils",
"${workspaceFolder}/mgmt/rpc",
"${workspaceFolder}/proxy",
"${workspaceFolder}/proxy/hdrs",
"${workspaceFolder}/proxy/http",
Expand Down
36 changes: 0 additions & 36 deletions doc/admin-guide/monitoring/statistics/core/bandwidth.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,3 @@ Bandwidth and Transfer
.. ts:stat:: global proxy.process.http.user_agent_response_header_total_size integer
:type: counter
:units: bytes

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_100 integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_100K integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_100M integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_10K integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_10M integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_1K integer
:type: derivative
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.user_agent_speed_bytes_per_sec_1M integer
:type: derivative
:units: bytes
:ungathered:

4 changes: 0 additions & 4 deletions doc/admin-guide/monitoring/statistics/core/cache.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ Cache
.. ts:stat:: global proxy.process.cache.hdr_marshals integer
:ungathered:

.. ts:stat:: global proxy.process.cache.KB_read_per_sec float
.. ts:stat:: global proxy.process.cache.KB_write_per_sec float
.. ts:stat:: global proxy.process.cache.lookup.active integer
:ungathered:

Expand All @@ -103,7 +101,6 @@ Cache
:ungathered:

.. ts:stat:: global proxy.process.cache.read.failure integer
.. ts:stat:: global proxy.process.cache.read_per_sec float
.. ts:stat:: global proxy.process.cache.read.success integer
.. ts:stat:: global proxy.process.cache.remove.active integer
:ungathered:
Expand Down Expand Up @@ -131,7 +128,6 @@ Cache
.. ts:stat:: global proxy.process.cache.write.backlog.failure integer
.. ts:stat:: global proxy.process.cache.write_bytes_stat integer
.. ts:stat:: global proxy.process.cache.write.failure integer
.. ts:stat:: global proxy.process.cache.write_per_sec float
.. ts:stat:: global proxy.process.cache.write.success integer

.. ts:stat:: global proxy.process.cache.span.errors.read integer
Expand Down
10 changes: 3 additions & 7 deletions doc/admin-guide/monitoring/statistics/core/dns.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
DNS
***

.. ts:stat:: global proxy.process.dns.fail_avg_time integer
:type: derivative
.. ts:stat:: global proxy.process.dns.fail_time integer
:units: milliseconds
:ungathered:

Expand All @@ -47,8 +46,7 @@ DNS

The number of resetting TCP connection in TCP_RETRY connection mode.

.. ts:stat:: global proxy.process.dns.lookup_avg_time integer
:type: derivative
.. ts:stat:: global proxy.process.dns.lookup_time integer
:units: milliseconds
:ungathered:

Expand Down Expand Up @@ -79,8 +77,7 @@ DNS
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.dns.success_avg_time integer
:type: derivative
.. ts:stat:: global proxy.process.dns.success_time integer
:units: milliseconds
:ungathered:

Expand All @@ -92,4 +89,3 @@ DNS

The total number of DNS lookups which have been performed since statistics
collection began.

Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,3 @@ HTTP Document Size
:type: counter
:units: bytes
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_100 integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_10K integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_1K integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_1M integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_3K integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_5K integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.request_document_size_inf integer
:type: counter
:ungathered:

.. ts:stat:: global proxy.process.http.response_document_size_100 integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_10K integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_1K integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_1M integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_3K integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_5K integer
:type: counter

.. ts:stat:: global proxy.process.http.response_document_size_inf integer
:type: counter
:ungathered:

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ HTTP Transaction
****************


.. ts:stat:: global proxy.process.http.avg_transactions_per_client_connection float
:type: derivative

.. ts:stat:: global proxy.process.http.avg_transactions_per_server_connection float
:type: derivative

.. ts:stat:: global proxy.process.http.total_transactions_time integer
:type: counter
:units: seconds
Expand Down
29 changes: 0 additions & 29 deletions doc/admin-guide/monitoring/statistics/core/origin.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,6 @@ Origin Server
:type: counter
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_100 integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_100K integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_100M integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_10K integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_10M integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_1K integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_server_speed_bytes_per_sec_1M integer
:type: derivative
:units: bytes

.. ts:stat:: global proxy.process.http.origin_shutdown.pool_lock_contention integer
:type counter
:units bytes
Expand Down Expand Up @@ -137,4 +109,3 @@ Origin Server
.. ts:stat:: global proxy.process.http.origin_shutdown.tunnel_abort integer
:type counter
:units bytes

18 changes: 0 additions & 18 deletions doc/appendices/command-line/traffic_top.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,24 +487,6 @@ Statistics:
|TS| also provides statistics for every other response code. The keen observer
will have hopefully already recognized the pattern in statistic names.

100 B, 1 KB, 3 KB, 5 KB, 10 KB, 1 MB, > 1 MB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Each of these fields indicates the percentage of responses from |TS| which fell
within a particular size (document body size, excluding response headers). The
individual fields are the upper bounds of exclusive *buckets*, meaning that a
response with a document body of 4,500 bytes will be counted in the ``5 KB``
field, but not in any of the smaller sizes.

Statistics:
:ts:stat:`proxy.process.http.response_document_size_100`,
:ts:stat:`proxy.process.http.response_document_size_1K`,
:ts:stat:`proxy.process.http.response_document_size_3K`,
:ts:stat:`proxy.process.http.response_document_size_5K`,
:ts:stat:`proxy.process.http.response_document_size_10K`,
:ts:stat:`proxy.process.http.response_document_size_1M`,
:ts:stat:`proxy.process.http.response_document_size_inf`.

Client
------

Expand Down
4 changes: 0 additions & 4 deletions doc/developer-guide/cache-architecture/data-structures.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,6 @@ Data Structures

.. member:: LINK<CacheVol> link

.. member:: RecRawStatBlock vol_rsb

per volume stat

.. class:: ConfigVol

This class represents an individual volume.
Expand Down
55 changes: 47 additions & 8 deletions include/api/Metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,21 @@ namespace ts
class Metrics
{
private:
using self_type = Metrics;
using IdType = int32_t; // Could be a tuple, but one way or another, they have to be combined to an int32_t.
using AtomicType = std::atomic<int64_t>;
using self_type = Metrics;

public:
using IntType = std::atomic<int64_t>;
using IdType = int32_t; // Could be a tuple, but one way or another, they have to be combined to an int32_t.

static constexpr uint16_t METRICS_MAX_BLOBS = 8192;
static constexpr uint16_t METRICS_MAX_SIZE = 2048; // For a total of 16M metrics
static constexpr IdType NOT_FOUND = std::numeric_limits<IdType>::min(); // <16-bit,16-bit> = <blob-index,offset>
static const auto MEMORY_ORDER = std::memory_order_relaxed;

private:
using NameAndId = std::tuple<std::string, IdType>;
using NameContainer = std::array<NameAndId, METRICS_MAX_SIZE>;
using AtomicContainer = std::array<AtomicType, METRICS_MAX_SIZE>;
using AtomicContainer = std::array<IntType, METRICS_MAX_SIZE>;
using MetricStorage = std::tuple<NameContainer, AtomicContainer>;
using MetricBlobs = std::array<MetricStorage *, METRICS_MAX_BLOBS>;
using LookupTable = std::unordered_map<std::string_view, IdType>;
Expand Down Expand Up @@ -84,9 +86,16 @@ class Metrics
// the std::atomic<int64_t> as the underlying class for a single metric, and be happy.
IdType newMetric(const std::string_view name);
IdType lookup(const std::string_view name) const;
AtomicType *lookup(IdType id, std::string_view *name = nullptr) const;
IntType *lookup(IdType id, std::string_view *name = nullptr) const;

AtomicType &
// A bit of a convenience, since we use the ptr to the atomic frequently in the core
IntType *
newMetricPtr(const std::string_view name)
{
return lookup(newMetric(name));
}

IntType &
operator[](IdType id)
{
return *lookup(id);
Expand All @@ -103,7 +112,7 @@ class Metrics
{
auto metric = lookup(id);

return (metric ? metric->fetch_add(val) : NOT_FOUND);
return (metric ? metric->fetch_add(val, MEMORY_ORDER) : NOT_FOUND);
}

// ToDo: Do we even need these inc/dec functions?
Expand All @@ -112,7 +121,7 @@ class Metrics
{
auto metric = lookup(id);

return (metric ? metric->fetch_sub(val) : NOT_FOUND);
return (metric ? metric->fetch_sub(val, MEMORY_ORDER) : NOT_FOUND);
}

std::string_view name(IdType id) const;
Expand All @@ -125,6 +134,35 @@ class Metrics
return (id >= 0 && ((blob < _cur_blob && entry < METRICS_MAX_SIZE) || (blob == _cur_blob && entry <= _cur_off)));
}

// Static methods to encapsulate access to the atomic's
static void
increment(IntType *metric, uint64_t val = 1)
{
ink_assert(metric);
metric->fetch_add(val, MEMORY_ORDER);
}

static void
decrement(IntType *metric, uint64_t val = 1)
{
ink_assert(metric);
metric->fetch_sub(val, MEMORY_ORDER);
}

static int64_t
read(IntType *metric)
{
ink_assert(metric);
return metric->load();
}

static void
write(IntType *metric, int64_t val)
{
ink_assert(metric);
return metric->store(val);
}

class iterator
{
public:
Expand Down Expand Up @@ -237,6 +275,7 @@ class Metrics
MetricBlobs _blobs;
uint16_t _cur_blob = 0;
uint16_t _cur_off = 0;

}; // class Metrics

} // namespace ts
5 changes: 5 additions & 0 deletions include/records/P_RecProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@
#include "I_RecProcess.h"
#include "P_RecDefs.h"

#include <functional>

//-------------------------------------------------------------------------
// Protected Interface
//-------------------------------------------------------------------------

int RecExecRawStatSyncCbs();

using RecCallbackFunction = std::function<void()>;
void RecRegNewSyncStatSync(RecCallbackFunction callback);
Loading