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
2 changes: 1 addition & 1 deletion bazel/external/quiche.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ cc_library(
hdrs = [
"quiche/quic/platform/api/quic_aligned.h",
"quiche/quic/platform/api/quic_arraysize.h",
"quiche/quic/platform/api/quic_client_stats.h",
"quiche/quic/platform/api/quic_containers.h",
"quiche/quic/platform/api/quic_endian.h",
"quiche/quic/platform/api/quic_estimate_memory_usage.h",
Expand All @@ -130,7 +131,6 @@ cc_library(
"quiche/quic/platform/api/quic_uint128.h",
# TODO: uncomment the following files as implementations are added.
# "quiche/quic/platform/api/quic_bug_tracker.h",
# "quiche/quic/platform/api/quic_client_stats.h",
# "quiche/quic/platform/api/quic_clock.h",
# "quiche/quic/platform/api/quic_expect_bug.h",
# "quiche/quic/platform/api/quic_exported_stats.h",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/quic_listeners/quiche/platform/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ envoy_cc_library(
hdrs = [
"quic_aligned_impl.h",
"quic_arraysize_impl.h",
"quic_client_stats_impl.h",
"quic_containers_impl.h",
"quic_endian_impl.h",
"quic_estimate_memory_usage_impl.h",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

// NOLINT(namespace-envoy)
//
// This file is part of the QUICHE platform implementation, and is not to be
// consumed or referenced directly by other Envoy code. It serves purely as a
// porting layer for QUICHE.

#include <string>

// NOTE(wub): These macros are currently NOOP because they are supposed to be
// used by client-side stats. They should be implemented when QUIC client code
// is used by Envoy to connect to backends.

#define QUIC_CLIENT_HISTOGRAM_ENUM_IMPL(name, sample, enum_size, docstring) \
do { \
} while (0)
#define QUIC_CLIENT_HISTOGRAM_BOOL_IMPL(name, sample, docstring) \
do { \
} while (0)
#define QUIC_CLIENT_HISTOGRAM_TIMES_IMPL(name, sample, min, max, num_buckets, docstring) \
do { \
} while (0)
#define QUIC_CLIENT_HISTOGRAM_COUNTS_IMPL(name, sample, min, max, num_buckets, docstring) \
do { \
} while (0)

namespace quic {

inline void QuicClientSparseHistogramImpl(const std::string& /*name*/, int /*sample*/) {}

} // namespace quic
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "quiche/quic/platform/api/quic_aligned.h"
#include "quiche/quic/platform/api/quic_arraysize.h"
#include "quiche/quic/platform/api/quic_client_stats.h"
#include "quiche/quic/platform/api/quic_containers.h"
#include "quiche/quic/platform/api/quic_endian.h"
#include "quiche/quic/platform/api/quic_estimate_memory_usage.h"
Expand Down Expand Up @@ -29,6 +30,19 @@ TEST(QuicPlatformTest, QuicArraysize) {
EXPECT_EQ(5, QUIC_ARRAYSIZE(array));
}

enum class TestEnum { ZERO = 0, ONE, TWO, COUNT };

TEST(QuicPlatformTest, QuicClientStats) {
// Just make sure they compile.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On functions where we're not implementing the actual functionality, should we have comments or a document somewhere for what expect to work and what not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can 1) add comments to quic_client_stats_impl.h, 2) add a column to the platform impl tracking spreadsheet to say it's not actually implemented.

Or both? WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd mildly prefer something in the code just so folks don't have to dig up the spreadsheet but as long as we're tracking it I'm good :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a comment in quic_client_stats_impl.h.

QUIC_CLIENT_HISTOGRAM_ENUM("my.enum.histogram", TestEnum::ONE, TestEnum::COUNT, "doc");
QUIC_CLIENT_HISTOGRAM_BOOL("my.bool.histogram", false, "doc");
QUIC_CLIENT_HISTOGRAM_TIMES("my.timing.histogram", quic::QuicTime::Delta::FromSeconds(5),
quic::QuicTime::Delta::FromSeconds(1),
quic::QuicTime::Delta::FromSecond(3600), 100, "doc");
QUIC_CLIENT_HISTOGRAM_COUNTS("my.count.histogram", 123, 0, 1000, 100, "doc");
quic::QuicClientSparseHistogram("my.sparse.histogram", 345);
}

TEST(QuicPlatformTest, QuicUnorderedMap) {
quic::QuicUnorderedMap<quic::QuicString, int> umap;
umap.insert({"foo", 2});
Expand Down