LCOV - code coverage report
Current view: top level - source/common/http/http2 - codec_stats.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 30 35 85.7 %
Date: 2024-01-05 06:35:25 Functions: 3 6 50.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "envoy/http/header_validator.h"
       4             : #include "envoy/stats/scope.h"
       5             : #include "envoy/stats/stats_macros.h"
       6             : 
       7             : #include "source/common/common/thread.h"
       8             : 
       9             : namespace Envoy {
      10             : namespace Http {
      11             : namespace Http2 {
      12             : 
      13             : /**
      14             :  * All stats for the HTTP/2 codec. @see stats_macros.h
      15             :  */
      16             : #define ALL_HTTP2_CODEC_STATS(COUNTER, GAUGE)                                                      \
      17        2051 :   COUNTER(dropped_headers_with_underscores)                                                        \
      18        2051 :   COUNTER(goaway_sent)                                                                             \
      19        2051 :   COUNTER(header_overflow)                                                                         \
      20        2051 :   COUNTER(headers_cb_no_stream)                                                                    \
      21        2051 :   COUNTER(inbound_empty_frames_flood)                                                              \
      22        2051 :   COUNTER(inbound_priority_frames_flood)                                                           \
      23        2051 :   COUNTER(inbound_window_update_frames_flood)                                                      \
      24        2051 :   COUNTER(keepalive_timeout)                                                                       \
      25        2051 :   COUNTER(metadata_empty_frames)                                                                   \
      26        2051 :   COUNTER(outbound_control_flood)                                                                  \
      27        2051 :   COUNTER(outbound_flood)                                                                          \
      28        2051 :   COUNTER(requests_rejected_with_underscores_in_headers)                                           \
      29        2051 :   COUNTER(rx_messaging_error)                                                                      \
      30        2051 :   COUNTER(rx_reset)                                                                                \
      31        2051 :   COUNTER(stream_refused_errors)                                                                   \
      32        2051 :   COUNTER(trailers)                                                                                \
      33        2051 :   COUNTER(tx_flush_timeout)                                                                        \
      34        2051 :   COUNTER(tx_reset)                                                                                \
      35        2051 :   GAUGE(streams_active, Accumulate)                                                                \
      36        2051 :   GAUGE(pending_send_bytes, Accumulate)                                                            \
      37        2051 :   GAUGE(deferred_stream_close, Accumulate)                                                         \
      38        2051 :   GAUGE(outbound_frames_active, Accumulate)                                                        \
      39        2051 :   GAUGE(outbound_control_frames_active, Accumulate)
      40             : /**
      41             :  * Wrapper struct for the HTTP/2 codec stats. @see stats_macros.h
      42             :  */
      43             : struct CodecStats : public ::Envoy::Http::HeaderValidatorStats {
      44             :   using AtomicPtr = Thread::AtomicPtr<CodecStats, Thread::AtomicPtrAllocMode::DeleteOnDestruct>;
      45             : 
      46             :   CodecStats(ALL_HTTP2_CODEC_STATS(GENERATE_CONSTRUCTOR_COUNTER_PARAM,
      47             :                                    GENERATE_CONSTRUCTOR_GAUGE_PARAM)...)
      48             :       : ::Envoy::Http::HeaderValidatorStats()
      49        2051 :             ALL_HTTP2_CODEC_STATS(GENERATE_CONSTRUCTOR_INIT_LIST, GENERATE_CONSTRUCTOR_INIT_LIST) {}
      50             : 
      51        2860 :   static CodecStats& atomicGet(AtomicPtr& ptr, Stats::Scope& scope) {
      52        2860 :     return *ptr.get([&scope]() -> CodecStats* {
      53        2051 :       return new CodecStats{ALL_HTTP2_CODEC_STATS(POOL_COUNTER_PREFIX(scope, "http2."),
      54        2051 :                                                   POOL_GAUGE_PREFIX(scope, "http2."))};
      55        2051 :     });
      56        2860 :   }
      57             : 
      58           0 :   void incDroppedHeadersWithUnderscores() override { dropped_headers_with_underscores_.inc(); }
      59           0 :   void incRequestsRejectedWithUnderscoresInHeaders() override {
      60           0 :     requests_rejected_with_underscores_in_headers_.inc();
      61           0 :   }
      62           0 :   void incMessagingError() override { rx_messaging_error_.inc(); }
      63             : 
      64             :   ALL_HTTP2_CODEC_STATS(GENERATE_COUNTER_STRUCT, GENERATE_GAUGE_STRUCT)
      65             : };
      66             : 
      67             : } // namespace Http2
      68             : } // namespace Http
      69             : } // namespace Envoy

Generated by: LCOV version 1.15